Skip to content

feat: machine-scoped guidance blocks go user-level — ~/.codex/AGENTS.md target (ADR-0008) - #50

Merged
pacphi merged 1 commit into
mainfrom
feat/agents-user-target
Jul 24, 2026
Merged

feat: machine-scoped guidance blocks go user-level — ~/.codex/AGENTS.md target (ADR-0008)#50
pacphi merged 1 commit into
mainfrom
feat/agents-user-target

Conversation

@pacphi

Copy link
Copy Markdown
Owner

Why

The block registry knew two guidance targets: machine-wide ~/.claude/CLAUDE.md (claude) and the projectAGENTS.md (codex). Two consequences of that asymmetry, one of which bit this very repo today:

  1. Only repos where ak sync has run ever get codex-side guidance — fresh clones and new projects get nothing.
  2. Machine state leaks into git. The dual-mode block exists only while both hosts are enabled in kit.json — a fact about one machine — yet it was being committed into shared, checked-in AGENTS.md files (see 371da30 on this repo).

Codex has the exact mechanism for machine-scoped guidance: its global ~/.codex/AGENTS.md.

What

  • New agents-user target → ~/.codex/AGENTS.md, processed by both sync (apply) and status (dry-run drift). Gated on the ~/.codexdir existing — ak never creates it; codex-less machines see zero change. One-time .bak before the first managed rewrite, mirroring CLAUDE.md's.
  • ruflo-dual-mode-reference re-scoped to ['claude','agents-user'] — machine-scoped content in machine-scoped files. The project agents target remains for genuinely repo-scoped rows.
  • Migration built in: targets now also strip sentinel-present blocks that no longer list them (retiredForTarget forced-strip rows), so project AGENTS.md files carrying the old block heal on their next sync — no orphaned sentinels.
  • One guidanceTargets() helper replaces the duplicated target lists in sync.mjs/status.mjs.
  • Docs aligned with this change and the two prior merges (feat: ak admin — maintainer-only local telemetry admin (ADR-0007) #47, fix: truthful natives across the whole ruflo tree #48): the template's own sentinel comment no longer claims project placement; README's setup/status/dual rows now state the load-tested natives row, the memory-pin warning, and the dual-run pre-flight refusal; MAINTAINER.md names the three targets; TROUBLESHOOTING/UPGRADING carry the new remedies. ADR-0008 records the scope-split decision.

Verification

  • 314 kit tests green (10 new in tests/kit/guidance-targets.test.mjs: dir-gating incl. never-mkdir, re-scope, project strip + idempotency, user-level upsert + .bak, no-empty-file/no-spurious-backup).
  • Full pnpm run check green; internal link check 0 errors.
  • Live ak sync --dry-run on a dual-host machine shows exactly the intended plan: CLAUDE.md upsert + project AGENTS.md strip + ~/.codex/AGENTS.mdupsert.

After merge

The next ak sync in this repo strips the dual-mode block from the checked-in AGENTS.md (committed in 371da30) — that strip will land as its own small follow-up commit.

🤖 Generated with Claude Code

…md target (ADR-0008)
The block registry knew two guidance targets: machine-wide
~/.claude/CLAUDE.md and the PROJECT AGENTS.md. That asymmetry meant
(a) only synced repos ever got codex-side guidance, and (b) machine
state leaked into git — the dual-mode block exists only when both hosts
are enabled in kit.json, a fact about one machine, yet it was committed
into shared checked-in AGENTS.md files.
- New `agents-user` target → ~/.codex/AGENTS.md (codex's global
guidance file). Dir-exists gated — ak never creates ~/.codex; one-time
.bak before the first managed rewrite, mirroring CLAUDE.md's.
- `ruflo-dual-mode-reference` re-scoped to ['claude','agents-user'];
the project `agents` target stays for genuinely repo-scoped rows.
- Migration: each target now also strips sentinel-present blocks that no
longer list it (`retiredForTarget` forced-strip rows), so project
AGENTS.md files carrying the old block heal on their next sync.
- One shared `guidanceTargets()` helper replaces the duplicated target
lists in sync.mjs/status.mjs.
- Docs aligned with this and #47/#48: template sentinel comment, README
setup/status/dual rows (truthful natives, memory-pin, pre-flight
refusal), MAINTAINER.md registry description, UPGRADING/
TROUBLESHOOTING remedies. ADR-0008 records the scope split.
314 kit tests green (10 new); full check chain green. Live dry-run:
CLAUDE.md upsert + project AGENTS.md strip + ~/.codex/AGENTS.md upsert.
@pacphi
pacphi merged commit 2e7cdc8 into mainJul 24, 2026
11 checks passed
@pacphi
pacphi deleted the feat/agents-user-target branch July 24, 2026 18:31
pacphi added a commit that referenced this pull request Jul 24, 2026
…ation)
The first ak sync after #50 moves the machine-scoped
ruflo-dual-mode-reference block out of the project AGENTS.md and into
~/.codex/AGENTS.md, where machine truths belong. Reverts the content
added in 371da30 — the retired-block strip working as designed.
Sign up for freeto 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

@pacphi