Skip to content

docs: ADR-reference cleanup, rule hygiene, module AGENTS.md files - #2148

Merged
rdimitrov merged 5 commits into
mainfrom
claude/adr-cleanup-rule-hygiene-ffa0b4
Oct 7, 2026
Merged

rdimitrov merged 5 commits into
mainfrom
claude/adr-cleanup-rule-hygiene-ffa0b4

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Stacked on #2144 (docs/close-out-pr4). Merge that first; this PR's diff is only the commits below.

1. Drop plain-text ADR references outside docs/architecture*

Rewrote every ADR NNNN mention in user-docs/, sdk/**/*.md, deploy/, and .claude/skills/** so each sentence stands on its own:

  • user-docs/reference/grpc-api.md, user-docs/building/api-stability.md, and the skills (cut-release, perf-optimization, perf-mcp-interpretation, mecatl-model-router-config): the number was only a pointer, so I dropped it.
  • deploy/README.md: replaced "the full operator contract … is ADR 0278" with what the operator owns: the chart creates no Gateway, Route, or Certificate (checked against deploy/helm/mecak8s/chart_test.go), and the operator forwards the bearer header and keeps /drain, /healthz, /readyz off public routes. Dropped "(ADR 0213)" from the raw-driver note.
  • sdk/typescript/examples/slack-bot/DESIGN.md: the "See also" ADR list now links to the current docs (live-run controls, caller identity). ADR 0253's mocking testkit was dropped (superseded by 0279), so that entry and its mention are gone.
  • panel-review skill: removed the generic "ADR indexes / ADR knowledge" wording.

Left alone:

  • apps/README.md: docs: fix docs that contradict the code (salvaged from #2107) #2144 already removed its ADR references.
  • sdk/typescript/CHANGELOG.md:28: it quotes the linked commit's subject verbatim. This is release history, like engine/CHANGELOG.md.
  • The 13 blob/<sha>/docs/adr/... permalinks, plus everything else out of scope: docs/architecture*, docs/design/, engine/ docs (engine/api/README.md still cites ADRs 0036/0037), proto/Go comments, generated output.

2. Rule hygiene

  • log-delivery.md, narrowed. It used to load for all of cmd/**, internal/app/**, internal/adapter/**, engine/adapter/**, and engine/port/**. Logger and sink composition actually lives in cmd/*/main.go, cmd/mecatui/diaglog*.go, cmd/mecatui/embed/**, internal/cliconfig/logging*.go, and internal/adapter/slogdiag/** (found by grepping for NewTextLogger, slog.SetDefault, slogdiag.New*, and the diag-log writer). internal/app only mentions slogdiag in a comment; engine/port and engine/adapter hold no sinks. I also dropped the "keep … distinct" clause, because root AGENTS.md already states it. The rule still spans cmd/ and internal/, so it stays a rule.
  • catalog-metadata.md, unchanged. It spans engine/tool/** and internal/app/learned_skills.go, it's 9 lines, and its invariant still holds.
  • test-isolation.md, unchanged. It applies to **/*_test.go repo-wide; buildIsolated/isolateConfig and UserModelDir still exist.
  • domain-model.md, unchanged. It applies to **/*.modelith.* and is 16 lines.

All four keep their paths: and matlatl: orphan-intentional frontmatter.

3. Module AGENTS.md files

  • engine/: added. It holds:
    • module commands: focused tests from engine/; task test:engine-standalone means imports must resolve from engine/go.mod alone; task api:update runs from the root because internal/apicheck lives there, and only arch.CorePackages is guarded.
    • layering is enforced twice: a new import must be allowed in both the root .golangci.yml depguard allowlist and coreImportRules in arch/layering_test.go; a new core package goes in arch.CorePackages; engine/adapter/* never imports agent.
    • invariants moved from root: tool owns FileSystem/Workspace/Environment, governance is session-free, Session aggregate plus tool-call pairing, provider-neutral port.LLMRequest with stateless replay.
  • internal/: added. It holds:
    • where to change things: settings.yaml keys are permconfig/schema.go section fields, and the reference generator reads doc comments from that file only; a new section needs a pinned Tier in configgen/build.go; Service.appendEvent is the only place that stamps session.Event.Actor.
    • invariants moved from root: server-owned placement and EnvironmentRef reattachment (app/placement.go), and the command_runner.environment.inherit grant scope (app/command_runner.go, app/build.go).
  • cmd/: skipped. Its only candidates fail the "would an agent get this wrong?" test: missing helpmeta.go flag metadata fails with an exact "add an entry" error in both mecated and mecatui, and the flag-to-docs map is already in user-docs/_README.md, which root AGENTS.md points to. The one unguarded fact (mecademo must stay off internal/app/internal/cliconfig because of the link-size cost) belongs in a depguard rule, not a one-line file.

Some suggested move-downs stay in root because the code spans modules:

  • governance fences and post-tool payload rewriting live in engine/governance and engine/agent;
  • the diagnostics/audit/event contract split covers ports in engine/port and implementations in internal/.

Root AGENTS.md links the module files. Each new file has a CLAUDE.md symlink and stays well under 200 lines.

4. cut-release: drop stale first-engine-tag guidance

Engine tags through engine/v0.15.0 exist, but the skill still called engine/v0.0.1 the upcoming first cut and said gorelease had no base tag to compare against. The bullet and steps 1–2 now describe the normal flow: engine tags are cut on their own schedule, you increment the latest tag per engine/COMPATIBILITY.md, and task api:release-check previews the version classification against the previous tag. The api:release-check description in Taskfile.yml has the same stale "none exists yet" wording; I left it alone because this PR is docs only.

Verification

  • task docs passes: instruction-files ok; matlatl 0 broken, 0 orphans, 0 dead-ends.
  • task site:build passes.
  • go test ./internal/adapter/ -run TestRedisFollowCapacity_Scenario4 passes.
  • Not run: task lint, task test:race, and the mecademo demo. This PR is Markdown only.

🤖 Generated with Claude Code

rdimitrov and others added 5 commits October 7, 2026 15:11
Correct statements verified against the current code, and carry over
the two sections from #2107 worth keeping:

- HTTP run controls: the public reference and two architecture pages
  documented /approve, /cancel, /steer, and /cancel-steer, removed in
  #1725. Document the registered controls/resolve-ask, controls/cancel,
  controls/steer, and controls/cancel-steer routes with their required
  expected_run_id, bodies, responses, and 409 stale_run_control; steer
  no longer promotes to a new run.
- Placement: server.Config.EnvironmentResolver no longer exists.
  Reattachment goes through the required PlacementProvider's
  PlacementReattacher capability and fails closed; a zero ref is
  rejected, not backfilled. Same fix on the public execution page.
- Caller identity: identity alone is attribution; refusal comes from
  caller ownership enforcement when an OIDC verifier is wired.
- Scheduler delivery queue: durable only with a local store directory;
  Redis-backed deployments use an in-memory queue.
- Redis read ledger: name the opt-in flag.
- apps/README.md: Studio boundary section (exact SDK pin, Biome import
  rules); task studio:check is the local gate, CI runs more.
- deployment-and-hardening.md: command-runner credential-grant section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ADR directory was removed, leaving "(ADR NNNN)" residue in user docs,
the SDK example design notes, the deploy README, and skills. Rewrite each
sentence to stand on its own, and state the facts a reader still needs
(the chart's operator-owned edge resources, links to current docs) where
the ADR used to carry them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rule loaded for every file under cmd/, internal/app, internal/adapter,
engine/adapter, and engine/port. Logger and sink composition actually live
in the command mains, mecatui's diagnostic log and embed packages,
internal/cliconfig/logging.go, and internal/adapter/slogdiag. Scope the
rule to those and drop the sentence that restated the root AGENTS.md
contract split.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
engine/AGENTS.md holds the module's own commands (focused tests, the
GOWORK=off standalone proof, running api:update from the root), the fact
that layering is enforced in both depguard and arch/layering_test.go, and
the engine invariants moved from the root.

internal/AGENTS.md maps where settings.yaml keys and event actor stamping
live, and takes the placement and runner credential-grant invariants.

cmd/ gets no file: its flag metadata gaps fail with an exact fix, and the
flag-to-docs map already lives in user-docs/_README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Engine tags through engine/v0.15.0 exist, but the skill still described
engine/v0.0.1 as the upcoming first cut and told agents gorelease had no
base tag to compare against. Describe the steady-state flow instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base automatically changed from docs/close-out-pr4 to main October 7, 2026 12:49
@rdimitrov
rdimitrov merged commit 443c8d3 into main Oct 7, 2026
36 of 37 checks passed
@rdimitrov
rdimitrov deleted the claude/adr-cleanup-rule-hygiene-ffa0b4 branch October 7, 2026 12:55
This was referenced Oct 7, 2026
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.

2 participants