Skip to content

feat: scaffold layered agent instruction files from shipped templates - #1

Merged
halaprix merged 1 commit into
mainfrom
feat/agent-instruction-files
Jul 27, 2026
Merged

feat: scaffold layered agent instruction files from shipped templates#1
halaprix merged 1 commit into
mainfrom
feat/agent-instruction-files

Conversation

@halaprix

Copy link
Copy Markdown
Owner

What

Ships one layered set of agent instruction files so project law is written once instead of three times. AGENTS.md is canonical — Codex and opencode read it natively — while CLAUDE.md and GEMINI.md import it and carry only assistant-specific mechanics.

Changes

  • templates/agent-instructions/{AGENTS,CLAUDE,GEMINI}.md — generic templates for adopting projects, with explicit placeholders for project-specific content.
  • src/lib/agent-instructions.mjs — scaffold missing files, report status; never overwrite an existing file.
  • relay setup writes the missing files and adds all three to the project's local git exclude state. relay doctor reports which are present.
  • .gitignore keeps this repository's own copies local.
  • README section and skills/relay/SKILL.md guidance.

Evidence

  • npm test — 117 pass / 0 fail (was 116; one new test).
  • npm run lint — green (link check, privacy scan, site and marketplace validation).
  • npm run check — green (byte-identity of generated role and adapter output).
  • Verified the three root files are ignored while the templates remain tracked: git check-ignore -v reports the root paths ignored and exits non-zero for the template paths.

Notes

Two details worth a reviewer's attention:

Root-anchored ignore patterns. A bare AGENTS.md pattern matches at every depth. Unanchored, it silently ignored the shipped templates in this repository, and in an adopting project it would ignore a package-level AGENTS.md that project legitimately tracks. Both the .gitignore lines and the generated exclude entries are /-anchored, with a comment saying why.

No-overwrite is under test. The project fixture already ships its own three files, so the test asserts the preserve branch against it, then removes them to assert the write branch, then edits one and reruns to confirm neither the file nor the exclude entry is touched twice.

Out of scope

The instruction files themselves stay uncommitted by design — they name per-machine tooling and model choices, and a project's rules are not Agent Relay's to version. That also means git clean -xfd deletes them; the templates are the recovery path.

Every assistant reads project law from a different filename in the repository
root, so the law gets written three times and drifts. Ship one layered set
instead: AGENTS.md is canonical and read natively by Codex and opencode, while
CLAUDE.md and GEMINI.md import it and carry only assistant-specific mechanics.

relay setup writes any of the three that are missing from
templates/agent-instructions/ and adds all three to the project's local git
exclude state; relay doctor reports which are present. An existing file is never
touched - by then it is the project's own law and a template is only a starting
point. The test covers both branches plus a rerun, since the project fixture
already ships its own copies.

The exclude entries and this repository's own .gitignore lines are root-anchored.
An unanchored `AGENTS.md` matches at every depth, which would ignore both the
shipped templates here and a package-level AGENTS.md an adopting project tracks.

The templates carry only what is true for any project: the inherited-BEADS_DIR
trap that silently routes bd calls into another project's store,
verify-don't-trust delegation, no AI attribution, and Beads as the only durable
task system. Project-specific content is left as explicit placeholders.

The files stay local and uncommitted: they name per-machine tooling and model
choices, and a project's rules are not Agent Relay's to version.

Verified: 117 pass / 0 fail, lint and check green.
@halaprix
halaprix merged commit 28f54f6 into main Jul 27, 2026
2 checks passed
@halaprix
halaprix deleted the feat/agent-instruction-files branch July 27, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant