docs(architecture): record decisions recovered from the pre-migration tracker
Eight approved decisions existed only as beads memories and were lost when
the tracker was removed. Recovered from a backup taken six minutes before
8bf0f6b and folded into the docs that own them, rather than a new document.
- migration-decisions: recorded position as of 2026-07-29, the deferred
private-input-DTO compromise, and the agreed internal/app/{archied,
agentworker} next step
- configuration: missing credential degrades a capability, only invalid
config is fatal; config generation moves from install.sh to archied setup
- identity: the three-layer invariants/SOUL/representation model, and why
a curator may only propose SOUL changes
- agent-system: the curator isolation invariant (curators are peers, never
on a chat turn's critical path)
- messaging-and-work-intake: semantic search over messages is an explicit
non-goal, with the measurements behind it
- safe-change-and-recovery: the /restart deadlock and lockout constraints
- plugins-and-extensions: dates the surprisal deferral
Also replaces the dead `**Beads issue:** archie-core-5d7` frontmatter across
all 12 documents with the GitHub issue it migrated to (#73), and rewrites
every other beads identifier to its issue number.
This commit is contained in:
1 parent
9187f023c3
commit
fd4420a038
12 files changed
+224
-15
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Current-state investigation in progress
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Domain framing
|
||||
|
||||
@@ -352,3 +352,32 @@ implemented in different packages:
|
||||
- Record StepExecutions explicitly rather than treating one mutable `stage`
|
||||
field as complete execution history.
|
||||
- Keep Attempt as retry state within the same WorkflowExecution.
|
||||
|
||||
## Curator isolation invariant
|
||||
|
||||
Decided 2026-08-05
|
||||
([#435](https://github.com/samcharles93/archie-core/issues/435) epic,
|
||||
[#98](https://github.com/samcharles93/archie-core/issues/98) runtime).
|
||||
Recovered 2026-08-09 from the pre-migration issue tracker.
|
||||
|
||||
**Curators are peers, not dependencies.** They must never block, delay, or take
|
||||
down chat turns, agent runs, or the daemon.
|
||||
|
||||
1. Registry-owned goroutines, one per curator, with per-pass `recover()`,
|
||||
per-pass budgets (max steps, tokens, timeout), and a configurable maximum of
|
||||
concurrent passes (default 1) so curators cannot saturate the shared LLM
|
||||
runtime against chat.
|
||||
2. Wake events ride the in-process `events.Bus`, which is mutex fan-out with
|
||||
bounded per-subscriber buffers that **drop** on overflow
|
||||
(`internal/events/events.go`). A slow curator can never backpressure the chat
|
||||
publisher.
|
||||
3. Wake is a best-effort nudge. The trigger is a deterministic read of persisted
|
||||
primary-input state at pass time, so a dropped wake only delays a run to the
|
||||
next check-in and never corrupts trigger accounting
|
||||
([#22](https://github.com/samcharles93/archie-core/issues/22)).
|
||||
4. The curator registry lifecycle is independent of the agent loop. Daemon
|
||||
shutdown cancels in-flight passes and waits bounded.
|
||||
|
||||
Chat turns keep their per-session lanes; agent runs keep their workflow
|
||||
goroutines and containers. Rule of thumb: **no code path a curator executes may
|
||||
ever appear on a chat turn's critical path.**
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Approved; existing-type assignment is ongoing
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Ownership
|
||||
|
||||
@@ -290,3 +290,57 @@ The configuration rearchitecture is complete only when:
|
||||
mutability class, owner, and deprecation;
|
||||
- architecture tests prevent a new central runtime configuration model, direct
|
||||
live-setting mutation, and incorrectly fixed behavioural values.
|
||||
|
||||
## Startup policy: missing credential degrades, invalid config is fatal
|
||||
|
||||
Decided 2026-07-30. Recovered 2026-08-09 from the pre-migration issue tracker.
|
||||
|
||||
A missing **credential** disables a capability. Only an **invalid config** stops
|
||||
the daemon. "Forge is a feature, not a requirement."
|
||||
|
||||
Before `518a1a0`, an unresolvable forge token did `return 1` in
|
||||
`cmd/archied/main.go`, so a chat-only user who never configured GitHub got no
|
||||
chat, no gateway, nothing — and under a systemd unit with `Restart=on-failure`
|
||||
and no start limit it crash-looped every five seconds with the error scrolling
|
||||
past unread. Forge construction now lives in `resolveForge`, shared by the
|
||||
primary forge and every configured identity, and degrades to `forge.NewNoop`
|
||||
with a warning. The identity path had the same defect and was worse: one
|
||||
identity's missing credential killed all the others.
|
||||
|
||||
Malformed configuration still fails fast in `configuration.Validate`, well
|
||||
before this point. That distinction is the whole design.
|
||||
|
||||
Apply the same reasoning to any future capability credential, LLM keys
|
||||
especially: start, report the capability as unavailable, let the operator see it.
|
||||
Guarded by `TestResolveForgeDegradesInsteadOfFailing`.
|
||||
|
||||
**Known consequence, tracked separately:** `worktree.Manager` still receives the
|
||||
empty token, so pushes fail late rather than at startup.
|
||||
|
||||
## Config generation belongs to `archied setup`, not `install.sh`
|
||||
|
||||
Decided 2026-07-30 ([#368](https://github.com/samcharles93/archie-core/issues/368)).
|
||||
Recovered 2026-08-09 from the pre-migration issue tracker.
|
||||
|
||||
`install.sh` must stop generating `config.toml`; `archied setup` owns it. The
|
||||
installer hand-rolling TOML has already drifted from the schema once: the
|
||||
generated-config branch hardcoded `key = ARCHIE_GITHUB_TOKEN` and
|
||||
`host = ${GITEA_URL}` regardless of the answers given, so choosing Gitea produced
|
||||
a config naming a token the installer never wrote (archied then exited 1), and
|
||||
choosing GitHub pointed `host` at `gitea.example.com`. `61a5b35` patched this
|
||||
with a `forge_block` shell helper shared by both config paths — that helper is a
|
||||
**workaround**, deleted by
|
||||
[#72](https://github.com/samcharles93/archie-core/issues/72). The durable fix is
|
||||
that the code writing the config is the code that reads it.
|
||||
|
||||
Why Go and not Python: the installer must run where nothing is installed yet, and
|
||||
`python3` with `tomllib` means 3.11+, which is not safe on LTS distros. `archied`
|
||||
is already being built two steps earlier.
|
||||
|
||||
**Key constraint for the port:** `BurntSushi/toml` does **not** survive a
|
||||
decode/encode round trip with comments intact, and `config.example.toml` carries
|
||||
documentation users are meant to hand-edit. Decide the write strategy
|
||||
([#412](https://github.com/samcharles93/archie-core/issues/412)) before writing
|
||||
any prompting code. Do not port a separate `config.yaml`/`auth.yaml` secret
|
||||
split — Archie already has `secret.SecretRef{engine,key}`, so setup writes the
|
||||
reference to TOML and the value to the secret engine.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Approved foundation
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Dependency direction
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Initial generator and site scaffold in progress
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Approved foundation; lifecycle details are deferred
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -291,3 +291,28 @@ Focused tests verify that:
|
||||
The focused identity tests pass. Broader daemon and NATS suites could not open
|
||||
embedded listener ports in the current sandbox; their failures occurred before
|
||||
identity behaviour executed.
|
||||
|
||||
## Three-layer identity model
|
||||
|
||||
Agreed 2026-07-30; the frame for SOUL
|
||||
([#68](https://github.com/samcharles93/archie-core/issues/68)) and the curator
|
||||
([#435](https://github.com/samcharles93/archie-core/issues/435)).
|
||||
Recovered 2026-08-09 from the pre-migration issue tracker.
|
||||
|
||||
**Layer 1 — invariants.** Instruction precedence, core rules, and the `<tools>`
|
||||
and `<env>` blocks live in `internal/gateway/templates/archie.md.tpl` and are
|
||||
unreachable at runtime by anyone.
|
||||
|
||||
**Layer 2 — SOUL.** User-authored identity: agent name, register, warmth.
|
||||
Editable without a rebuild.
|
||||
|
||||
**Layer 3 — representation.** Curator-derived knowledge about the user. It may
|
||||
only **propose** changes to SOUL and never apply them. If derived conclusions can
|
||||
silently rewrite tone, personality drifts and the user loses the control SOUL
|
||||
exists to give them. A proposal queue also makes the visibility requirement fall
|
||||
out for free, since pending conclusions are inherently reviewable.
|
||||
|
||||
**Why SOUL comes first:** tone currently lives in Go string constants
|
||||
(`DefaultPersonas` in `internal/gateway/persona.go`), so fixing a rude reply on
|
||||
2026-07-29 required editing Go and rebuilding. SOUL is small, fixes a real
|
||||
defect, and defines the boundary the curator must respect.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Current state researched; foundation decisions in progress
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -284,3 +284,37 @@ Current intake is fragmented:
|
||||
- the smallest accepted-work-request contract consumed by the Agent System;
|
||||
- migration of forge polling, replies, chat commands, email, webhook, Telegram,
|
||||
and Jira integrations.
|
||||
|
||||
## Non-goal: semantic search over chat messages
|
||||
|
||||
Decided 2026-08-03 while migrating `internal/gateway` to NellDB v0.3.0.
|
||||
Recovered 2026-08-09 from the pre-migration issue tracker.
|
||||
|
||||
Semantic/vector search over chat messages is an **explicit non-goal** until usage
|
||||
data shows a real need.
|
||||
|
||||
Message search is lexical only: collection-scoped `sdk.DocDB.TextSearch` over
|
||||
per-session collections, paged via `MessageQuery{Query,Limit,Offset}` →
|
||||
`MessagePage`. Do not add embeddings config, do not call
|
||||
`sdk.DocDB.SearchSimilar`, and do not write `nell.Record.Vector` on message
|
||||
records.
|
||||
|
||||
The rationale is cost without a demonstrated use case. Measured 2026-08-03 with
|
||||
`embeddinggemma:300m` — note this was never an infrastructure problem, the model
|
||||
was already pulled and `ai-sdk/provider/ollama` already has `embed.go`:
|
||||
|
||||
- 121 ms median warm per message on the write path, 12.5 s cold;
|
||||
- 768 dims = 3072 bytes per vector, roughly 15× a typical message payload;
|
||||
- the NellDB v0.3.0 store contract requires `Record.Clone` to deep-copy
|
||||
`Vector`, so vectors on message records are cloned by **every** chronological
|
||||
read — `RecentMessages(200)` would copy 600 KB of vectors it discards, on the
|
||||
hot path of every turn;
|
||||
- `SearchSimilar` is a linear cosine scan (parallel only above 1000 records),
|
||||
with no ANN index;
|
||||
- `LogStore` is append-only and v0.3.0 retains tombstones indefinitely, so the
|
||||
growth does not compact away.
|
||||
|
||||
If this is ever revisited: NellDB gates vector search on
|
||||
`Type == TypeVector && len(Vector) > 0`, so partial vectorisation is natively
|
||||
supported, and vectors belong in a sibling collection (`vectors:<sessionID>`) so
|
||||
chronological reads never clone them.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Active migration inventory
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -238,3 +238,35 @@ Migration design is complete when:
|
||||
|
||||
Exact Go APIs, SQL statements, and mechanical refactoring steps MAY be finalized
|
||||
during implementation when they do not change these semantics.
|
||||
|
||||
## Recorded migration position (2026-07-29)
|
||||
|
||||
Recovered 2026-08-09 from the pre-migration issue tracker. This section records
|
||||
decisions the maintainer approved that the repository did not otherwise capture.
|
||||
|
||||
**Completed:** `internal/infrastructure/eventbus/nats` (rebuilt, not relocated);
|
||||
`internal/infrastructure/configuration` (loading moved out of `internal/config`,
|
||||
which is now types-only and does no I/O); `internal/eventbus` (broker-neutral
|
||||
contract); `internal/domain/workintake` (the first `internal/domain/` package,
|
||||
owning `TaskEnvelope`, the routing `Kind`, the label vocabulary, and task
|
||||
subjects).
|
||||
|
||||
**DECISION — private input DTO deferred (approved).**
|
||||
`configuration.Document.Config` is still `internal/config.Config` rather than the
|
||||
private per-domain input DTO this document mandates. Building an ~800-line
|
||||
parallel type tree while every consumer still reads `config.Config` would mean
|
||||
two shapes kept in sync by hand, with no consumer for the new one. It is named as
|
||||
a field so the compromise is visible at each use site, with the deletion
|
||||
condition recorded in that package's `doc.go`. Do this **with** the
|
||||
`internal/config` dissolution, not ahead of it.
|
||||
|
||||
**Agreed next: `internal/app/{archied,agentworker}`.** `run()` in
|
||||
`cmd/archied/main.go` is ~460 lines, against `organisation.md`'s rule that
|
||||
`cmd/*` must not contain substantive wiring or act as a service locator. It is
|
||||
also the last non-infrastructure holder of the NATS SDK, and it is where the
|
||||
config DTO translation will land, so it unblocks the dissolution above.
|
||||
|
||||
**Method constraint.** Do not write a separate recorded package-review document
|
||||
per area when the decisions are already dictated by
|
||||
`dependencies-and-contracts.md`. That is the ceremony pattern this project
|
||||
deliberately avoids.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Approved
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Target structure
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Active
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Approved foundation
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Plugin framework
|
||||
|
||||
@@ -43,7 +43,13 @@ network services without a concrete security or operational reason.
|
||||
|
||||
## Curator surprisal sampling (deferred)
|
||||
|
||||
The curator engine family (epic `archie-core-yp9`) selects which memories
|
||||
**Deferred by decision, 2026-08-05** — Archie has no embedding capability, and
|
||||
wave 1 ships the strategy seam without one. Pick the deferred work up in order:
|
||||
[#436](https://github.com/samcharles93/archie-core/issues/436) first, then
|
||||
[#437](https://github.com/samcharles93/archie-core/issues/437) which depends on it
|
||||
and on [#407](https://github.com/samcharles93/archie-core/issues/407).
|
||||
|
||||
The curator engine family (epic [#435](https://github.com/samcharles93/archie-core/issues/435)) selects which memories
|
||||
deserve agentic attention via surprisal-based sampling: score memories by how
|
||||
surprising they are and spend the sampled reasoner's agentic budget on the
|
||||
most surprising items. Wave 1 of the epic ships the `Sampler` strategy seam in
|
||||
@@ -53,8 +59,8 @@ extension point and is gated behind an embedding capability Archie does not
|
||||
yet have — **any surprisal-style sampling is gated behind adding one**.
|
||||
|
||||
Requirements for the deferred work, so it can be picked up without
|
||||
re-deriving the design (tracked as `archie-core-yp9.1` embeddings capability,
|
||||
then `archie-core-yp9.2` surprisal strategies):
|
||||
re-deriving the design (tracked as [#436](https://github.com/samcharles93/archie-core/issues/436) embeddings capability,
|
||||
then [#437](https://github.com/samcharles93/archie-core/issues/437) surprisal strategies):
|
||||
|
||||
- A `Sampler` implementation behind the same interface as the cheap
|
||||
strategies; selection deterministic given fixed inputs.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Approved foundation; exact API is deferred
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** Requirements approved; mechanics are under design
|
||||
**Date:** 2026-07-28
|
||||
**Beads issue:** `archie-core-5d7`
|
||||
**Tracking issue:** [#73](https://github.com/samcharles93/archie-core/issues/73)
|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -99,3 +99,32 @@ capabilities continue operating.
|
||||
|
||||
Remediation MUST be bounded, observable, and policy-driven. Recovery MUST NOT
|
||||
silently oscillate between versions or retry forever.
|
||||
|
||||
## Gateway restart: two constraints learned the hard way
|
||||
|
||||
Telegram `/restart` (`internal/channels/telegram/restart.go` plus the `Start`
|
||||
supervisor loop). Recovered 2026-08-09 from the pre-migration issue tracker.
|
||||
Both constraints must survive any refactor.
|
||||
|
||||
**1. Deadlock.** The `/restart` handler runs *on* the bot instance the supervisor
|
||||
is about to stop. Tearing down inline from the handler deadlocks the restart it
|
||||
just asked for. So the handler sends on a **buffered** channel (`restartCh`,
|
||||
capacity 1) and returns immediately; the supervisor loop in `Start` does the
|
||||
teardown. Duplicate requests hit the default branch and are dropped, not queued.
|
||||
|
||||
**2. Lockout.** A failed config reload must **not** be fatal. It logs and
|
||||
relaunches with the previous in-memory settings. If a bad config edit killed the
|
||||
gateway, it would also destroy the only means of fixing it remotely — which is
|
||||
the entire reason `/restart` exists.
|
||||
|
||||
**Scope is gateway-only by design.** The daemon keeps running so in-flight agent
|
||||
tasks survive. Exiting the process would also restart under a `unless-stopped`
|
||||
policy, but would kill running work. `Reload` (supplied by `cmd/archied/main.go`)
|
||||
re-reads config from disk and refreshes **only** the token and `AllowedUserIDs`;
|
||||
everything else is wired into the daemon at construction and still needs a full
|
||||
restart.
|
||||
|
||||
**Authorisation is inherited:** `authorizedMessage` rejects non-allowlisted
|
||||
senders before any handler runs, so all gateway commands are admin-only by
|
||||
construction. Do not add per-command auth without checking that invariant still
|
||||
holds.
|
||||
Reference in new issue
Block a user