Skip to content

docs: lean rewrite of contributor docs - #2157

Merged
rdimitrov merged 30 commits into
mainfrom
claude/docs-rewrite-proposals-e1b1bb
Oct 8, 2026
Merged

rdimitrov merged 30 commits into
mainfrom
claude/docs-rewrite-proposals-e1b1bb

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

The contributor docs under docs/ are rewritten to be short enough to keep accurate, and drafts are clearly marked as not current behavior. Every kept claim was checked against current code; claims that could not be verified are left out and listed below.

Part A: drafts and principles

  • docs/drafts/ stays as main has it: proposals and work records, not current behavior. No header lifecycle or extra check is added.
  • docs/design/surface-migration-plan.md moves into docs/drafts/ (with a row in its index), and docs/design/principles.md is folded into the overview in Part B, so docs/design/ is gone.
  • Root AGENTS.md gets one line: docs/drafts/ holds proposals and work records, not current behavior. docs/README.md "What goes where" gets a docs/drafts/ row.

Part B: page sizes

Page Before After
docs/architecture.md (+ folded design/principles.md) 2,200 + 85 250
architecture/domain-model.md 235 150
architecture/ports.md 223 130
architecture/agent-loop.md 451 178
architecture/context-and-compaction.md 200 109
architecture/subagents-and-teams.md (+ merged parallelism.md) 248 + 156 170
architecture/governance.md (replaces hooks-and-guardrails.md) 151 180
architecture/providers.md 859 199
architecture/observability.md 573 199
architecture/api-surface.md 171 220
architecture/deployment-and-hardening.md 358 200
architecture/extensibility.md 310 173
architecture/memory.md 149 149
architecture/microvm-environments.md 292 149 (+ ~95 for the source-qualification procedure that main moved here from user-docs)
docs/tui.md 142 130
docs/perf-tracking.md 665 220
docs/perf-measurement-survey.md 285 83
docs/READING.md, docs/README.md 73, 40 63, 38
Total 7,866 2,990

Some chapters stayed the same size or grew because they absorbed sections from the old 2,200-line architecture.md: the SDK, Studio, and scheduler went to api-surface; caller identity and the credential store to deployment-and-hardening; reflection to memory; placement to microvm-environments; stream retry to observability.

Page set changes: parallelism.md is merged into subagents-and-teams.md. hooks-and-guardrails.md becomes governance.md, which also takes permissions, posture, trust, and environment scrubbing out of deployment-and-hardening. Every page drops ADR, phase, and issue history; flags, settings keys, routes, and field lists now link to the public user-docs/ pages.

Inbound anchors kept or repointed: observability.md#remote-store--source-drivers-adaptersgrpcdriver (heading kept), architecture.md#mecatl-studio → api-surface.md#mecatl-studio (apps/README.md), architecture.md#evidence-backed-reflection → memory.md#evidence-backed-reflection (user-docs/.../embed-engine.md). The two strings asserted by redis_dependency_floor_test.go are kept.

Per commit: removed, corrected, unverified

overview: architecture.md + design/principles.md (2,200 + 85 → 250)

  • Removed: ADR and issue citations, "How to read this" (ADRs as a frozen archive), phase labels, Renovate/govulncheck history; the principles page's "Principle N" and ac-trace machinery; the per-package allowed-imports table (depguard, layering_test.go, and engine/AGENTS.md own it); the engine adapter and dependency lists; build-identity mechanics; mecatui transport/TLS and mecak8s TLS/Redis detail (in user-docs). Subsystem sections moved to their chapters.
  • Corrected: engine/learning is a core domain package (engine/arch/surface.go); governance is stdlib-only and tool imports only session (engine/arch/layering_test.go:86-107); internal/cliconfig also imports internal/app; the code map adds mecatl-execution-provider and mecatl-executor; the pairing principle now names the seams that call ValidateToolPairing (session.go:651-660, compaction.go:149, cascade.go:265) rather than "every run entry"; runners use envscrub.ScrubWithInherited (internal/app/command_runner.go:58).
  • Unverified, left out: that Reopen/Interrupt/Recover each guarantee pairing; which internal packages cmd/mecatui/client may import.
  • Stale code comments seen (not edited): environment/microvm/microvm.go calls the runtime "future"; Taskfile.yml:564 lists an outdated engine dependency closure.

domain-model (235 → 150) + ports (223 → 130)

  • Removed: issue numbers, ADR references, cloud-native phase labels; the verbatim LLMRequest/Chunk Go blocks, the per-port signature column, the 20-row EventType table, Limits/Counters/ToolResult field lists; microVM, placement-reattach, background-shell, and plan-approval detail (owned by other chapters); Redis read-ledger flags (user-docs); speculative remote-backend and sandbox notes.
  • Corrected: the state machine was missing authorizing (engine/session/session.go:55-56, authorization.go:90-180) and the fourth recovery seam Abandon (session.go:1119); recovery is applied by repairTerminalState, not loadAndReopen (internal/adapter/server/service.go:4706); Cancel/Fail/Stop/Complete reject authorizing (session.go:766,785,798,935); usage readers keep unknown kinds (usage.go:108-115); Message.ReasoningItemID is a fourth opaque replay field (conversation.go:66-76); AuthorityEvaluator, SessionLiveness, DeliveryQueue, and ScheduleStore were missing from the port table; a run budget counts main plus router usage (engine/agent/loop.go:2615); Retire defers cleanup rather than waiting (internal/app/harness_context.go:1162-1203).
  • Unverified, left out: "a member/branch/child permission.ask is never projected"; how harness-context bindings are rebuilt after restart.
  • Stale code comments seen: engine/port/doc.go:3-4 says fakes live in internal/adapter (they are in engine/adapter); the memfs package doc still describes ledger semantics that moved to ReadLedger.

agent-loop (451 → 178) + context-and-compaction (200 → 109)

  • Removed: ADR/issue/wave/phase references; the window precedence table and 128K fallback (linked to user-docs/features/context-windows.md); HTTP routes and wire fields for resolve-ask, plan approval, and steer; NewEngine default list, askRegistry diagrams, steer watermark and handoff internals; PendingAsk JSON tags; the authority-evaluator table (to governance/subagents); discovery ownership (to providers); deferred notes (cross-tree budgets, steer to children and ACP).
  • Corrected: run token budget counts main plus router usage (engine/agent/loop.go:2615); the user model reaches the prompt through Deps.OperatorProfileSource, not the turn-0 assembler (internal/app/build.go:4578, :4603); tools implementing tool.AuthorizationRequester also leave read batches (engine/agent/dispatch.go:53); the 0.6 target applies to any budget-accepting compactor, and the heuristic compactor ignores it (manual_compaction.go:37); tier-4 summaries use the compaction-slot model on the session's provider (build.go:4903).
  • Unverified, left out: mecatui behavior on context_window_unavailable; instruction-snapshot cache bounds; the steer promote-grace duration. Kept one inference: an oversized request the provider rejects fails like any provider error (no dedicated handling exists).

subagents-and-teams + parallelism (248 + 156 → 170; parallelism.md deleted)

  • Removed: ADR/issue/phase references and a deprecated option alias; per-call arguments, --enable-parallel, --max-team-tokens, cancel routes, mecatui keys (in user-docs); Execute step lists, factory names, gitenv key list, dirty-overlay git commands; ListWorktrees selector internals (session placement, not delegation).
  • Corrected: a merging Parallel call reports MutatesParent and runs alone (engine/agent/parallel.go:415, dispatch.go:59); first/judge report an opaque artifact handle, not a workspace path (parallel.go:1475-1479, :760-763); only Subagent and Parallel use drainChildObserved, and teams stream (subagent.go:3677, parallel.go:1138, teamsupervisor.go:21-27); direct-write uses directWriteCommandRunner (internal/app/build.go:7798, command_runner.go:65); a failed dirty overlay sends a degraded-fork advisory (internal/adapter/forker/forker.go:200-206).
  • Unverified, left out: the four-step child permission decision and an "A2 isolation auto-approve" step (deferred to governance); shutdown/reaper drain details; team-end member dispositions and the RunTeam outcome payload.

governance (new; replaces hooks-and-guardrails 151, absorbs ~175 lines of deployment-and-hardening → 180)

  • Removed: phase labels, "MUST-FIX", ADR/issue refs, alias notes; the hookexec stdin/exit-code protocol, guardrail slot forms, /guardrails view and notice settings (user-docs); HookOutcome.Mutated shapes, trust-registry write mechanics, soul double-gate, the built-in floor's tool list; guardrail usage attribution and detail RPC (observability).
  • Corrected: a PreToolUse-rewritten call is re-authorized (engine/agent/dispatch.go:1054-1066, :296-300); plan mode also denies Copy, Move, Remove (engine/governance/evaluator.go:21-27); learned allows are ScopeUser, with ScopeBuiltinDefault below (evaluator.go:157-166, permission.go:66-74); shell parsing is in shell.go, not bash.go; posture raises trust only on interactive roots, while --trust-project trusts directly (internal/app/posture.go:217-241, trust.go:108-109); the project authority set includes model bindings, rules, and AGENTS.md/CLAUDE.md (project_ingestion.go:10-19); trust never carries to alternate roots (project_ingestion.go:22-27); contextual review runs in engine/agent/actionreview.go and inboundreview.go, not modelhook; guardrails also do permission review and fail closed by default (contextual_reviewer.go:85, permconfig/schema.go:1948-1952). Newly stated: auto loosens the main engine's substitution floor, and auto/yolo are refused as root without a declared sandbox (posture.go:147-150).
  • Unverified, left out: guardrail detail RPC ownership and liveness; held results disappearing on disconnect or restart; main and worker calls sharing rules; late results dropped after ownership loss.
  • Stale code comments seen: the preHook doc comment in engine/agent/dispatch.go:1419-1424 says rewritten args are not re-authorized; evaluator.go:160 calls ScopeUser the lowest scope.

providers (859 → 199)

  • Removed: ADR/issue refs and phase framing; flags and settings keys (--openai-base-url, --toolhive-llm-mode, --model-slot, providers.<name>, OpenRouter order:), the OIDC record format and mecatui providers lifecycle, the Responses request/SSE mapping, discovery lock ordering, proto field numbers, the ToolHive direct-mode TLS detail.
  • Corrected: openrouter-anthropic identity was missing (internal/app/registry.go:54); reflection and title slots were missing, synthesis has no consumer (internal/app/slots.go:62-90); tier fallback applies only when the tier is itself bound (slots.go:223-231); a bearer-token file also enables openai (registry.go:488-509); default-provider order now stated (registry.go:1365-1394); context window can resolve to unknown and be rejected (provider_discovery.go:402-419).
  • Unverified, left out: ToolHive probe budget (≤1.5 s) and Codex 5 s bootstrap figures; "router > --subagent-model default" precedence; ServerCapabilities.model_selection semantics.
  • For reviewers: binding only the cheap tier appears to turn guardrails on, because guardrailsConfigured uses the tier-fallback selector (internal/app/guardrails.go:500-504). The page states the behavior; confirm it is intended.

observability (573 → 199)

  • Removed: phase and issue history; all flags (--llm-*, --otlp-*, --metrics-addr, --perf-*); retention settings and cleanup-token flow (linked to session-storage-operations.md); the per-metric catalog; JSONL paging, cursor, and flock internals; the 15-row conformance table (reduced to suite names); benchmark mechanics (linked to perf-tracking.md); speculative "future bump" notes.
  • Corrected: latency instruments share one explicit-bucket ladder, LatencyViews (internal/adapter/telemetry/metrics.go:85-127), and there is no ToolDurationView; OTLP can also push metrics (otlp.go:133-137,209-235); memstore.Store does not implement SessionLease, memstore.Lease and memlease do (engine/adapter/memstore/lease.go:12-21); approving a persisted awaiting session resumes via Engine.ResumeApproval rather than returning ErrNoActiveRun (internal/adapter/server/service.go:6873-6885); the lease is held for the session's life, and the fencing token is not checked (service.go:7981-7986, engine/port/lease.go:44-48).
  • Unverified, left out: the "exactly three diagnostics lines" invariant; InspectSession request-manifest and network-attempt detail; ownerless-row filtering.
  • Stale code comments seen: Service doc comment (service.go:914-922) still describes the old approve-after-restart behavior; internal/app/build.go:511 cites observability.md for user-model-store locality, which the page no longer covers. Fixed one: otlp.go cited "architecture.md §2".

api-surface (171 → 220; absorbs ~470 lines of SDK, Studio, scheduler, and successor material from architecture.md)

  • Removed: ADR/issue/phase references; the HTTP route table, RPC family lists, schedule REST routes, per-RPC error codes (linked to the gRPC and HTTP/SSE references); schedule flags; Studio env vars and cookie names; SDK usage (query(), resolvePlan, Deno launcher, callback limits); ModelInfo fields, SDK timestamp normalization, connection-monitor precedence, test inventories, release mechanics.
  • Corrected: ACP starts with the mecated acp subcommand, not --acp (internal/adapter/acp/doc.go:17); there are eight core packages, including engine/learning (engine/arch/surface.go:27-36); the Studio BFF pins an exact SDK version (apps/server/package.json); SDK callback tools are authorized under the default evaluator (sdk/typescript/e2e/tool.e2e.test.ts:304); Converse can end at a pending authorization.required park (harness.proto:101-106); Run.Cancel leaves a durably parked authorization untouched (engine/agent/loop.go:1217-1219); schedule claims are at-most-once (engine/port/schedule.go:532), not exactly-once.
  • Unverified, left out: the bounded fire-drive pool; the headless ask model for fires; fire-retention defaults; Studio popup sign-in rules; whether protovalidate runs at runtime.
  • Code inconsistencies seen: the ErrFireNowOverlap comment in internal/adapter/scheduler/scheduler.go says 409, but errorcodes.go:183 maps it to 412; Taskfile.yml:117 (api:check description) still says "seven" core packages.

deployment-and-hardening (358 → 200; absorbs ~400 lines from architecture.md, sheds ~175 to governance)

  • Removed: ADR/issue/phase references and alias notes; flags (--rate-limit, --oidc-*, --drain-addr, TLS flags), daemon.yaml precedence, mecak8s shutdown budget and Redis pool flags, SSH-forward login recipe, mecatequi exit codes, Helm transport postures (all in user-docs deployment pages); Redis credential-reload and migration internals, keyring migration, logout/revocation mechanics; live e2e suite, PSS manifests, Renovate workspace list.
  • Corrected: static bearer and OIDC are mutually exclusive at startup (internal/cliconfig/oidc.go:260-265); AppendRunEvent no longer exists, so Service.appendEvent is the only stamping site (internal/adapter/server/service.go:7568); the system principal registry also has model-catalog-refresh and stale-session-reconcile (internal/syscaller/syscaller.go:35-53); the credential-key setting is credential_store.oidc.key, not llm.credential_key (internal/adapter/permconfig/providers.go:56-80; the page no longer names it); mecak8s accepts a mounted workspace and remote execution, so it is "no durable state by default", not storage-free (cmd/mecak8s/flags.go:361-362); a plain-file credential backend exists (internal/adapter/clientauth/credential_backend.go:203-216).
  • Unverified, left out: a saved mecatui credential forcing verified TLS on loopback; the fixed 18473 callback port; RFC 9207 iss rules; mecatequi's untracked-file diff hunk.

extensibility (310 → 173; absorbs MCP broker, slash commands, web retrieval from architecture.md)

  • Removed: ADR/issue/phase references; the seam summary table and non-goals list (each seam has a chapter); managed Shell temp storage and portable memory (other chapters); OAuth login mechanics, reconnect error codes, skill flags and paths (in user-docs mcp-oauth-and-credentials.md, mcp-client.md, skills-commands-and-soul.md); SkillDraft similarity internals, OAuthController lifetime walkthrough, engine dependency list; the debug-session MCP borrow.
  • Corrected: core skills code is engine/adapter/skillfs, and internal/adapter/skills re-exports it (alias.go:1); validateSkillDraftConfig is in internal/app/skilldraft.go; direct MCP supports DCR (internal/adapter/mcp/oauth_dcr.go); the project skill tier is withheld for untrusted workspaces (skillfs/resolve.go:98-104, build.go:4977-4981); learned skills publish live through AtomicCatalog (skillfs/atomic.go:35); with a learned-skill store, drafting uses NewLifecycleDrafter (internal/app/catalog.go:663-671); ProgressiveTools is off in every shipped host (engine/agent/loop.go:376-382); broker admission is all-or-nothing while direct registration is first-wins (mcpbroker/workspace_catalogue.go:465-480, mcp/mcp.go:1757-1777). Reviewer pass: nested instructions are activated only by structured file tools and arrive on the next request (engine/prompt/builder.go:199).
  • Unverified, left out: broker confidential-client hashing in ToolHive; enrollment status payload contents; owner-deletion cleanup of broker grants; any byte-exact enforcement for secret headers beyond pass-through (internal/adapter/server/grpc.go:165).

memory (149 → 149, also absorbs ~228 lines of reflection from architecture.md)

  • Removed: ADR refs; "no longer wires"/"legacy" notes; deprecated mecated skills promote; learning modes, thresholds, budgets, consolidation schedules, flag names (now linked to user-docs features/learning.md and features/dreaming.md); numeric ceilings, manifest layout, parser rejection list; duplicated CAS and consolidation text.
  • Corrected: the user model is not process-global under ownership enforcement; both stores are wrapped in memory.NewCallerStore (internal/app/build.go:4775, :5798), and remote memory and learning drivers are refused in that mode (build.go:5770-5772, learningdriver.go:20). Project memory is on by default in mecatui (cmd/mecatui/main.go:1592-1620) and opt-in in mecated. The tool names are InspectMemory/ForgetMemory/UndoMemory (internal/adapter/memory/tools.go:12-15). The operator-profile exclusions are guardrail-reviewer, ask-reviewer, model-router, usermodel-review, and parallel-judge (build.go:6912-6918).
  • Unverified, left out: "no recall-usage telemetry"; the selector's full priority order; hashing of partition components on the remote learning driver; manual-dream rejection of hidden characters.

microvm-environments (292 → 149; absorbs placement from architecture.md and deployment-and-hardening.md)

  • Removed: the platform-status callout, the "required live journey" test record (dated manual run, e2e evidence, AC references), the deferred list, ADR references; settings keys and egress grammar, status JSON fields, doctor checks, TUI stage messaging (in user-docs); Darwin helper mechanics, go-microvm version pins, xattr/Git object modes, source-capture phase breakdown, function-name pointers.
  • Corrected: Darwin arm64 on macOS 15+ is admitted, not compile-only (internal/adapter/microvmmanager/default_operations.go:81,129); a compatibly configured stopped daemon is restarted under the manager lock (manager.go:304-307); there is one user-local microvmd managing per-(owner, Git common dir) VMs, not a per-repository daemon (bootstrap.go:86-103, environment/microvm/repository_lifecycle.go:99-101); schedule delete cleans up placement only before the first claimed fire (internal/adapter/server/schedule_manager.go:953-963); mecak8s can install a remote execution placement provider (cmd/mecak8s/main.go:91-110). Newly stated: the microVM provider rejects worktree selectors (internal/adapter/microvm/client.go:220-222); the Redis filesystem provider exists (internal/app/redis_workspace.go:23).
  • Unverified, left out: all four delegation paths retaining the harness-source borrow; merge-back cache behavior; which harness sources attach no guest placement; status as the sole inventory authority across daemon restarts.
  • Code inconsistency seen: the readiness error text in internal/adapter/server/placement.go:52 still says "requires Linux amd64 with KVM" though Darwin arm64 is admitted.

tui (142 → 130), perf-tracking (665 → 220), perf-measurement-survey (285 → 83)

  • Removed: Context/Decision/Consequences scaffolding, "Phase N — Status" sections, dated fix narratives, roadmap and OSS-boundary table, open and resolved decisions; continuous profiling, bare-metal ns/op, and Bencher as future work; the survey's §1–§12 Go tool tutorials and its priority ranking; "keep rationale in ADRs" in tui.md; the 30-line debug-session description.
  • Corrected: BenchmarkReadOnlyBash is now BenchmarkReadOnlyShell (engine/governance/bench_test.go:26); BenchmarkSteadyState*Turn (engine/agent/bench_test.go:158-186) and BenchmarkContextualReviewPrivateCapacity exist and are gated; the main trend is per-commit medians from perf/cmd/benchtrend (perf.yml:384-435); RSS and wall-clock are only in the JSON artifact (perfconvert); the OTel runtime collector is started (otlp.go:159) and metrics are exported; histograms are explicit-bucket; PGO reads cmd/mecated/default.pgo, beside the main package; RSS comes from procfs; tui's ui/theme import rule is a convention, not lint-enforced; terminaltext is cmd/mecatui/internal/terminaltext.
  • Comment-only code edits: Go comments, Taskfile descriptions, perf.yml, .gitattributes, and the perf-optimization skill cited "perf-tracking.md Phase N", "Open decisions", or the deleted docs/adr/0019-perf-tracking.md; they now name current sections.
  • Unverified, left out: the dashboard hostname and repo visibility; PGO sample-weighting and win percentages; render-alloc swing percentages; whether the 102% gate fires on a goroutine delta from 0.
  • For reviewers: the baseline snapshot is kept as dated (2026-06-14, Linux). A count=1 task bench today (darwin/arm64) shows much lower allocs/op for several rows (BuildRequest 77 → 32, HeuristicCompact 199 → 55, CascadeCompact 249 → 106, EvaluatorEvaluate 13/18/29 → 8/12/23). A deliberate re-capture is worth doing separately.
  • Stale code comments seen: cmd/mecatui/embed/embed.go:13-14 (client imports); perf.yml:94-95 ("raw URL"); internal/adapter/telemetry/metrics.go:110-112 ("no OTLP metrics reader").

Final commit: READING.md, README.md, AGENTS.md pointers

  • READING.md and docs/README.md route to the new page set. Root AGENTS.md points at docs/READING.md.
  • engine/AGENTS.md: a ReadOnly() tool that can write the parent workspace must implement MutatesParent (explained in agent-loop.md).
  • internal/AGENTS.md: a binding's governance root is not its execution root (explained in microvm-environments.md).
  • .claude/skills/panel-review now points at the overview's principles section instead of the deleted design/principles.md.

For reviewers: needs a decision or a follow-up

  • Guardrails via the cheap tier: binding only the cheap tier appears to turn guardrails on (internal/app/guardrails.go:500-504). providers.md states the current behavior; confirm it is intended.
  • Baseline snapshot is stale: it is kept as dated (2026-06-14). Today's allocs/op are much lower on several rows (see perf notes). Worth a deliberate re-capture.
  • Code inconsistencies found while verifying (not fixed here):
    • ErrFireNowOverlap: the comment says 409, but errorcodes.go maps it to 412.
    • The microVM readiness error says "Linux amd64 with KVM" though Darwin arm64 is admitted.
    • Taskfile.yml api:check says "seven" core packages; there are eight.
  • Stale code comments (not edited, code is out of scope):
    • dispatch.go preHook doc: rewritten args are in fact re-authorized.
    • evaluator.go:160 calls ScopeUser "LOWEST".
    • service.go Service doc: approve-after-restart now resumes the run.
    • engine/port/doc.go: fakes live in engine/adapter, not internal/adapter.
    • metrics.go says there is no OTLP metrics reader; there is one.
    • embed.go client-import note.
    • environment/microvm/microvm.go calls the runtime "future".
  • Comment-only Go/YAML edits in this PR: perf/, cmd/mecatui/ui bench files, engine/prompt/bench_test.go, Taskfile.yml, perf.yml, .gitattributes, and internal/adapter/telemetry/otlp.go cited removed doc sections ("Phase N", ADR 0019, "§2") and now name current ones.

Verification

  • task docs: generated references are unchanged; instruction-files: ok; matlatl strict check reports 166 documents, 0 broken links or anchors, 0 orphans, 0 unreachable.
  • python3 .github/scripts/instruction-files_test.py: all checks passed.
  • go test ./internal/adapter/ -run TestRedisFollowCapacity_Scenario4: ok.
  • task site:build: success (one user-docs link changed).
  • task lint: 0 issues across the root, engine, authn/oidc, and provider modules.
  • Not run: task test:race. The Go changes in this PR are comment-only.

🤖 Generated with Claude Code

rdimitrov and others added 25 commits October 7, 2026 23:18
Move docs/drafts/ and docs/design/surface-migration-plan.md to
docs/proposals/. Every proposal now starts with a Status, Owner, and
Last updated header; instruction-files.py enforces it and fails on
Status: implemented, because the implementing PR should fold the
proposal into docs/ or user-docs/ and delete it.

Root AGENTS.md and docs/README.md state the rule; inbound links follow
the move.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
architecture.md goes from 2,200 lines to 250: what Mecatl is, layers
and how the dependency direction is enforced, how one prompt flows end
to end, a code map, and the platform principles. Subsystem material it
used to hold moves to the owning chapters (credential store, caller
identity, SDK, Studio, scheduled tasks, reflection, placement, stream
retry). docs/design/principles.md is folded in and deleted, along with
its ADR citations and acceptance-plan machinery; panel-review now
points at the overview's principles section.

Corrected against code: engine/learning is a core domain package;
governance is stdlib-only and tool imports only session; internal/app
is also imported by internal/cliconfig; the code map adds the execution
provider binaries; the pairing principle names the seams that check it
(history replacement and compaction); command runners use
ScrubWithInherited.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
domain-model.md (235 → 150 lines) covers the Session aggregate, messages
and replay fields, the state machine, tool call/result pairing and the
seams that keep it, typed tool results (moved from architecture.md),
events, titles and token accounting, and the harness context runtime.
ports.md (223 → 130) covers why ports stay narrow, the main ports and
their non-obvious contracts, the tool contract, the Environment and
Workspace seam, and why tests use reference adapters plus conformance
suites.

Corrected against code: the authorizing state and the Abandon recovery
seam; repairTerminalState (not loadAndReopen) applies recovery;
terminal transitions reject authorizing; readers keep unknown usage
kinds; ReasoningItemID is a fourth replay field; AuthorityEvaluator,
SessionLiveness, and DeliveryQueue are ports; the run budget counts
main and router usage; retiring a harness context defers cleanup
rather than waiting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
agent-loop.md (451 → 178 lines) covers the engine and run handle, the
drive algorithm, read-parallel/mutate-serial dispatch and the barrier
for direct-write children, permission pause and resume across restarts,
the plan-approval gate, steering, and system-prompt assembly (moved from
architecture.md). context-and-compaction.md (200 → 109) covers the
window, token counting, when compaction runs, both compactors, why tool
history must stay paired, manual compaction, and failure modes.

Corrected against code: the run token budget counts main plus router
usage; composition wires the user model through OperatorProfileSource,
not the turn-0 assembler; tools that can request external authorization
also leave read batches; the 0.6 target applies to any budget-accepting
compactor; the tier-4 summary uses the compaction-slot model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
subagents-and-teams.md now covers all three delegation tools in 170
lines (from 248 + 156): what every child shares (bounded session, no
nesting, narrowed authority, context isolation, permissions), Subagent
modes by intent, direct-write children and the dispatch barrier,
Parallel fork-join, teams, and where child workspaces come from
(including delegation never accepting placement input). parallelism.md
is deleted.

Corrected against code: a merging Parallel call reports MutatesParent
and runs alone; first/judge report an opaque artifact handle, not a
path; only Subagent and Parallel share drainChildObserved (teams
stream); direct-write uses directWriteCommandRunner; a failed dirty
overlay sends the child a degraded-fork advisory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
governance.md (180 lines) gathers what decides whether a call runs:
permission resolution and why configured Ask is never bypassed, shell
checks, the posture ladder, workspace trust, the command-runner
environment, untrusted-content fences and child isolation, lifecycle
hooks, and model-backed guardrails. It replaces hooks-and-guardrails.md
and absorbs the governance half of deployment-and-hardening.md and the
untrusted-content section of architecture.md.

Corrected against code: a PreToolUse-rewritten call is re-authorized;
plan mode also denies Copy, Move, and Remove; learned allows are user
scope with the built-in floor below; shell parsing lives in shell.go;
posture raises trust only on interactive roots while --trust-project
trusts directly; the project authority set includes model bindings,
rules, and instruction files; trust never carries to alternate roots;
contextual review runs in engine/agent, not modelhook; guardrails also
do permission review and fail closed by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cut providers.md from 859 to 199 lines: adapter invariants, wire
adapters vs registry identities, per-session routing, model inventory,
aliases and slots, and the semantic model router. Flags, settings keys,
and per-function detail now point to the public configuration pages.

Corrected against code: the missing openrouter-anthropic identity, the
reflection and title slots, tier fallback only when the tier is bound,
bearer-token availability for openai, default-provider order, and the
unknown-context-window rejection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
observability.md goes from 573 to 199 lines: the three separate
contracts (diagnostics, audit, events), the durable event log and its
consumers, telemetry composition, persistence, the session lease, remote
store and source drivers, and provider resilience including semantic
stream retry (moved from architecture.md). Flags, metric catalogs, and
JSONL internals give way to links to the public pages.

Corrected against code: latency instruments share one explicit-bucket
ladder (LatencyViews); OTLP can also push metrics; memstore.Store does
not implement SessionLease (memstore.Lease and memlease do); an approval
on a persisted awaiting session resumes the run instead of returning
ErrNoActiveRun; the lease is held for the session's life, not per run.
Repoints an otlp.go comment that cited a removed section number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
api-surface.md (171 → 220 lines) covers how gRPC, HTTP/SSE, and ACP
share one Service, contract generation and negotiated compatibility,
the live stream and durable watch semantics, session commands and
successors, scheduled tasks, the TypeScript SDK, Mecatl Studio, and the
engine-as-library contract. The SDK, Studio, scheduler, and successor
sections move here from architecture.md; RPC lists and routes now link
to the reference pages. apps/README.md follows the Studio anchor.

Corrected against code: ACP starts with `mecated acp`, not a flag;
there are eight core packages; Studio pins an exact SDK version; SDK
callback tools are authorized; Converse can end at an authorization
park; Run.Cancel leaves a parked authorization untouched; schedule
claims are at-most-once, not exactly-once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
deployment-and-hardening.md (358 → 200 lines) now covers only the
server process: edge authentication, caller identity and ownership,
the event-log actor, protected-resource discovery, the internal
credential store, remote mecatui login, rate limiting and shutdown,
multi-replica operation, and the mecated/mecak8s/mecatequi shapes. It
absorbs those sections from architecture.md; permissions, posture, and
trust moved to governance.md and placement to microvm-environments.md.

Corrected against code: static bearer and OIDC are mutually exclusive
at startup; appendEvent is the only actor-stamping site (there is no
AppendRunEvent); system principal roots include model-catalog-refresh
and stale-session-reconcile; mecak8s accepts a mounted workspace and is
not strictly storage-free; a plain-file credential backend exists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
extensibility.md (310 → 173 lines) covers MCP (why streaming HTTP
only, server sources, admission and naming, revisioned reconciliation,
the session-scoped broker, secret-shaped headers), skills and slash
commands, nested project instructions, progressive disclosure, built-in
web retrieval, and library extension points. Broker, slash-command, and
web-retrieval material moves here from architecture.md; the seam table
and non-goals list are dropped because each seam has its own chapter.

Corrected against code: skills live in engine/adapter/skillfs;
validateSkillDraftConfig is in internal/app; direct MCP supports DCR;
the project skill tier is withheld for untrusted workspaces; learned
skills publish live through AtomicCatalog; drafting goes through the
lifecycle drafter when a learned-skill store exists; progressive tool
disclosure is off in every shipped host; broker admission is
all-or-nothing while direct registration is first-wins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
memory.md now covers both stores' shared CAS contract, how memory
reaches the model, the safety boundary, caller scoping, consolidation,
and evidence-backed reflection (moved from architecture.md), in 149
lines. Settings and workflows point to the public learning and
dreaming pages.

Corrected against code: memory is partitioned per caller under
ownership enforcement (memory.NewCallerStore), mecatui enables project
memory by default, the model-visible tool names, and which internal
engines omit the operator profile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
microvm-environments.md (292 → 149 lines) now explains the placement
contract first (server-owned bindings, exact reattachment, the
governance root, alternate worktrees, schedules, delegation), then the
local microVM runtime: repository identity, logical worktrees and
routing, delegation and merge, image and credentials, networking, and
readiness and recovery. The placement sections move here from
architecture.md and deployment-and-hardening.md; the live-journey test
record and deferred list are dropped.

Corrected against code: Darwin arm64 is admitted (experimental), not
compile-only; a compatibly configured stopped daemon is restarted; there
is one user-local microvmd managing per-repository VMs; deleting a
schedule keeps its placement after the first claimed fire; mecak8s can
install a remote execution provider; the microVM provider rejects
worktree selectors; the Redis filesystem provider is listed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
tui.md (142 → 130 lines) keeps the client boundary, layout and
navigation, conversation feedback, styling, and verification rules, and
absorbs the current, non-obvious parts of architecture.md's mecatui
section. The provider-resilience link now points at the observability
page instead of a heading anchor.

Corrected against code: the ui/theme import rule is a convention, not a
lint rule (no depguard entry covers cmd/mecatui); terminaltext lives at
cmd/mecatui/internal/terminaltext.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf-tracking.md (665 → 220 lines) drops the ADR scaffolding, phase
status history, roadmap, and open decisions, and keeps what we track and
why, the benchmark harness, regression gating, baseline storage, the
dated baseline snapshot, PGO, and how to add a scenario.
perf-measurement-survey.md (285 → 83) becomes a question-to-technique
map filtered to what Mecatl actually runs, without the generic Go
tutorial.

Code comments, Taskfile descriptions, perf.yml, .gitattributes, and the
perf-optimization skill cited "Phase N" headings or the deleted ADR
0019; they now name the current sections. Comment-only changes.

Corrected against code: BenchmarkReadOnlyBash is BenchmarkReadOnlyShell;
the steady-state turn benchmarks exist and are gated; the main-branch
trend is per-commit medians from benchtrend; RSS and wall-clock are
recorded in the JSON only; the OTel runtime collector and metrics
exist; histograms are explicit-bucket; PGO reads cmd/mecated/default.pgo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
READING.md and docs/README.md now route to the rewritten chapters:
foundations (overview, domain model, ports, agent loop), then one table
of topic chapters, with parallelism folded into subagents and
hooks-and-guardrails replaced by governance. Root AGENTS.md points at
READING.md for how the system fits together.

Two module pointers go where a chapter explains something the code
does not make obvious: engine/AGENTS.md on MutatesParent for read-only
tools that can write the parent tree, and internal/AGENTS.md on the
governance root versus the execution root. The embed-engine guide's
reflection link follows the section to memory.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
governance.md implied that any server is headless, so readers took
`mecated` to be one. Headless is a per-binary setting: mecatui is
always interactive, mecated is interactive unless started with
--headless, and mecak8s and mecatequi default to headless. Also state
that the trusted posture's only effect is raising project trust.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The last merge from main kept this branch's relative user-docs links in
docs/README.md, undoing main's switch of the audience routes and the
public-documentation link to mecatl.dev and GitHub URLs. Restore main's
version of those lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- perf-tracking: no default.pgo is committed; it is absent, not empty.
- deployment-and-hardening: a local store directory always gets a flock
  session lease (internal/app/build.go buildSessionLease), matching
  observability.md.
- domain-model: user_prompt reaches clients as a scheduled-delivery note;
  name ClaimAuthorization and the RestoreAuthorizationClaim edge; Abandon
  keeps a pending exact retry.
- providers: name Typesafe System One, list the reserved synthesis slot,
  and add the architecture-guide back-link.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- dispatch.go preHook: a hook-rewritten call is re-authorized on the
  effective args (authorizeBound / reauthorizeApprovedCall); the comment
  said it was not.
- evaluator.go: ScopeUser is the lowest configured scope;
  ScopeBuiltinDefault sits below it.
- Taskfile, perf.yml, perf/: drop "Phase N" labels from the removed
  perf roadmap.

Comment-only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- subagents-and-teams: the forker's own git worktree add runs under the
  gitenv scrub (internal/adapter/forker/forker.go).
- governance: guardrail checker usage is charged to the reviewed session
  and late usage after the run ends is dropped
  (engine/agent/loop.go recordGuardrailUsageWhileActive).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The guardrail slot falls back to the cheap tier (internal/app/slots.go),
and guardrailsConfigured follows that fallback. An operator binding cheap
for compaction also gets enforcing guardrails and their checker cost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Point agents at the one chapter they need, only when the code doesn't
answer the question, instead of a reading map to start from. Add the
docs/ counterpart of the existing user-docs update rule so the
rewritten chapters don't drift again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The proposals README says abandoned proposals are deleted, so the header
check no longer accepts the status. Adds a fixture case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Name go.work and environment/microvm/go.mod rather than restating the Go
and go-microvm versions, and drop the core-package count the table
already shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rdimitrov and others added 3 commits October 7, 2026 23:18
Rewrap prose and one Go comment that the earlier review fixes left
over-long, and say that only the listed internal-call slots fall back to
cheap (title has no default tier; plan falls back to reasoning).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The architecture overview and deployment chapter now point at the
version go.work declares instead of repeating it, so the source-build
floor test no longer asserts a literal Go version in those two pages.
The other surfaces it checks (AGENTS.md, Taskfile, user-docs, the SDK
Dockerfile) still pin it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main moved and deleted user-docs pages and moved content into these
docs while this branch rewrote them. This points the rewritten pages at
the new user-docs paths, keeps main's operator route and microVM
source-qualification pointers, folds in main's reasoning-summary and
Anthropic thinking-mode facts in providers.md, and repoints the
reflection link on the page that replaced embed-engine.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Go back to main's docs/drafts/ instead of a new docs/proposals/ home,
and drop the Status/Owner/Last updated headers and the instruction-files
check this branch added for them. The drafts index is main's, plus a
row for the surface-migration plan, which this branch moved out of the
deleted docs/design/. Root AGENTS.md keeps one line saying drafts are
not current behavior.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov rdimitrov changed the title docs: lean rewrite of contributor docs and a docs/proposals/ home docs: lean rewrite of contributor docs Oct 7, 2026
@rdimitrov
rdimitrov merged commit 6d66b05 into main Oct 8, 2026
41 of 42 checks passed
@rdimitrov
rdimitrov deleted the claude/docs-rewrite-proposals-e1b1bb branch October 8, 2026 09:37

This branch was successfully deployed

1 active deployment
Preview — ddf52677 Deployed Oct 7, 2026 by vercel[bot]
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