All ten `archie-*` skills carried claims that no longer matched the
checkout. Re-verified each against code, git history, and the shipped
configuration, then corrected the drift.
Structural changes the skills had not caught up with:
- Composition root moved: `cmd/archied/main.go` is a ~30-line dispatcher
into `internal/app/archied.Run()` with wiring in `bootstrap.go`. The
skills still described `cmd/archied` as the wiring site, which also
silently zeroed the diagnostics delivery snapshot.
- Config decoding moved out of `internal/config` into
`internal/infrastructure/configuration`. `config.Load` / `config.LoadDir`
no longer exist; the loader is `configuration.New` + `Loader.Resolve`.
- Task contract moved to `internal/domain/storecontract`, with
`internal/store/interface.go` holding aliases only. The task type is
`internal/domain/workflow/task.Task`.
- `internal/workflow` became `internal/domain/workflow`; `internal/storerpc`
became gRPC `internal/infrastructure/staterpc`; `internal/policy` does not
exist.
- `Store.Transition` now guards on `from` and writes status plus history in
one transaction. Three skills still described the old non-atomic behavior
as current and open.
- `internal/domain/{messaging,workflow,workintake}`, `internal/eventbus`,
`internal/app`, and `internal/infrastructure` now exist.
`internal/domain/{agent,identity}` and `internal/policy` remain target-only.
Tooling and environment facts:
- Go 1.27.0 (root and tools modules), golangci-lint 2.13.2, staticcheck
2026.2.1; snapshot dates and HEAD moved to 2026-09-18 / 2e1e1549.
- Re-ran the bundled diagnostics and re-baselined its snapshot table.
Confirmed 78.6% store coverage, a clean race run, and zero dupl findings.
- Corrected the claim that no `.dockerignore` exists; it does.
- Replaced skill script paths that pointed at the untracked `.claude/skills`
symlink with the canonical tracked `.agents/skills` location.
- Fixed the delivery-snapshot comment's wrong commit hash for the Gitea
workflow removal (dd9bddc2, not e539048).
Findings the verification closed:
- The VitePress site and `.github/workflows/docs.yml` were removed
(84b32694); the Gitea workflow was dropped (dd9bddc2).
- The changelog `vX.Y.Z`-vs-`X.Y.Z` contradiction is settled, not open: both
changelogs and the CI gate agree on `## [<version>]`.
- Tracked `docs/node_modules` and the skill-script test regression are
settled, not current.
- The six unmerged `origin/fix/*` and `origin/feat/*` candidate branches no
longer exist.
Also regenerates `docs/data/generated/contracts.json`, which the
verification found stale since 4b340d2b: docsgen emits 11 schemas now, and
`MediaAttachment.raw` plus an `AgentExecutionResult.required` field were
missing. `cmp` passes after regeneration.
Verified with `task check` (green).
10 KiB
name, description
| name | description |
|---|---|
| archie-codebase-discovery | Trace Archie behavior and blast radius through Go source, types, state, persistence, transports, consumers, tests, configuration, production composition, and target architecture. Load before changing or planning a non-trivial feature, refactor, config field, interface, persistence path, workflow, channel, plugin, or agent execution path; also load to investigate duplicate behavior, hidden dead code, constructor bypasses, package dependencies, decoded-but-unwired configuration, or uncertainty about what a symbol actually affects. |
Discover the Archie codebase
Use evidence from the current checkout to explain a behavior before changing it. Volatile tool facts below were verified on 2026-09-18.
Composition roots: cmd/archied/main.go (thin dispatcher) →
internal/app/archied.Run(), and internal/app/agentworker (invoked by
cmd/archie-agent/main.go). Do not treat cmd/* as the wiring site.
Production wiring: a path selected by a shipped entrypoint — not a
constructor, decoder, or passing unit test. State owner: component with
authority to validate and persist a state transition.
Establish a reproducible baseline
go version; go env GOMOD GOWORK GOOS GOARCH
gopls version; golangci-lint version; staticcheck -version
As of 2026-09-18: Go 1.27.0, gopls 0.23.0, golangci-lint 2.13.2,
staticcheck 2026.2.1. Use gopls call_hierarchy (no go tool callgraph;
go tool lists only asm, cgo, compile, cover, fix, link, preprofile, vet).
Writable caches when defaults are read-only:
export GOCACHE="${TMPDIR:-/tmp}/archie-discovery-gocache"
export GOLANGCI_LINT_CACHE="${TMPDIR:-/tmp}/archie-discovery-lint"
export GOTMPDIR="${TMPDIR:-/tmp}"
export GOPROXY=off GOFLAGS=-mod=readonly
Module boundaries (root and tools/ are separate):
find . -name go.mod -not -path './.git/*' -not -path './node_modules/*'
go list -m -f '{{.Path}} {{.GoVersion}}'
go -C tools list -mod=readonly -m -f '{{.Path}} {{.GoVersion}}'
Build the behavior trace
Write: behavior, observable input, expected output, state that may change, modes.
| Step | Find | Required evidence |
|---|---|---|
| 1 | Entrypoint | main, handler, poller, RPC subject, or tool registration |
| 2 | Construction | Constructor and every direct struct literal |
| 3 | Contract | Interface, wire type, command, event, or public method crossed |
| 4 | Implementation | All type-valid implementations, selected per mode |
| 5 | State owner | Function validating transition, owning concurrency/transaction rules |
| 6 | Persistence | Store adapter, schema/key/document, serialization, reload/recovery |
| 7 | Event/transport | Publish/send and subscribe/receive, subject/framing, timeout, retry, ack |
| 8 | Consumer | Callers and downstream readers |
| 9 | Tests | Unit, integration, contract, architecture, production-composition |
| 10 | Configuration | Decode, default, validation, normalization, composition-root consumption |
| 11 | Target architecture | Current-to-target mapping in docs/prds/; label gaps |
Start at these verified anchors:
| Concern | Current anchor |
|---|---|
| Resident daemon | cmd/archied/main.go → internal/app/archied.Run() (internal/app/archied/main.go) → daemon.Daemon |
| Sandboxed worker | cmd/archie-agent/main.go → internal/app/agentworker/; NATS boundary in internal/infrastructure/agenttransport/nats/ |
| Task orchestration | internal/daemon/daemon.go, internal/domain/workflow/ |
| Task contracts | internal/domain/storecontract/storecontract.go (TaskStore); internal/store/interface.go holds compatibility aliases only |
| Production task persistence | internal/store/; openProductionTaskStore reached via internal/app/archied/state_store.go |
| RPC split | internal/{taskrun,natsrpc,forgerpc,worktreerpc}/ plus internal/infrastructure/staterpc/ (gRPC State Store) |
| Chat and channels | internal/gateway/, internal/channels/ |
| Configuration | internal/config/, internal/infrastructure/configuration/, config.example.toml, deployments/*.toml |
| Target map | docs/prds/01-project-management.md and linked docs/architecture/*.md |
Use syntax, type, and call evidence
Map packages before reading files
go list -f '{{.ImportPath}}|go={{join .GoFiles ","}}|tests={{join .TestGoFiles ","}}' ./internal/store
go list -json ./internal/store
.agents/skills/archie-codebase-discovery/scripts/package-edges.sh ./internal/...
Resolve symbols with gopls
1-indexed file:line:column:
gopls symbols internal/domain/storecontract/storecontract.go
gopls definition cmd/archied/main.go:27:14
gopls references -d internal/domain/storecontract/storecontract.go:33:2
gopls implementation internal/domain/storecontract/storecontract.go:33:2
gopls call_hierarchy internal/domain/storecontract/storecontract.go:33:2
go doc ./internal/domain/storecontract.TaskStore
go test ./internal/store -list '.'
Generate AST candidates for construction
.agents/skills/archie-codebase-discovery/scripts/scan-go-type-syntax.sh Daemon .
.agents/skills/archie-codebase-discovery/scripts/scan-go-type-syntax.sh -tests Task .
Confirms candidates with gopls definition or gopls references. Pass
-tests to expose test-only construction.
Run focused discovery recipes
Find duplicate behavior paths
golangci-lint run --enable-only=dupl ./internal/...
rg -n 'Transition\(|PublishTask\(|ClaimNext\(|StatusWaitingHuman' cmd internal
Trace each candidate to entrypoint and state owner. dupl finds similar syntax,
not two different implementations of one responsibility.
Find unused-but-compiled code
staticcheck -checks=U1000 ./internal/...
For every suspect: gopls references -d; search init, reflection/Yaegi, tags,
RPC subjects, plugin manifests, string dispatch; check build tags/OS files;
search both composition roots. U1000 does not prove exported/reflection/wire
targets are dead.
Find interface implementations
gopls implementation
rg -n 'var _ .*=' --glob '*.go' cmd internal
Trace which implementation the composition root selects for each mode.
Find struct-field consumers
gopls references -d on field declaration, not common name. Trace assignments
and reads separately. Follow ForTask/ToConfig copies. Check JSON/TOML/YAML
tags. Compare production and _test.go references.
Detect constructor bypasses
Run scan-go-type-syntax.sh Type .. Inspect struct literals outside owning
package. Compare validation/defaulting in constructors with direct literals.
Use gopls references on constructor and type.
Prove package dependency direction
.agents/skills/archie-codebase-discovery/scripts/package-edges.sh ./internal/...
go list -deps -json <pattern>
Find decoded-but-unused configuration
Prove: file/key → decoder → default → validation → normalization/copy → composition-root read → concrete component → observable behavior.
rg -n 'toml:"|yaml:"|json:"' internal/config
rg -n 'Resolve|Overlay|Dir|finalize|ForTask|ToConfig' internal/infrastructure/configuration internal/app/archied
gopls references -d <exact-field>
Decoding lives in internal/infrastructure/configuration, not internal/config.
configuration.New(log) returns a Loader; the composition root in
internal/app/archied/bootstrap.go calls Loader.Resolve (with Loader.Overlay
and Loader.Dir for overlay/conf.d inputs). There is no config.Load or
config.LoadDir.
Prove production composition
- Start at
internal/app/archied/main.go(Run), entered fromcmd/archied/main.go. - Record config condition per branch.
- Follow concrete construction into
daemon.Daemonand gateway start. - For container/NATS behavior, trace
cmd/archie-agent/main.gointointernal/app/agentworkerandinternal/infrastructure/agenttransport/nats. - Trace both sides of every RPC/transport and error/timeout paths.
- Read contract/architecture tests.
- Confirm deploy inputs in Compose and CI.
Trace SQLite persistence
Treat internal/domain/storecontract as the application contract and
internal/store as the production SQLite adapter behind it.
gopls implementation internal/domain/storecontract/storecontract.go:33:2
rg -n 'CREATE TABLE|CREATE INDEX|QueryContext|ExecContext|BeginTx' internal/store
Reject false confidence
| Weak evidence | Why it fails | Required correction |
|---|---|---|
One rg result |
Misses interface dispatch, aliases, generated registration, reflection | Use gopls, AST candidates, package edges, composition |
| Green unit test | May bypass config, lifecycle, transport | Add composition/contract/integration evidence |
| Fake client and server agree | Both mirror same wrong framing/subject/state assumption | Compare independent spec or real boundary fixture |
| High coverage | Does not establish ownership, maintainability, mode selection | Trace authority and production selection |
| Constructor exists | Does not prove callers use it | Find struct literals and type-aware references |
| Config field decodes | Does not prove executable reads it | Complete config-to-observable chain |
| Target PRD says it | Not necessarily current code | Cite current implementation and label gap |
Produce the discovery handoff
- Behavior trace: path:line, symbol, current responsibility per traversal step.
- Mode matrix: mode/config branch → concrete implementation → state store → transport → consumer.
- State and authority: owner, copies, persistence, transition rules, recovery.
- Blast radius: callers, consumers, tests, config, deploy wiring, docs, compatibility paths.
- Duplication/deprecation ledger: each candidate, live/dead evidence, replacement, objective removal gate.
- Current-to-target gap: current fact, target PRD, migration implication.
- Unknowns: exact command, output/blocker, next evidence needed.
Do not propose implementation until the trace answers: what entrypoint selects this path, which component owns state, which parallel/older path the feature replaces, which production modes and persisted data must remain compatible, which evidence would falsify current understanding.