You are working with the agentrail saga/steps process. The saga record (the
.agentrail/ directory) is the durable handoff between sessions — if your
work is not reflected there, the next session cannot see it.
Before reporting work as complete:
- Confirm the active step is reflected in
.agentrail/and committed. - Run the project's pre-commit gate (tests, lint, format) before
agentrail complete, not after. - If you discover unplanned work, prefer
agentrail insert/agentrail addover silently doing it inside another step.
Every session follows this sequence. Do not skip steps, do not reorder.
First thing in the session. Read the output carefully: it tells you the
current step number, prompt, skill docs, and past trajectories. If next
exits non-zero, the saga is complete or absent — do not invent work.
Run immediately after reading next output. This transitions the step from
Pending to InProgress so the recorded history matches what actually
happened.
Do what the step prompt says. Do NOT ask the user "want me to proceed?" or "shall I start?" — the step prompt IS your instruction. Execute it.
Commit your code changes with git BEFORE running agentrail complete.
The commit recorded into the step's commits field comes from HEAD at
the moment of complete, so the commit must land first.
agentrail complete --summary "what you accomplished" \
--reward 1 \
--actions "tools and approach used"
On failure: --reward -1 --failure-mode "what went wrong".
On final step: add --done.
After complete, do NOT make further code changes. Anything after
complete is untracked and invisible to the next session. If you see more
work to do, it belongs in the NEXT step, not this one.
When using agentrail, changes to .agentrail/ files are first-class project
changes — the same as application source code. They must be committed, and
should be pushed before you hand off.
Before running agentrail complete:
git status— confirm.agentrail/files are tracked, not just present. Untracked files in.agentrail/mean the next session will not see them.- Stage and commit source changes and
.agentrail/metadata together. The commit recorded into the step'scommitsfield comes fromHEADat the moment ofagentrail complete, so the commit must happen first. - Run
agentrail completeafter the commit lands. - Push the branch (or note the unpushed branch state in your handoff).
This is the most common agentrail failure mode: agents do the work, commit
the source, and forget the .agentrail/ files. The result is a saga whose
recorded history disagrees with git history, which agentrail audit will
flag — but only after the damage is done.
Never edit or delete files under .agentrail/ by hand. Always go through
agentrail commands. A direct rm on untracked step files is unrecoverable.
A commit that hasn't been pushed is invisible to the next session, to
collaborators, and to CI. After running agentrail complete, push the
branch:
git pushIf you cannot push (no remote, no network, branch protection, etc.):
- Note the unpushed branch state explicitly in your handoff or summary so the next session knows to push it.
- Do NOT silently leave commits stranded on a local branch — the next agent will look at the remote and assume your work was lost.
If the remote rejects the push:
- For non-fast-forward errors on a personal branch, prefer
git pull --rebaseover--forceunless the user has explicitly authorized force-push. - Never force-push to a shared branch (
main, release branches) without an explicit instruction.
The saga is a record of git history. When the two diverge — agent forgets
to commit .agentrail/, a step is reverted, files are renamed by hand —
agentrail provides two recovery tools.
Compares first-parent git history against saga steps and reports gaps.
Default output is a markdown report; --emit-commands prints a shell
script of agentrail add lines pre-seeded from commit subjects:
agentrail audit # human-readable report
agentrail audit --emit-commands # draft script (review before running)
agentrail audit --since HEAD~50 # limit scopeThe emitted script is a draft — slugs and prompts come from commit subjects and usually need rewording. Review and edit before executing.
Captures .agentrail/ (and .agentrail-archive/ if present) into a real
git commit under refs/agentrail/snapshots/<timestamp>. The blobs are
reachable, survive git gc, and can be restored with a normal git
command:
agentrail snapshot # take a snapshot now
agentrail snapshot --list # list existing refs
git restore --source=<ref> -- .agentrail .agentrail-archiveRun a snapshot before risky agent operations or after creating files you haven't yet staged. It does NOT replace normal git tracking — it is a safety net for what is not yet committed.
- Never amend a commit that has already been pushed to a shared branch.
- Never use
--no-verifyto skip pre-commit hooks unless explicitly told to. If a hook fails, fix the underlying issue. - Prefer naming files explicitly (
git add path/to/file) overgit add -A, to avoid sweeping in unintended files (secrets, local scratch, etc.). - Resolve merge conflicts; do not discard changes by default.
COR24 BASIC v1 — a 1970s time-sharing-style, line-numbered, integer-only BASIC interpreter for the COR24 p-code virtual machine. Inspired by UNIVAC 1100-series terminal BASIC with teletype and paper-tape workflows. Emphasizes simplicity, hardware access (PEEK/POKE), and interactive program development over compatibility with later BASIC standards.
BASIC complements Pascal in the COR24 ecosystem: Pascal is compiled and structured; BASIC is interpreted, dynamic, and interactive — ideal for monitor/scripting/hardware bring-up work.
onboarding # paths, branch policy, helpers, current repo state
agentrail next # current step prompt + plan contextonboarding is the devgroup session briefing (it's on PATH). Read
both outputs carefully before touching code — onboarding surfaces
the branch policy, the dg-* helpers, and any pending pr/*
branches waiting for the coordinator.
agentrail beginDo NOT ask "want me to proceed?". The step prompt IS your instruction. Execute it directly.
Commit your code changes with git. Use /mw-cp for the checkpoint
process (pre-commit checks, docs, detailed commit, push).
Run /mw-cp in every repo that was modified during the step.
agentrail complete --summary "what you accomplished" \
--reward 1 \
--actions "tools and approach used"- If the step failed:
--reward -1 --failure-mode "what went wrong" - If the saga is finished: add
--done
Do NOT make further code changes after running agentrail complete.
Any changes after complete are untracked and invisible to the next
session. Future work belongs in the NEXT step, not this one.
- Do NOT skip steps — the next session depends on accurate tracking
- Do NOT ask for permission — the step prompt is the instruction
- Do NOT continue working after
agentrail complete - Commit before complete — always commit first, then record completion
Work happens on feat/<slug> or fix/<slug> branches off dev
(fix/ is the bug-fix flavor of feat/). A branch accumulates
commits until the work is complete; the final step is a rename to
pr/<slug> — that rename IS the handoff. "PR" here means a
pr/<slug> branch awaiting the coordinator, NOT a GitHub pull
request opened by the dev agent. The coordinator (mike) picks up
pr/ branches, merges them into dev, and pushes.
Dev agents (that's you) have NO remote write access. Do not invoke
git push, gh pr create, or any other GitHub-side command. The
push phase of /mw-cp does not apply on feat/*, fix/*, or
pr/* branches — stop at the commit step.
Base new branches on origin/dev (fall back to origin/main only
when origin/dev doesn't exist yet). No history rewrites on dev
or main; rebase is fine on your own feat/* / fix/*.
Prefer the dg-* helpers (on $PATH via SCRIPTROOT) over hand-
rolling the git plumbing:
dg-new-feature <slug> # git switch dev && git switch -c feat/<slug>
dg-new-fix <slug> # git switch dev && git switch -c fix/<slug>
dg-mark-pr # rename current feat/*|fix/* to pr/* (handoff)
dg-list-pr # list local pr/* branches signalling ready
dg-reap # fetch; fast-forward dev; delete pr/* merged into origin/dev
dg-env / dg-policy # environment dump / branch-policy reminderTypical flow for a fix:
dg-new-fix <slug>
# ... do the work, commit (no push) ...
dg-mark-pr # now on pr/<slug>; coordinator will relayAfter the coordinator merges your pr/<slug> into origin/dev,
clean up with dg-reap (this is what "reap" means in this project —
not a GitHub-API cleanup, just branch -D for pr/* already in
origin/dev).
Full policy: /disk1/github/softwarewrighter/devgroup/docs/branching-pr-strategy.md.
agentrail status # Current saga state
agentrail history # All completed steps
agentrail plan # View the plan
agentrail next # Current step + contextAll .pas source files MUST be formatted with scripts/format.sh before
every commit. This uses emacs pascal-mode to apply consistent indentation.
./scripts/format.sh # format all src/*.pas filesRun this as part of your pre-commit workflow. Do not commit unformatted Pascal source.
The BASIC interpreter runs on the COR24 p-code VM. Implementation language is TBD (Pascal compiled to p-code, p-code assembly, or host-side prototype in Rust/C first).
- p-code VM:
sw-cor24-pcode— the execution substrate - Pascal compiler:
sw-cor24-plsw— compiles Pascal to p-code - Emulator:
sw-cor24-emulator— runs COR24 binaries and p-code VM - Cross-assembler:
sw-cor24-x-assembler— if p-code assembly needed - Cross C compiler:
sw-cor24-x-tinyc— if C implementation path
BASIC sits as a language layer above the p-code VM:
- Layer 0: COR24 hardware/emulator
- Layer 1: p-code VM (language-neutral abstract machine)
- Layer 2: BASIC runtime (terminal I/O, line storage, expression helpers, GOSUB/FOR stacks, PEEK/POKE, tape abstraction)
- Layer 3: BASIC interpreter (tokenizer, parser, statement dispatch, execution of tokenized lines)
The VM should NOT get BASIC-specific opcodes. Only language-neutral primitives belong in the VM (byte load/store, memcpy, traps, indirect jump, generic syscall gateway). Language semantics stay in the interpreter/runtime layer.
All COR24 repos live under ~/github/sw-embed/ as siblings.
sw-cor24-pcode— p-code VM implementation (execution substrate)sw-cor24-pascal— Pascal language supportsw-cor24-plsw— Pascal-to-p-code compilersw-cor24-x-pc-aotc— AOT p-code-to-native compiler (Rust, host-side)sw-cor24-emulator— emulator + ISA (foundation for everything)
sw-cor24-x-assembler— cross-assembler in Rust (runs on host)sw-cor24-x-tinyc— cross C compiler in Rust (runs on host)sw-cor24-assembler— native assembler in C (runs on COR24)sw-cor24-script— sws scripting language (runs on COR24)sw-cor24-monitor— resident monitor / service processorsw-cor24-project— hub/portal repo with migration trackingsw-cor24-macrolisp— Lisp interpretersw-cor24-apl— APL interpretersw-cor24-forth— Forth implementation
You are the only agent running for this project and have direct r/w access to all sw-embed repos.