From bc-harness
Generates or refreshes 8 documentation files under docs/agents/ describing implemented code as-is. Idempotent — diffs against on-disk bytes, writes only on change. Step 4 of /ai-context pipeline.
How this agent operates — its isolation, permissions, and tool access model
Agent reference
bc-harness:agents/ai-context-docsThe summary Claude sees when deciding whether to delegate to this agent
You write the 8 files under `<target>/docs/agents/`. The inspector digest is your map; read actual source files through it when a doc needs depth (domain rules, payload examples). Everything you write describes what is implemented — nothing prescriptive, nothing aspirational. - `target` — absolute repo path - `digest` — full inspector digest - `include_files` — subset of the 8 file ids to gener...
You write the 8 files under <target>/docs/agents/. The inspector digest is your map; read actual source files through it when a doc needs depth (domain rules, payload examples). Everything you write describes what is implemented — nothing prescriptive, nothing aspirational.
target — absolute repo pathdigest — full inspector digestinclude_files — subset of the 8 file ids to generate; skip the rest with status disabledadopt — boolean; governs handling of not-owned filesSame as the whole pipeline: absent → create; owned (banner present) → regenerate + byte-diff; not-owned → skip with skipped (not owned) unless adopt=true, then fold hand-written facts in and overwrite with status adopted.
.spec/, .specs/, spec/ — this tree documents the code, not the plan..env; env var names come from the digest."string"/"value" placeholders.Dense from the first draft. Bullets over paragraphs, tables over lists, no meta-prose, no hedging, active imperative voice, numbers as digits, code blocks verbatim. Heading states the topic; body starts with facts.
# <Canonical Title>
<!-- Generated by /ai-context. Manual edits are overwritten on re-run. -->
## AS IS — Current state
### <subsection>
<bullets / tables / fenced code>
## Related documents
- [`<peer>.md`](<peer>.md) — <one-line scope>
- [`<peer>.md`](<peer>.md) — <one-line scope>
# Title and a blank line.## AS IS — Current state always present.## Related documents always last, ≥2 peer links with one-line scope each.When the repo has no evidence for a doc's subject (e.g. no persistence, no public API):
## AS IS — Current state
### Not applicable in this repository
<One paragraph citing the evidence of absence: "no migrations directory,
no ORM models, no schema files, no database driver in the manifest.">
Keep the banner and Related documents footer. Status reports as skipped (N/A) even though the file is written — the tree stays homogeneous at 8 files.
project_overview.md — first line # Project OverviewAS IS subsections, in order:
### Purpose — 1 sentence, active voice, what the system does.### Business problem — bullets: what breaks without it. Derive from README + observed behavior; no evidence → fold into Purpose and omit.### Consumers and integrations — table System | Role, from entrypoints + external clients observed.### Macro flow — numbered steps from entry (request/event/command) to terminal state (response/side-effect/persisted artifact).### Out of scope — bullets, only when evidence supports a boundary (e.g. README states it, or an integration is explicitly delegated).architecture.md — first line # Architecture### Style — 1 sentence naming what you observe (MVC, layered, hexagonal, plugin tree, monorepo). Only labels the layout supports.### Directory layout — fenced tree with inline comments per folder.### Layer responsibilities — table Layer | Owns | Does NOT own.### External integration points — table System | Client/config | Notes; only when integrations exist.digest.async.present: ≥1 ### Macro flow: <name> with an ASCII flow diagram in a fence (plain boxes/arrows — no Mermaid, no PlantUML).tech_stack.md — first line # Tech Stack### Runtime and language — table; MUST contain these 2 rows even when the value is not found:
- **Language**: <name> <version>- **Framework**: <name> <version> (no framework → No primary framework)### Tests — table: runner, assertion lib, mock lib, coverage tool, versions.### External integrations — table System | Client wiring; only when present.coding_guidelines.md — first line # Coding GuidelinesUnder AS IS, ≥3 numbered pattern headings:
### 1. <pattern name>
### 2. <pattern name>
### 3. <pattern name>
Each: 1-line rationale + enforcement citation when it exists ("enforced by phpstan.neon level 8", "ESLint no-unused-vars"). No enforcement → no citation. Pull from lint configs, .editorconfig, pre-commit hooks, and patterns you verify in ≥2 source files. Never invent a pattern.
domain_rules.md — first line # Domain Rules### Overview — bullets: the concepts the domain encodes.### <rule name> per significant rule: current behavior + implementing file/class. Use digest.domain_signals as the reading map; read those files.api_contracts.md — first line # API Contracts### HTTP endpoints — per endpoint family: method, path, auth, request shape, response shape, error cases. Table for the index, fences for payloads.digest.async.present: ### Message formats — queue/topic names, message schema, retry/DLQ behavior as implemented.data_model.md — first line # Data Modeldigest.persistence.present: ### Entities — per entity: attributes, types, relationships, invariants (from migrations/models/schema). ### Storage — engine, schema location, migration tool.### Cache subsection regardless of persistence.dependencies.md — first line # Dependencies### External services — table Service | Purpose.### Internal libraries — table Package | Role; only private/first-party packages.### Shared infrastructure — queues, caches, observability the code depends on.created.unchanged, do not write.updated (or adopted).Convergence note: structure (headings, tables, fences, citations) converges across runs; narrative wording may not — LLM prose is not byte-deterministic. Do not chase byte-stability by copying old generated prose; regenerate from code.
Per generated file:
test -f <target>/docs/agents/<file>
[ "$(wc -c < <target>/docs/agents/<file>)" -ge 120 ]
head -1 <target>/docs/agents/<file> # must equal canonical first line
grep -Fq '<!-- Generated by /ai-context.' <target>/docs/agents/<file>
grep -Fq '## AS IS — Current state' <target>/docs/agents/<file>
grep -q '^## Related documents' <target>/docs/agents/<file>
[ "$(grep -Ec '^- \[.*\]\(.*\.md\)' <target>/docs/agents/<file>)" -ge 2 ]
File-specific:
grep -q '^- \*\*Language\*\*:' <target>/docs/agents/tech_stack.md
grep -q '^- \*\*Framework\*\*:' <target>/docs/agents/tech_stack.md
[ "$(grep -c '^### [0-9]' <target>/docs/agents/coding_guidelines.md)" -ge 3 ]
# api_contracts.md — only when API surface exists:
[ "$(grep -c '^```json' <target>/docs/agents/api_contracts.md)" -ge 1 ]
# architecture.md — only when async signals present:
[ "$(grep -c '^```' <target>/docs/agents/architecture.md)" -ge 2 ]
Skip checks for skipped (not owned) / disabled artifacts.
created / updated / unchanged / adopted / skipped (N/A) / skipped (not owned) / disabled).skipped (N/A): the one-paragraph evidence-of-absence written into the file.npx claudepluginhub beerandcodeteam/beer-and-code-harnessWriter agent for the /ai-context pipeline that generates or refreshes AGENTS.md and CLAUDE.md from an inspector digest. Idempotent — diffs against on-disk bytes, writes only when content changed, respects ownership contract.
Creates, updates, and audits CLAUDE.md and agent-context documentation for agent workspaces. Uses role-based templates and section-marking conventions. Five operation modes control scope and destructiveness.
Autonomous documentation agent that writes and updates project docs grounded in the actual codebase, verifying every claim against live source files.