Skip to content

spec(cli-surface): agent docs reach every agent from the project's own files - #7539

Merged
josephfarina merged 4 commits into
mainfrom
josephfarina/cli-surface-agent-docs-spec
Oct 20, 2026
Merged

josephfarina merged 4 commits into
mainfrom
josephfarina/cli-surface-agent-docs-spec

Conversation

@josephfarina

@josephfarina josephfarina commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Exact decision needed

Which files astryx init writes its agent-docs block to, how it finds the project root, where it writes no agent docs, and where --remove-agents removes the block, so that every agent CLI reads the block and removal finds every copy init wrote.

Existing authority searched

  • architecture:cli-surface lists foundation/agent-docs as owning code and states INV10 (every write is confined) and INV13 (the block has one rendered source of truth). Neither says which files hold the block. This record is the canonical owner, so the rules extend it as INV31, with DEC-2 for the reasoning behind them.
  • spec:AST-040 owns how an operation edits existing consumer files. spec:AST-042, spec:AST-048 and spec:AST-050 own parts of what the block says. None of them decides where the block goes.
  • Terms searched under docs/: agent docs, AGENTS.md, CLAUDE.md, GEMINI.md, init, the setup check, and foundation/agent-docs.
  • Open pull requests on this record:

Decision

INV31: by default, every agent CLI reads at least one copy of the block, from files the project commits, whether it starts at the project root or in a folder below it. --agent and --agent-docs-path name the files instead, and a preset never leaves a copy in both Claude Code files.

  • AGENTS.md at the project root holds the block, and init creates it when it is missing.
  • The project's Claude Code file holds a full copy: root CLAUDE.md, else .claude/CLAUDE.md. It holds the copy even when it imports AGENTS.md, because Claude Code does not follow an import of a file above the folder it starts in. While root CLAUDE.md holds a copy, .claude/CLAUDE.md holds none. init creates no Claude Code file.
  • GEMINI.md holds a one-line managed import of AGENTS.md, unless it already imports AGENTS.md. Settings that point Gemini CLI at AGENTS.md do not replace the import, because Gemini CLI reads project settings only when it starts at the project root.
  • Every other agent file holds a full copy unless it imports AGENTS.md. A project whose agent files import other agent files, or share one file, keeps its own layout.
  • A managed import counts only while AGENTS.md holds the block; doctor fails otherwise.
  • init writes at the project root: the nearest folder whose package.json declares an @astryxdesign package, else the nearest folder with a package.json, else the working folder. The search stops at a repository root and never counts the home folder.
  • No mode writes agent docs into the home folder, or into a settings folder in it outside a project. It reports the folder it refused and still succeeds. A folder inside a settings folder belongs to a project when it, or a folder above it below the settings folder, has a package.json.
  • upgrade refreshes every copy where it is.
  • init --remove-agents removes the block at the project root and in the working folder. Every file it would change resolves inside its own folder, or it changes nothing.

DEC-2 records the principle: no placement gives every agent exactly one copy in every project, so each agent gets at least one, and extra copies are accepted where agents share files.

Rejected alternatives

  • An import of AGENTS.md in the Claude Code file instead of a copy: Claude Code does not follow it in a session started in a subfolder.
  • The Claude Code copy only in .claude/CLAUDE.md: many projects keep .claude/ out of version control, so a fresh clone would have none. This one is recorded in DEC-2.
  • No GEMINI.md import when settings point Gemini CLI at AGENTS.md: a session started in a subfolder would have none.

Claim scope and non-goals

  • Covers the default init layout, how the project root is found, the folders init refuses, and where --remove-agents removes the block.
  • Not covered:
    • what the block says;
    • the --agent presets, beyond the single Claude Code copy;
    • --agent-docs-path;
    • agent CLIs other than the four the decision names.

Evidence and implementation relationship

Writing rubric results

  • R1 narration: none. INV31 and DEC-2 state the system in the present tense.
  • R2 research in the record: DEC-2 keeps one sentence on which files each agent CLI reads, the basis the decision rests on. The measurements stay in the implementation pull request.
  • R3 evidence naming a change: none. The verification row names tests.
  • R4 rejected alternatives over one line or outside a decision: one, inside DEC-2, one line.
  • R5 pull request or issue references remaining: none in the changed text.
  • R6 ruled open questions still listing options: none. The record's one open question is unchanged.

Scope

  • This PR contains specification records only.
  • It records observable behavior and preserves equivalent internal implementations.
  • Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
  • Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
  • It records one intentional durable decision, not a rescue for a separable tagalong.
  • The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
  • Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
  • Public text and artifacts contain no internal Meta context.

Validation

  • pnpm check:knowledge: passes.
  • Prettier: the added text is formatted. The verification table was already unaligned on main, and the added row follows it.
  • git diff --check: clean.

…n files

INV31 records which files hold the agent-docs block, how init finds the
project root, and where it writes no agent docs. DEC-2 records why every
agent gets at least one copy and a second copy is accepted.
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 20, 2026 4:32pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 14, 2026
@astracat-bot

astracat-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Oct 20, 2026, 4:24 PM UTC

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

40 of 486 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 20 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

--remove-agents removes the block at the project root and in the working
folder, and changes nothing when a file it would change resolves outside
its folder. The change-coupling line and the INV31 verification row name
removal too.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cd19a6d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 20, 2026
@josephfarina
josephfarina merged commit 820871f into main Oct 20, 2026
56 of 57 checks passed
@github-actions
github-actions Bot deleted the josephfarina/cli-surface-agent-docs-spec branch October 21, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — cd19a6d2 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant