Commit Graph
21 Commits
Author SHA1 Message Date
sam b7bdb6c946 docs(architecture): document the playbook binding model and threat model
Partial completion of archie-core-t2db.6 -- covers the binding model
(matcher/mapping/versioning/state machine) and verifies each of the
five threat-model non-negotiables from archie-core-t2db.5 against the
actual shipped code (not just the design intent), plus the AES-GCM
secret-at-rest encryption from t2db.7 and the binding_dispatches
at-most-once ledger.

Every claim checked against real code before writing, not assumed --
caught and corrected one wrong claim in-flight: binding-originated
tasks enqueue via EnqueueChatTask (the same direct-to-store.Task path
chat-spawned tasks use), NOT workintake.TaskEnvelope/NATS the way
forge-polled tasks do. Both converge on the same tasks table and
downstream gate/worktree pipeline, but by genuinely different enqueue
mechanisms -- worth noting for t2db.6's still-open ARCHITECTURE.md
task-lifecycle section, since this is exactly the provenance
distinction that section needs to state.

Explicitly does not cover: the ARCHITECTURE.md lifecycle addendum or
the operator walkthrough, both still open pieces of t2db.6.
2026-09-03 04:24:27 +10:00
sam 4b4945e448 docs(architecture): fix stale internal/workflow and internal/nats paths
Both packages no longer exist -- internal/workflow moved to
internal/domain/workflow at the 2026-08-07 domain migration (7e896c9),
confirmed by TaskContext still living there today. internal/nats is
gone entirely; verified TaskMessage as a type doesn't exist anywhere
in the codebase now, and archie.task.* subjects + TaskEnvelope live in
internal/domain/workintake (recorded as a completed migration in
migration-decisions.md), with transport in
internal/infrastructure/agenttransport/nats.

Fixed the two simple path corrections directly. Left the NATS row's
deeper question open rather than guessing: whether the row's entire
"current meaning" is now superseded by TaskEnvelope (not just its
location) needs a closer look this pass didn't have grounds to assert.
2026-09-03 04:19:11 +10:00
sam 7b1cef53eb fix(gateway): stop SOUL from forging the prompt invariant tags
Persona/SOUL text was interpolated raw at the top of archie.md.tpl,
so a hostile SOUL could inject its own <core_rules> or
<instruction_precedence> tags ahead of the real ones. Render it
through the existing xml-escaping helper into a labeled
trust="data" <soul> block, and tell instruction_precedence
explicitly that the block is reference data, not an authority.

Closes archie-core-1786637490097-12-bf415ffb
2026-09-02 21:48:57 +10:00
sam a5d3472b4b feat(memory): builtin engine implementing the domain/memory contract
Part of archie-core-1786637499480 (ship the file-writing store as the
default memory engine).

Records the missing design decision first (migration-decisions.md#5,
"authoritative memory record and revision model" was explicitly open):
internal/memory/builtin.Store addresses blocks by content substring with
no stable per-block ID, which the new Record{ID}/Forget(id) contract
needs. Decided and implemented: an ID assigned once at Write via a
leading `<!--mem:<uuid>-->` marker line, stripped back out of
Record.Content on read, located by that marker (not content) for
Forget -- so an unrelated edit can never orphan a Forget. Identity maps
to a directory named hex(sha256(identity)), not the identity string, so
an arbitrary identity can never traverse outside the configured root.
Kind maps to a builtin section name via the store's own
ValidateSectionName, so an invalid Kind fails the same way an invalid
section already does.

internal/infrastructure/memory.BuiltinEngine wraps one builtin.Store per
identity and implements domain/memory.MemoryEngine end to end
(Write/Query/List/Forget, Lifecycle, Manifest). Lives under
internal/infrastructure per organisation.md ("infrastructure implements
domain contracts"), not internal/domain/memory, which stays
contract-only.

internal/memory/builtin is untouched -- confirmed via git status and its
own test suite passing unmodified, per this issue's acceptance
criterion. This engine is not yet wired into daemon bootstrap or the
config surface (archie-core-1786637490043); it proves the contract
holds for the builtin store the same way curator's reference
implementations prove the curator contract, and registers/runs cleanly
through domain/memory.Registry (TestBuiltinEngineRegistersAndRuns
ThroughTheRegistry).
2026-09-02 02:36:10 +10:00
sam b236e8a256 docs(architecture): reconcile domain package map, add domain/messaging types
- migration-decisions.md: confirm curator/mapping/scheduling as
  legitimate domains that were never added to the confirmed list;
  document identity/agent/messaging/plugin as approved-but-unmaterialised
  targets rather than creating dead stub packages.
- Resolve the open Session/Messaging decision (section 2): keep
  internal/gateway as-is rather than risk a big-bang rewrite of live
  session/compression/approval/branch logic; materialise
  internal/domain/messaging with the already-settled canonical
  Message/Conversation/ToolCall/ToolResult types. Actual gateway
  migration onto these types is tracked as sequenced follow-up bd
  issues (label messaging-migration).
- ARCHITECTURE.md: add internal/gateway, internal/tools, internal/memory,
  internal/secret, internal/plugin, internal/skill to the Package Map.
2026-08-31 21:26:06 +10:00
sam b5ca9c8867 chore: update issue tracker, remove ai-sdk ADR 2026-08-28 22:28:49 +10:00
sam 99a989725f docs: record ai-sdk to goai migration decision 2026-08-28 22:28:26 +10:00
sam 1f05dbb33c feat(deployment): default to managed NATS workers
Autonomous workflows now always hand a complete task to a scoped archie-agent container. Embedded NATS is the default and external NATS changes only broker placement; legacy agent and containers.enabled inputs decode for migration but cannot select an execution path. The daemon flushes task-event subscriptions before a worker can publish, and runtime updates snapshot and restore the configured worker image.
2026-08-24 14:56:57 +10:00
sam d3da153768 refactor(agentexec): remove legacy execution paths
Autonomous workflows now have exactly one production boundary: a task-scoped archie-agent receives a full-task core-NATS request and runs the worker-local stage loop. The legacy [agent] section remains decode-only for migration; it no longer selects runtime behavior.
2026-08-24 14:56:57 +10:00
sam cc53e5258d fix(telegram): compact tool output and drop turn caps
Render completed ToolCallEvents as Telegram-safe streaming blocks
with compact name/status and a short cleaned preview. Summarize
file contents and listings instead of dumping source or quoted
JSON. Collapse repeated legacy turn-budget failures.

Remove max_tokens turn gating and the 200000 turn_budget_chars
default so absent or commented config cannot restore an aggregate
cap. Keep per-result max_result_chars and spill.

Confine find/grep discovery to the active workspace/worktree.

Refs #604
2026-08-23 16:40:16 +00:00
sam d28ca099c5 refactor(agent): move worker runtime into application layer
cmd/archie-agent used to own worker construction, NATS lifecycle, task execution, MCP setup, and workflow wiring. It now owns process input only and invokes internal/app/agentworker, while transport-specific NATS, boot-brief, and git-safety mechanics live under infrastructure.
2026-08-15 00:43:12 +10:00
sam 99fb1102cc docs(architecture): mark the config-overlay subset implemented on safe-change-and-recovery 2026-08-10 01:46:18 +10:00
sam 5343c68160 docs(architecture): record the implemented config reload and runtime overlay
Per the sequencing call (adversarial pass first, docs last), the docs
now reflect the design the reviews confirmed.

configuration.md:
- Mutation ledger gains rows for SIGHUP reload, dashboard PATCH,
  dashboard reset, and the runtime overlay store, each mapping to the
  universal change protocol with what is and is not yet implemented.
- New section 'Implemented runtime reload and config overlay (2026-08)':
  the Holder published-snapshot model, the reloadable-field criterion
  (a field is reloadable when EVERY consumer re-reads it), SIGHUP
  reload semantics, the overlay store (separate -config.sqlite, dotted
  keys, denylist, bootstrap degrade), and the PATCH/reset paths.

safe-change-and-recovery.md:
- New section 'Runtime config overlay: degrade paths and recovery'
  tabulating the three boot degrade paths and the reload degrade, all
  verified by the adversarial passes, plus the three documented
  recoveries (--no-config-overlay flag, rm the overlay file, dashboard
  reset). Status line notes the overlay subset is implemented while
  the full runtime-supervision protocol remains under design.

No new documents, per the constraint.
2026-08-10 01:45:44 +10:00
sam 61b4b7b0cf refactor(store): replace legacy persistence with SQLite
Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format.

Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology.
2026-08-09 22:27:25 +10:00
sam 95c5d59e7c docs(architecture): mark observability design as implemented 2026-08-09 19:29:33 +10:00
sam fab8a66486 Merge pull request #457 from samcharles93/fix/452-task-log-sink
feat(logging): add a per-task log sink
2026-08-09 18:17:24 +10:00
sam fd4420a038 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.
2026-08-09 18:10:12 +10:00
sam 86d3071f39 fix(workflow): carry gate output into the baseline park error
StageBaselineGate captured a failing gate command's full output but
discarded it: a 200-char clip went into a Warn log, and the terminal
error carried only res.Status. A park reason like "go build ./...
fails ... (status: failed)" gave no way to see the actual compiler
error, and the container that had it is already gone (AutoRemove).

Now the park error carries a bounded tail of the real output (tail,
not head, since a failing test's explanation is at the end after
pages of "ok" lines), rune-safe so it can't emit invalid UTF-8 into
a persisted park reason. The three existing byte bounds in this
stage (log line, agent mission, park error) are named and documented
as independently sized rather than left as bare numbers.

Also adds docs/architecture/observability.md, the design doc for the
larger task-observability epic (#450) this fix is the first step of.
2026-08-09 16:23:24 +10:00
sam 308666b410 chore: remove legacy terminology and dead code
- Reword docs and comments to drop vague "legacy" qualifiers where they no longer describe deprecation status
- Remove unused code: RecentEvents, MessageEvent.ToLegacy, index setState, stderr redaction tool, telegramOnlyCommands
- Delete or comment out tests covering removed or superseded behavior
2026-08-06 22:55:26 +10:00
sam 4ece064026 feat(curator): engine family contract, registry, and runtime (archie-core-rfp, archie-core-89x)
internal/curator is a conforming engine family per the strict plugin
engine rule: typed CuratorEngine contract (Lifecycle + domain ops),
owning Registry (registration, discovery, start/health/stop with
failure isolation, reverse-order shutdown, ctx-bounded stop), and a
narrow typed Registrar — each curator receives a capability-filtered
view of the host at Bind, never the daemon.

Runtime: one loop per curator on an injectable clock (fake-clock
testable), best-effort wake nudges with the trigger decision kept in
Check (a dropped nudge only delays to the next check-in, never
corrupts accounting), per-pass timeout and a max-concurrent-passes
slot so curator bursts cannot starve chat turns, per-pass panic
recovery, and bounded shutdown even when a pass ignores cancellation.
curator_run / curator_action / curator_error ride the in-process
event bus so activity stays attributable.

Wired in cmd/archied/main.go (constructed beside memory, Start after
daemon startup, shutdown ordered before memory/LLM teardown) and
exposed as daemon.Daemon.Curators.
2026-08-05 14:54:12 +10:00
sam 69640b5216 docs: consolidate into a single docs/ tree
Fold the old docs/ into the VitePress site and rename docs-2 -> docs.
The 12 architecture PRDs become first-class pages at docs/architecture/
with sidebar nav, rather than being buried under an archive path.
Historical material stays at docs/archive/. Rewrites every docs-2 and
docs/prds/architecture reference across the repo. Site builds clean.
2026-07-29 03:17:42 +10:00