PR #131 removed WriteNote's legacy brain/knowledge/ fallback branch that
activated when wing/hall were both empty, but never updated the CLI that
was the only caller relying on it. Since `hyperguild brain write` never
sent wing/hall, every invocation of the CLI's most load-bearing brain
command started hard-erroring "wing and hall are required" — a live,
README-documented command broken on every call.
Separately, writeRequest never had a `slug` field (pre-existing, unrelated
to #131): the CLI's slug value was silently dropped server-side even
before this PR, falling back to a timestamp filename.
Fix:
- `hyperguild brain write <wing> <hall> <slug>` replaces the old
`<type> <slug>` shape. Positional args, mirroring the existing
`brain query <topic>` pattern and matching writeHallNote's own
wing/hall/slug parameter order server-side (handler.go's
brain.NotePath(brainDir, wing, hall, slug)) — no new flags needed since
wing/hall/slug are all required, not optional filters.
- brainClient.Write now sends {wing, hall, filename, content}, matching
writeRequest exactly (writeRequest already gained a Filename field in
#131, so no server-side change was needed — only the CLI was sending
the wrong shape). This also fixes the dead slug bug: slug now arrives
server-side as filename instead of being silently dropped.
- Added TestWrite_CLIPayloadRoundTrips in ingestion/internal/api, which
POSTs the CLI's exact JSON envelope to the real Handler.Write (not a
mock) and asserts a real file with real wing/hall frontmatter lands on
disk. cmd/hyperguild and ingestion are separate Go modules (no
go.work), so this can't be a single cross-module test — instead the
wire contract is pinned from the server side, closing the gap where
cmd/hyperguild/http_test.go's TestBrainClient_Write_Success used only a
hand-rolled httptest mock and stayed green through the wing/hall
regression.
- Updated cmd/hyperguild/README.md and the 2026-05-03 CLI design spec's
stale `<type> <slug>` examples.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The brain HTTP REST /query endpoint accepts POST with JSON body
{query, limit}, not GET with URL query string. Surfaced empirically
during Plan 4 Task 7 smoke testing. Spec text now matches the
implementation.
Implementation-level spec for the hyperguild CLI: a stdlib Go binary
at cmd/hyperguild/ with subcommands tier, brain query/write, and mode
(cloud|client-local|sovereign). Replaces the supervisor's tier MCP and
provides shell-friendly access to the brain HTTP REST API.
Six measurable success criteria, seven out-of-scope items, six risks.
Decisions logged: stdlib flag + inline router (no cobra), reuse
internal/tier verbatim, BRAIN_URL env override, mode subcommand writes
.mcp.json with per-mode template plus placeholder for the Plan 6
routing pod.