docs(agents): upgrade agent-foundry to 0593562 #50

Merged
claudiomaradonna merged 1 commit from chore/foundry-upgrade-0593562 into main 2026-11-16 13:03:35 +01:00
Collaborator

Why

castrum's coding agents (Claude Code, Codex, OpenCode) work from a
policy adopted from
Agent Foundry:
AGENTS.md, the skills under .agents/skills/, the subagent briefs and
their adapters, and the templates of a work folder. The
foundry-upgrade skill brings in the source's later commits; the last
upgrade stopped at b04e778.

Since then the source fixed a fold that could check the wrong
repository. In a linked worktree, where every castrum change happens,
git rebase exports GIT_DIR to its --exec checks, so a check that
runs Git, or starts a tool that does, acts on the worktree's admin
directory instead of its own repository. The source also stopped
briefing an implementer from scratch at every attempt, and set when a
passing check's result may be reused instead of run again.

What changed

Implementers get the failed attempt from which they stop, run one
effort level higher after an attempt of their own fails, and, in Claude
Code and Codex, are continued with their context rather than briefed
anew; their report has a fixed order. A handoff is saved in the work
folder and sent as one line naming that file.

The work template's Status says when passing evidence may be reused.
verify-execution passes the every-commit checks before the reviewers
and still runs Verify at the end, settle-findings passes them before
a later round, and prove-on-main may keep its proof worktree, which
the calling phase then owns.

fold-branch unsets GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and
GIT_COMMON_DIR before the fast checks. deliver folds, prepares the
pull request text, pushes, and only then opens the pull request, and
land.md names both errors of a first push under Claude Code's
sandbox. The pull request form is rewritten, in
.agents/templates/pull-request.md and in
.forgejo/pull_request_template.md. The Codex reviewers turn memories
off, and the Codex implementers turn off apps, plugins, memories and
bundled skills. AGENTS.md gains one routing sentence for a workflow
whose change is also a trim.

The foundry-upgrade Record names 0593562. Every file merged
cleanly, and no migration of the source's UPGRADING.md applies.

How to verify

Prerequisites: Git 2.48 or later, a castrum checkout, and a clone of the
source at the chosen commit. Base main is 3553a82; branch
chore/foundry-upgrade-0593562 is 7fe4aeb. From the castrum checkout:

git clone https://git.unitoo.it/claudiomaradonna/agent-foundry.git /tmp/agent-foundry
git -C /tmp/agent-foundry checkout --detach 05935623f81f72173cb494bb1d0d82082d30e5a0
git fetch origin chore/foundry-upgrade-0593562
  1. The source's validator accepts the branch:

    git worktree add --detach /tmp/castrum-upgrade origin/chore/foundry-upgrade-0593562
    bash /tmp/agent-foundry/scripts/verify-agent-config.sh /tmp/castrum-upgrade
    

    Expected and observed: agent configuration statically valid: state=initialized, exit 0.

  2. The merge is faithful. Every file the branch changes equals the
    source's at the chosen commit, except the Record and AGENTS.md,
    whose one hunk is the source's own:

    SRC=/tmp/agent-foundry B=origin/chore/foundry-upgrade-0593562
    A=b04e7781d795547882b7bd47b878057cc9cdec32 C=05935623f81f72173cb494bb1d0d82082d30e5a0
    for p in $(git diff --name-only main "$B"); do
      git -C "$SRC" show "$C:$p" 2>/dev/null | cmp -s - <(git show "$B:$p") || echo "differs: $p"
    done
    diff <(git diff main "$B" -- AGENTS.md | grep '^[-+][^-+]') \
         <(git -C "$SRC" diff "$A" "$C" -- AGENTS.md | grep '^[-+][^-+]') && echo "same hunk"
    

    Expected and observed: differs: .agents/skills/foundry-upgrade/SKILL.md,
    differs: AGENTS.md, then same hunk.

  3. Changed behavior, fold-branch: in a linked worktree, the base's
    --exec checks see the worktree's GIT_DIR, and the branch's clear
    it. In a throwaway repository:

    cd "$(mktemp -d)" && git init -q -b main demo && cd demo
    git config user.name Demo && git config user.email demo@example.invalid
    git commit -q --allow-empty -m base
    git worktree add -q -b topic ../topic && cd ../topic
    git commit -q --allow-empty -m one
    git rebase -q --keep-base --exec 'echo "GIT_DIR=${GIT_DIR:-unset}"' main
    git rebase -q --keep-base --exec 'unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR; echo "GIT_DIR=${GIT_DIR:-unset}"' main
    

    Expected and observed: the first prints
    GIT_DIR=<tmp>/demo/.git/worktrees/topic, the second
    GIT_DIR=unset.

  4. Untested, not run because it needs a work file approved for
    execution: implementer continuation. In a work folder whose T1 and T2
    are both subagent tasks at effort medium, prompt Claude Code with
    execute the work in .plans/<folder>. Expected: once T1's report
    passes the main session's check, T2 goes to the same implementer
    through SendMessage, as one line naming
    handoffs/T2-implementer-medium.md, rather than to a new one.

Checks on 7fe4aeb: make check passed; make test did not run,
because podman is missing in the environment that made the change.
change-reviewer, security-reviewer and document-reviewer found no
defect the merge brings.

Considerations

  • Molecule and the tag_propagation gate have not run on this branch.
    The diff touches only agent policy, so their results cannot change.
  • The documentation review raised ten points in text the source holds
    unchanged, such as implementer.md restating the work template's
    definition of an attempt, and prove-on-main leaving open how a kept
    proof worktree is restored. They are left to the source, so the next
    merge stays clean.
  • Continuing an implementer carries its context into the next task; the
    policy allows it only after the main session's check of the last
    result finds no departure.
## Why castrum's coding agents (Claude Code, Codex, OpenCode) work from a policy adopted from [Agent Foundry](https://git.unitoo.it/claudiomaradonna/agent-foundry): `AGENTS.md`, the skills under `.agents/skills/`, the subagent briefs and their adapters, and the templates of a work folder. The `foundry-upgrade` skill brings in the source's later commits; the last upgrade stopped at `b04e778`. Since then the source fixed a fold that could check the wrong repository. In a linked worktree, where every castrum change happens, `git rebase` exports `GIT_DIR` to its `--exec` checks, so a check that runs Git, or starts a tool that does, acts on the worktree's admin directory instead of its own repository. The source also stopped briefing an implementer from scratch at every attempt, and set when a passing check's result may be reused instead of run again. ## What changed Implementers get the failed attempt from which they stop, run one effort level higher after an attempt of their own fails, and, in Claude Code and Codex, are continued with their context rather than briefed anew; their report has a fixed order. A handoff is saved in the work folder and sent as one line naming that file. The work template's Status says when passing evidence may be reused. `verify-execution` passes the every-commit checks before the reviewers and still runs Verify at the end, `settle-findings` passes them before a later round, and `prove-on-main` may keep its proof worktree, which the calling phase then owns. `fold-branch` unsets `GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE` and `GIT_COMMON_DIR` before the fast checks. `deliver` folds, prepares the pull request text, pushes, and only then opens the pull request, and `land.md` names both errors of a first push under Claude Code's sandbox. The pull request form is rewritten, in `.agents/templates/pull-request.md` and in `.forgejo/pull_request_template.md`. The Codex reviewers turn memories off, and the Codex implementers turn off apps, plugins, memories and bundled skills. `AGENTS.md` gains one routing sentence for a workflow whose change is also a trim. The `foundry-upgrade` Record names `0593562`. Every file merged cleanly, and no migration of the source's `UPGRADING.md` applies. ## How to verify Prerequisites: Git 2.48 or later, a castrum checkout, and a clone of the source at the chosen commit. Base `main` is `3553a82`; branch `chore/foundry-upgrade-0593562` is `7fe4aeb`. From the castrum checkout: ```bash git clone https://git.unitoo.it/claudiomaradonna/agent-foundry.git /tmp/agent-foundry git -C /tmp/agent-foundry checkout --detach 05935623f81f72173cb494bb1d0d82082d30e5a0 git fetch origin chore/foundry-upgrade-0593562 ``` 1. The source's validator accepts the branch: ```bash git worktree add --detach /tmp/castrum-upgrade origin/chore/foundry-upgrade-0593562 bash /tmp/agent-foundry/scripts/verify-agent-config.sh /tmp/castrum-upgrade ``` Expected and observed: `agent configuration statically valid: state=initialized`, exit 0. 2. The merge is faithful. Every file the branch changes equals the source's at the chosen commit, except the Record and `AGENTS.md`, whose one hunk is the source's own: ```bash SRC=/tmp/agent-foundry B=origin/chore/foundry-upgrade-0593562 A=b04e7781d795547882b7bd47b878057cc9cdec32 C=05935623f81f72173cb494bb1d0d82082d30e5a0 for p in $(git diff --name-only main "$B"); do git -C "$SRC" show "$C:$p" 2>/dev/null | cmp -s - <(git show "$B:$p") || echo "differs: $p" done diff <(git diff main "$B" -- AGENTS.md | grep '^[-+][^-+]') \ <(git -C "$SRC" diff "$A" "$C" -- AGENTS.md | grep '^[-+][^-+]') && echo "same hunk" ``` Expected and observed: `differs: .agents/skills/foundry-upgrade/SKILL.md`, `differs: AGENTS.md`, then `same hunk`. 3. Changed behavior, `fold-branch`: in a linked worktree, the base's `--exec` checks see the worktree's `GIT_DIR`, and the branch's clear it. In a throwaway repository: ```bash cd "$(mktemp -d)" && git init -q -b main demo && cd demo git config user.name Demo && git config user.email demo@example.invalid git commit -q --allow-empty -m base git worktree add -q -b topic ../topic && cd ../topic git commit -q --allow-empty -m one git rebase -q --keep-base --exec 'echo "GIT_DIR=${GIT_DIR:-unset}"' main git rebase -q --keep-base --exec 'unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR; echo "GIT_DIR=${GIT_DIR:-unset}"' main ``` Expected and observed: the first prints `GIT_DIR=<tmp>/demo/.git/worktrees/topic`, the second `GIT_DIR=unset`. 4. Untested, not run because it needs a work file approved for execution: implementer continuation. In a work folder whose T1 and T2 are both subagent tasks at effort medium, prompt Claude Code with `execute the work in .plans/<folder>`. Expected: once T1's report passes the main session's check, T2 goes to the same implementer through SendMessage, as one line naming `handoffs/T2-implementer-medium.md`, rather than to a new one. Checks on `7fe4aeb`: `make check` passed; `make test` did not run, because podman is missing in the environment that made the change. `change-reviewer`, `security-reviewer` and `document-reviewer` found no defect the merge brings. ## Considerations - Molecule and the `tag_propagation` gate have not run on this branch. The diff touches only agent policy, so their results cannot change. - The documentation review raised ten points in text the source holds unchanged, such as `implementer.md` restating the work template's definition of an attempt, and `prove-on-main` leaving open how a kept proof worktree is restored. They are left to the source, so the next merge stays clean. - Continuing an implementer carries its context into the next task; the policy allows it only after the main session's check of the last result finds no departure.
docs(agents): upgrade agent-foundry to 0593562
Some checks failed
check / check (pull_request) Successful in 19m35s
check / check (push) Has been cancelled
7fe4aeb0ea
Merge Agent Foundry from b04e778 to 0593562 three ways; every file
merged cleanly and no migration applies.

Implementers now learn the failed attempt they stop at, run one effort
level higher after a failed attempt of their own, and are continued
rather than briefed anew in Claude Code and Codex. The work template's
Status says when passing evidence may be reused, which verify-execution
and settle-findings apply. Deliver orders its actions, fold-branch
clears GIT_DIR for its checks in a worktree, and the pull request form,
copied again to .forgejo/, is rewritten. AGENTS.md gains the routing
sentence for a workflow that is also a trim.
claudiomaradonna deleted branch chore/foundry-upgrade-0593562 2026-11-16 13:03:43 +01:00
Sign in to join this conversation.
No description provided.