refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat
This commit is contained in:
608 files changed
+63317
-10219
No files matched your search
@@ -33,8 +33,8 @@ The words **MUST**, **MUST NOT**, **SHOULD**, and **MAY** are normative.
|
||||
|
||||
## Decision documents
|
||||
|
||||
| Scope | Authoritative document |
|
||||
| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| Scope | Authoritative document |
|
||||
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| Repository layout, domains, composition, deployments, and optional material | [architecture/organisation.md](../architecture/organisation.md) |
|
||||
| Dependency direction, domain contracts, infrastructure, commands, events, and wire contracts | [architecture/dependencies-and-contracts.md](../architecture/dependencies-and-contracts.md) |
|
||||
| External configuration, runtime settings, and dissolution of `internal/config` | [architecture/configuration.md](../architecture/configuration.md) |
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ These rules apply to every file in `docs/prds/`.
|
||||
- Use the shortest direct sentence. Write “When upgraded, existing instances
|
||||
are migrated to the database,” not a description of an importer seeding
|
||||
absent resources.
|
||||
- State each fact once. Do not repeat a heading, summarize a list before showing
|
||||
- State each fact once. Do not repeat a heading, summarise a list before showing
|
||||
it, or restate a decision afterward.
|
||||
- Every sentence must add a decision, requirement, constraint, evidence, or
|
||||
verification step. Delete narration and explanations of obvious text.
|
||||
@@ -19,10 +19,10 @@ These rules apply to every file in `docs/prds/`.
|
||||
open until the maintainer or repository evidence settles them.
|
||||
- Do not create a process for a logical boundary. Add one only when it must
|
||||
deploy, scale, start, secure, or fail separately.
|
||||
- Describe working behavior, not explanatory UI around missing behavior. State
|
||||
- Describe working behaviour, not explanatory UI around missing behaviour. State
|
||||
what users can do and how success is proved.
|
||||
- Before approval, use independent read-only reviewers to check a cross-cutting
|
||||
PRD for missing behavior and exaggerated claims. Verify and synthesize their
|
||||
PRD for missing behaviour and exaggerated claims. Verify and synthesise their
|
||||
findings; do not copy their prose.
|
||||
- Before requesting approval, review every sentence for complexity, repetition,
|
||||
and unsupported scope.
|
||||
|
||||
@@ -37,7 +37,7 @@ host executor, no second `Pool.Acquire`, and no nested container lifecycle.
|
||||
|
||||
**Two isolations are needed, and Subagent only provides one of them.**
|
||||
|
||||
*Conversation isolation is structural, and free.* `Subagent.Run`
|
||||
_Conversation isolation is structural, and free._ `Subagent.Run`
|
||||
(`agent/subagent.go`) calls `GenerateText` with `Prompt` set and
|
||||
`Messages` never populated. The implementer's history has no code path into
|
||||
the nested run; only the prompt string crosses, and only text comes back.
|
||||
@@ -46,7 +46,7 @@ the reviewer is not told to ignore the implementer's reasoning, because
|
||||
nothing hands it any. `h019.3`'s required test asserts this as a construction
|
||||
fact.
|
||||
|
||||
*Workspace isolation is still ours to build.* A sub-agent shares the parent's
|
||||
_Workspace isolation is still ours to build._ A sub-agent shares the parent's
|
||||
process, working directory and credentials. So the `.git`-free snapshot from
|
||||
the original decision survives unchanged and is load-bearing: export the
|
||||
reviewed commit (`git archive <commit> | tar -x`) into a fresh scratch
|
||||
@@ -63,7 +63,7 @@ publication grant, so a reviewer holding it could push the branch it exists to
|
||||
block.
|
||||
|
||||
**Call `Run()`, not `Tool()`.** `Tool()` would register delegation as a tool
|
||||
the *implementer's* model may choose to invoke -- self-certification by the
|
||||
the _implementer's_ model may choose to invoke -- self-certification by the
|
||||
implementer, which is the exact failure this feature exists to prevent. The
|
||||
stage calls `Run()` unconditionally. That also sidesteps both of `Tool()`'s
|
||||
documented footguns: the parent's two-step minimum and the recursion risk of
|
||||
|
||||
@@ -64,7 +64,7 @@ states do not carry:
|
||||
completed A2A task cannot express the outcome that matters most to the caller.
|
||||
- **Handing work to a reviewer.** archie's `pr_open` means the work left
|
||||
archie's hands for human review. A2A's `input-required` is the nearest state,
|
||||
but it means the *client* must send more input, and a reviewer is not the
|
||||
but it means the _client_ must send more input, and a reviewer is not the
|
||||
client.
|
||||
- **Operator decisions.** `declined`, `parked` and `dead` are outcomes of
|
||||
archie's own policy and operator actions. A2A has no state for "the operator
|
||||
@@ -105,7 +105,7 @@ The daemon is not an A2A agent: it is the process that serves the identity.
|
||||
served through the binding archie runs and needs no HTTP listener.
|
||||
|
||||
**The card is derived, never hand-written.** Its skills come from the skill
|
||||
catalog, its identity from the configured Identity, and its capabilities from
|
||||
catalogue, its identity from the configured Identity, and its capabilities from
|
||||
what the process already advertises about itself. A card that restated
|
||||
capabilities independently would be a second inventory of the same facts, which
|
||||
is the class of drift the existing capability reporting exists to prevent.
|
||||
@@ -123,14 +123,14 @@ archie, and archie already serves its own contracts over gRPC to the Messaging
|
||||
Service, the dashboard and the State Store. Acting as an A2A client to remote
|
||||
agents is a later capability, and one that consumes the same contract.
|
||||
|
||||
## Authentication and authorization
|
||||
## Authentication and authorisation
|
||||
|
||||
**An inbound A2A call is authenticated at the transport, by the same bearer-token
|
||||
interceptor the Gateway applies to its other contracts.** A2A carries no identity
|
||||
in its payload by design: identity is established where the connection is, so the
|
||||
transport token is the identity and no field in a Message or Task names a caller.
|
||||
|
||||
**Authorization is per skill**, which is A2A's own model: the card advertises
|
||||
**Authorisation is per skill**, which is A2A's own model: the card advertises
|
||||
skills, and a caller may invoke the skills its credential is scoped to.
|
||||
|
||||
**Task-scoped grants are not A2A credentials.** They scope a worker's access to
|
||||
|
||||
@@ -80,4 +80,4 @@ receiving contract already carries them; version one does not exercise them.
|
||||
- The report renderer test covers a report with findings, checks, dispositions
|
||||
and a not-run status.
|
||||
- Configuration tests cover the disabled case, the `SecretRef` path and the
|
||||
`token_env` fallback.
|
||||
`token_env` fallback.
|
||||
@@ -135,7 +135,7 @@ one inbound message (`internal/infrastructure/gatewayrpc/server.go:Stream`).
|
||||
|
||||
Giving playbook-originated sends the session and approval scoping the
|
||||
interactive channels use. Configured destinations carry the address, so there is
|
||||
no conversation to anchor to and no scoping mechanism to generalize.
|
||||
no conversation to anchor to and no scoping mechanism to generalise.
|
||||
|
||||
## Packages this touches
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ summaries, and retrieve semantically. That design exists because they must
|
||||
serve any language. This repository is one Go module, and Go's type checker is
|
||||
ground truth:
|
||||
|
||||
| Question | Source of truth |
|
||||
| --- | --- |
|
||||
| Question | Source of truth |
|
||||
| --------------------------- | ------------------------------------------------ |
|
||||
| Who references this symbol? | `go/packages` + `go/types`, resolved by identity |
|
||||
| What calls what? | `callgraph` RTA over SSA |
|
||||
| What imports what? | `go list -deps` |
|
||||
| What calls what? | `callgraph` RTA over SSA |
|
||||
| What imports what? | `go list -deps` |
|
||||
|
||||
No vector database, no embedding cost, no edges invented by a summary that
|
||||
drifted from the code. For a single-language repository this is both cheaper
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## Question
|
||||
|
||||
Should `config.example.toml` and `deployments/*.toml` be *generated*, so they
|
||||
Should `config.example.toml` and `deployments/*.toml` be _generated_, so they
|
||||
cannot drift from the config code?
|
||||
|
||||
## Decision
|
||||
@@ -19,7 +19,7 @@ of the schema, and generating either would destroy the thing that makes it
|
||||
useful. Three verified reasons, in order of weight:
|
||||
|
||||
1. **`config.example.toml`'s value is its comments.** It documents **137 keys**
|
||||
(measured: active *and* commented-out), and those hand-written comments are
|
||||
(measured: active _and_ commented-out), and those hand-written comments are
|
||||
the file's purpose — `docs/architecture/configuration.md` states outright
|
||||
that "`config.example.toml` carries documentation users are meant to
|
||||
hand-edit". TOML round-tripping does not preserve comments, which is exactly
|
||||
@@ -68,7 +68,7 @@ keys, and expose it so tests can assert emptiness.
|
||||
startup policy is "a missing credential disables a capability; only an invalid
|
||||
config stops the daemon". A stray key is far more likely to be an operator typo
|
||||
in a file they are otherwise happy with than a reason to refuse to boot, and
|
||||
`[web]` is documented as landing in a *different* binary
|
||||
`[web]` is documented as landing in a _different_ binary
|
||||
(`internal/app/archieui`), so a key unknown to one process is legitimately known
|
||||
to another. Failing closed here would break working deployments on upgrade.
|
||||
|
||||
@@ -97,7 +97,7 @@ deferred, not rejected.
|
||||
- No reflection-based schema over `config.Config`.
|
||||
- No new type list inside `docsgen`.
|
||||
- No change to `archied setup`'s template: `configtemplate.Example` stays the
|
||||
verbatim embedded example, hand-maintained, and `setup` continues to *edit* it
|
||||
verbatim embedded example, hand-maintained, and `setup` continues to _edit_ it
|
||||
via `tomlwrite` rather than regenerate it.
|
||||
|
||||
## A withdrawn premise, recorded so it is not reused
|
||||
|
||||
@@ -83,7 +83,7 @@ side-channel maps the frontend cross-references by key string.
|
||||
`Locked`/`Overridden`/`Reload`/`Provenance` stay as top-level
|
||||
`ConfigView` fields; they describe runtime state (what happened on
|
||||
the last reload, which keys the overlay refuses), not the field
|
||||
catalog, and duplicating that logic per-field would be the same drift
|
||||
catalogue, and duplicating that logic per-field would be the same drift
|
||||
risk this change exists to remove.
|
||||
|
||||
`FieldStructured` fields (repositories, models, providers) carry
|
||||
@@ -105,12 +105,17 @@ private implementation detail, called generically:
|
||||
```js
|
||||
for (const section of schema.sections) {
|
||||
const rows = section.fields
|
||||
.filter(f => f.type !== "structured")
|
||||
.map(f => row(f.label, f.value, {
|
||||
key: f.key, type: f.type, options: f.options,
|
||||
locked: f.locked_reason, overridden: f.overridden,
|
||||
restartRequired: f.restart_required,
|
||||
}));
|
||||
.filter((f) => f.type !== "structured")
|
||||
.map((f) =>
|
||||
row(f.label, f.value, {
|
||||
key: f.key,
|
||||
type: f.type,
|
||||
options: f.options,
|
||||
locked: f.locked_reason,
|
||||
overridden: f.overridden,
|
||||
restartRequired: f.restart_required,
|
||||
}),
|
||||
);
|
||||
// structured fields render through their dedicated editor (b6ew.4)
|
||||
}
|
||||
```
|
||||
@@ -145,7 +150,7 @@ restart. It knows how to render a section and a field of a given type.
|
||||
2. `Repo.ReviewEnabled` reaches the API and the dashboard, alongside
|
||||
`AllowConcurrent` and `MaxRetries`.
|
||||
3. Adding a new scalar field to the schema requires one backend
|
||||
descriptor and zero frontend changes to appear correctly labeled,
|
||||
descriptor and zero frontend changes to appear correctly labelled,
|
||||
sectioned, and editable.
|
||||
4. `TestHandleConfigNeverLeaksSecrets`-style coverage extends to the
|
||||
schema response; no descriptor exists for a secret-bearing field.
|
||||
|
||||
@@ -13,8 +13,8 @@ be resolved by hardening the regexes.
|
||||
Does every declared contract surface have a consumer, or an explicit declaration
|
||||
that it has none?
|
||||
|
||||
Reachability (`tools/reachaudit`) asks the complementary question — *is this code
|
||||
in a shipped binary?* — and cannot see a capability that is **reachable and
|
||||
Reachability (`tools/reachaudit`) asks the complementary question — _is this code
|
||||
in a shipped binary?_ — and cannot see a capability that is **reachable and
|
||||
unconsumed**. `ratelimit` was in the binary closure and called by nothing
|
||||
(`archie-core-6wxb`); reachability would not have found that.
|
||||
|
||||
@@ -23,12 +23,12 @@ unconsumed**. `ratelimit` was in the binary closure and called by nothing
|
||||
Yes, as an advisory survey. `tools/contractaudit` classifies each subject of each
|
||||
surface:
|
||||
|
||||
| Classification | Meaning | Fails `--strict`? |
|
||||
| --- | --- | --- |
|
||||
| `CONSUMED` | a call site exercises it | no |
|
||||
| `DECLARED-UNCONSUMED` | allowlisted in `docs/contract-declarations.json`, with a reason and a tracker | no |
|
||||
| `UNDECLARED-UNCONSUMED` | nobody reaches it, nobody declared it | **yes** |
|
||||
| `STALE-DECLARATION` | an allowlist entry that is no longer true | **yes** |
|
||||
| Classification | Meaning | Fails `--strict`? |
|
||||
| ----------------------- | ----------------------------------------------------------------------------- | ----------------- |
|
||||
| `CONSUMED` | a call site exercises it | no |
|
||||
| `DECLARED-UNCONSUMED` | allowlisted in `docs/contract-declarations.json`, with a reason and a tracker | no |
|
||||
| `UNDECLARED-UNCONSUMED` | nobody reaches it, nobody declared it | **yes** |
|
||||
| `STALE-DECLARATION` | an allowlist entry that is no longer true | **yes** |
|
||||
|
||||
There are **four** classes and **two** of them fail. The allowlist must match
|
||||
reality exactly, and it fails in both directions: a missing entry is a finding,
|
||||
@@ -44,11 +44,11 @@ unrelated to what it measures must not be able to break a build.
|
||||
|
||||
## Surfaces actually built — three, not five
|
||||
|
||||
| Surface | Subjects | "Consumed" means |
|
||||
| --- | --- | --- |
|
||||
| `proto/state/v1` `StateStoreService` | **45 RPCs** | an adapter body calls `client.<Rpc>(...)` |
|
||||
| `proto/gateway/v1` `ChatService` | **21 RPCs** | same |
|
||||
| `internal/webui` dashboard routes | **49 routes** | a path literal appears as a call argument under `ui/src` |
|
||||
| Surface | Subjects | "Consumed" means |
|
||||
| ------------------------------------ | ------------- | -------------------------------------------------------- |
|
||||
| `proto/state/v1` `StateStoreService` | **45 RPCs** | an adapter body calls `client.<Rpc>(...)` |
|
||||
| `proto/gateway/v1` `ChatService` | **21 RPCs** | same |
|
||||
| `internal/webui` dashboard routes | **49 routes** | a path literal appears as a call argument under `ui/src` |
|
||||
|
||||
Consumption for the gRPC surfaces is established by **scanning adapter source
|
||||
text** for calls through the generated client, not by reflection. See the errata
|
||||
|
||||
@@ -87,7 +87,7 @@ each implementing `Sampler`:
|
||||
sort, ties keep input order so output is deterministic even when two
|
||||
candidates share a timestamp), then truncates to `req.Cap` (0 = all).
|
||||
- **`staleness`** (`NewStaleness()`): the mirror of recency -- sorts oldest-
|
||||
`At`-first, then truncates to `req.Cap`. This is explicitly a *proxy*:
|
||||
`At`-first, then truncates to `req.Cap`. This is explicitly a _proxy_:
|
||||
"hasn't been touched in the longest time" using whatever timestamp the
|
||||
caller populated `Candidate.At` with (created, updated, or
|
||||
last-reviewed -- the caller's choice, not this package's), never the
|
||||
@@ -119,7 +119,7 @@ that already accommodates the known future consumer.
|
||||
|
||||
Only `ID` and `At` are used by any wave-1 strategy. `Metadata` exists solely
|
||||
so GitHub #437 can carry an embedding vector (or whatever else the k-NN/
|
||||
power-iteration step needs) through the *same* `Candidate` type without this
|
||||
power-iteration step needs) through the _same_ `Candidate` type without this
|
||||
package importing `internal/domain/embedding` or growing a `Vector` field
|
||||
that every non-surprisal strategy ignores. Untyped and optional, exactly
|
||||
like `image.GenerateRequest.Options` and `curator.Action.Detail`'s existing
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
## Decision
|
||||
|
||||
Make the web chat **dashboard-aware**: the agent is told which dashboard page
|
||||
the operator has *open*, knows what each page is for, and can **point**
|
||||
the operator has _open_, knows what each page is for, and can **point**
|
||||
the operator to the relevant page with a **clickable destination chip** the UI
|
||||
renders and follows - Option B (context + navigate), not just "tell me in text."
|
||||
|
||||
@@ -22,15 +22,15 @@ Three seams, each an existing extension point, one new tool and one message fiel
|
||||
UI renders it as a clickable chip that routes the operator there. This is the
|
||||
"plenty of resources" the requirement named.
|
||||
|
||||
We deliberately keep the agent's answer honest: the chip is *evidence* it can
|
||||
We deliberately keep the agent's answer honest: the chip is _evidence_ it can
|
||||
validly produce because dashboard_navigate is a real tool whose result is
|
||||
rendered, not a markdown link the model invents.
|
||||
|
||||
## Why now
|
||||
|
||||
This is the natural next step of the "chat on any page" work, and the original
|
||||
request named it explicitly: *"archie should be able to see what page you're on
|
||||
too. and point out where to go. so it needs plenty of resources."* The chat
|
||||
request named it explicitly: _"archie should be able to see what page you're on
|
||||
too. and point out where to go. so it needs plenty of resources."_ The chat
|
||||
is a full-page route with no knowledge of the rest of the dashboard; the agent
|
||||
cannot see which page the operator is on and cannot reliably direct them anywhere.
|
||||
The critique of the chat UI already identified "chat is not available on any page"
|
||||
|
||||
@@ -29,13 +29,13 @@ navigation. There is no way to send someone to Repositories.
|
||||
|
||||
Five top-level nav items. Dashboard is a link; the rest are dropdowns.
|
||||
|
||||
| Group | Items |
|
||||
|---|---|
|
||||
| Dashboard | (link, `/`) |
|
||||
| Work | Tasks, Workflows |
|
||||
| Agent | Skills, Curators |
|
||||
| Events | Inspector, Mappings, Bindings |
|
||||
| System | Status, Logs, Appearance; **Settings:** Task settings, Models, Repositories, Channels, Advanced |
|
||||
| Group | Items |
|
||||
| --------- | ----------------------------------------------------------------------------------------------- |
|
||||
| Dashboard | (link, `/`) |
|
||||
| Work | Tasks, Workflows |
|
||||
| Agent | Skills, Curators |
|
||||
| Events | Inspector, Mappings, Bindings |
|
||||
| System | Status, Logs, Appearance; **Settings:** Task settings, Models, Repositories, Channels, Advanced |
|
||||
|
||||
Items are renamed because the group now carries the context: "Event inspector"
|
||||
becomes "Inspector" under Events, and so on. A group renders only if at least
|
||||
@@ -55,17 +55,17 @@ Configuration dissolves into real routes. Anchors into one long page were
|
||||
rejected: they leave the 4021px page intact and a deep link lands the reader
|
||||
mid-scroll with no context above it.
|
||||
|
||||
| Was | Becomes | Content |
|
||||
|---|---|---|
|
||||
| `/settings` | `/system/status` | Update status, configuration sources, daemon listen address |
|
||||
| -- | `/system/appearance` | Theme, and the density/motion preferences that follow it |
|
||||
| `/settings` | `/system/tasks` | Work lifecycle: statuses, operator actions, budgets |
|
||||
| `/settings` | `/system/models` | Model roles, providers |
|
||||
| `/settings` | `/system/repos` | Repositories and their per-repo gate overrides |
|
||||
| `/settings` | `/system/advanced` | Identity, storage and sandboxing, dangerous actions |
|
||||
| `/captures` | `/captures` | unchanged; label becomes "Inspector" |
|
||||
| `/mappings` | `/mappings` | unchanged; label becomes "Mappings" |
|
||||
| `/bindings` | `/bindings` | unchanged; label becomes "Bindings" |
|
||||
| Was | Becomes | Content |
|
||||
| ----------- | -------------------- | ----------------------------------------------------------- |
|
||||
| `/settings` | `/system/status` | Update status, configuration sources, daemon listen address |
|
||||
| -- | `/system/appearance` | Theme, and the density/motion preferences that follow it |
|
||||
| `/settings` | `/system/tasks` | Work lifecycle: statuses, operator actions, budgets |
|
||||
| `/settings` | `/system/models` | Model roles, providers |
|
||||
| `/settings` | `/system/repos` | Repositories and their per-repo gate overrides |
|
||||
| `/settings` | `/system/advanced` | Identity, storage and sandboxing, dangerous actions |
|
||||
| `/captures` | `/captures` | unchanged; label becomes "Inspector" |
|
||||
| `/mappings` | `/mappings` | unchanged; label becomes "Mappings" |
|
||||
| `/bindings` | `/bindings` | unchanged; label becomes "Bindings" |
|
||||
|
||||
`/settings` is kept as a permanent redirect to `/system/status`. It is the URL
|
||||
in existing bookmarks, in `dashboardPages` (`internal/gateway/dashboard_tools.go`,
|
||||
|
||||
@@ -21,7 +21,7 @@ the status and action vocabularies for exactly this reason.
|
||||
ids from the `Change*` constants and the stamp from `events.ConfigCapturedSchema`.
|
||||
|
||||
The dashboard renders `ui/src/lib/task-meta-snapshot.ts` until the served
|
||||
catalog arrives, or when archied is unreachable. `loadTaskMeta` replaces only
|
||||
catalogue arrives, or when archied is unreachable. `loadTaskMeta` replaces only
|
||||
the keys the payload carries, so a server without the new keys leaves the
|
||||
snapshot in place. `changeStatusLabel` and `configSchema` in
|
||||
`ui/src/lib/task-meta.ts` are the only readers; an unknown status renders as
|
||||
|
||||
@@ -12,41 +12,41 @@ findings, and returns one cited report. Grounded in web search and web fetch.
|
||||
|
||||
Every claim in this document is mapped to what exists in the tree.
|
||||
|
||||
| Claim | Status | Where it stands |
|
||||
|---|---|---|
|
||||
| `web_fetch` tool (URL → readable text) | **Implemented** | `internal/tools/webfetch/{tool.go,webfetch.go}`; registered in `internal/app/archied/bootstrap.go` `registerStandaloneTools`, disabled-by-config returns `nil` |
|
||||
| **Web search** (query → result list) | **Aspirational — zero code** | No search provider, no search tool, no config block anywhere in the tree or in `ai-sdk` v0.1.32 |
|
||||
| `agent.Subagent` — nested agent in a fresh context window | **Implemented** (dependency) | `github.com/samcharles93/ai-sdk@v0.1.32/agent/subagent.go`. Synchronous, non-streaming, own model/system/toolset, `MaxSteps` defaults to 10, nesting depth capped at 5, returns final text only |
|
||||
| Subagent used in production | **Implemented, one consumer** | `internal/app/agentworker/review.go` — the adversarial reviewer. That is the only non-test use of `Subagent` in the repo |
|
||||
| A **delegate/subagent tool** on the chat surface | **Aspirational — zero code** | No `subagent`/`delegate` tool name is registered anywhere |
|
||||
| **Fan-out orchestration** (N missions, one collator) | **Aspirational — zero code** | `agentloop`'s package doc states it runs *one* mission: "orchestration across missions lives with the caller". No caller does this yet |
|
||||
| Parallel-safe tool execution | **Aspirational — zero code** | The unreachable `internal/tools/dispatch.go` dispatch/gating engine (`ExecutionClass`, `DispatchSequential`/`DispatchConcurrent`/`ClassifyEntry`) was deleted as dead code (tools-core-1); live concurrency is ai-sdk's `GenerateOptions.MaxParallelToolCalls`, which archie-core never sets |
|
||||
| Per-result caps + spill-to-disk | **Implemented** | `internal/agentexec/toolset.go` `ToolLimits{MaxResultChars,SpillDir}`, applied in `toolExecute` via `tools.CapPayload` (`limit.go`); no **aggregate** turn cap by design (`toolset.go`). `config.ToolPolicy.SpillDir`; default cap 50k chars, spill dir deliberately not defaulted |
|
||||
| Tool guardrails (repeat-failure / no-progress) | **Implemented, not on the call path** | `internal/tools/guardrail.go` engine exists. Its only non-test caller is `dispatchOne` — which is itself unreachable — so **the chat path never consults it**, and the agent path only records per *stage* (`domain/workflow/agent.go`) |
|
||||
| Structured capture tools (model reports into a typed store, not prose) | **Implemented** | `internal/app/agentworker/review.go` `record_finding` / `record_checked` — `core.NewTypedTool` appending to a caller-owned slice. This is the pattern a research source ledger should reuse |
|
||||
| Curator engine (interval, declared tool set, lifecycle) | **Implemented, tools broken** | `internal/domain/curator`; a curator declaring tools is **refused** at registration (`registry.go`, no `ToolBuilder` implementation) and `curatorLLMRunner` (`internal/app/archied/main.go`) drops `ChatRequest.Tools`. Budgets are time+concurrency only (`runtime.go`) — **no token budget** |
|
||||
| Cron / scheduling + delivery router | **Implemented, wired into the daemon** | `internal/domain/scheduling` (ticker engine), `internal/infrastructure/cronstore` (schema v2, `Kind` discriminator), and `internal/infrastructure/crondelivery`; `internal/app/archied/scheduling.go` composes them and `main.go` starts the engine. |
|
||||
| Workflow engines (multi-stage, resumable) | **Implemented, worktree-bound** | `internal/domain/workflow` — every non-triage workflow opens with `StagePrepareWorktree()` and mounts `tc.Dir` into a container; the task persists after every stage (`workflow.go`). `triage.go` documents there is "no cheaper directory-less classification primitive" |
|
||||
| Long-running chat-initiated work with progress | **Partial** | Chat turns run **once, synchronously**, inline in the channel's turn runner (`internal/gateway/turn.go`). Chat can spawn a *workflow task* (`task_spawn`) which is asynchronous — but that path is worktree/PR-shaped |
|
||||
| **Operator-push delivery of an async result** | **Aspirational — zero code** | Nothing pushes a finished result to a chat. No channel subscribes to the event bus (Telegram only *publishes* `KindTurnCompleted`); `crondelivery.Courier` is the intended seam but has **no implementation and no caller**; `send_file` works only inside the live turn. The one out-of-band notification in the tree is feasibility's n8n webhook (`feasibility.go`) |
|
||||
| Citation storage / source ledger | **Aspirational — zero code** | No source, citation, or provenance store exists for research output |
|
||||
| Claim | Status | Where it stands |
|
||||
| ---------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `web_fetch` tool (URL → readable text) | **Implemented** | `internal/tools/webfetch/{tool.go,webfetch.go}`; registered in `internal/app/archied/bootstrap.go` `registerStandaloneTools`, disabled-by-config returns `nil` |
|
||||
| **Web search** (query → result list) | **Aspirational — zero code** | No search provider, no search tool, no config block anywhere in the tree or in `ai-sdk` v0.1.32 |
|
||||
| `agent.Subagent` — nested agent in a fresh context window | **Implemented** (dependency) | `github.com/samcharles93/ai-sdk@v0.1.32/agent/subagent.go`. Synchronous, non-streaming, own model/system/toolset, `MaxSteps` defaults to 10, nesting depth capped at 5, returns final text only |
|
||||
| Subagent used in production | **Implemented, one consumer** | `internal/app/agentworker/review.go` — the adversarial reviewer. That is the only non-test use of `Subagent` in the repo |
|
||||
| A **delegate/subagent tool** on the chat surface | **Aspirational — zero code** | No `subagent`/`delegate` tool name is registered anywhere |
|
||||
| **Fan-out orchestration** (N missions, one collator) | **Aspirational — zero code** | `agentloop`'s package doc states it runs _one_ mission: "orchestration across missions lives with the caller". No caller does this yet |
|
||||
| Parallel-safe tool execution | **Aspirational — zero code** | The unreachable `internal/tools/dispatch.go` dispatch/gating engine (`ExecutionClass`, `DispatchSequential`/`DispatchConcurrent`/`ClassifyEntry`) was deleted as dead code (tools-core-1); live concurrency is ai-sdk's `GenerateOptions.MaxParallelToolCalls`, which archie-core never sets |
|
||||
| Per-result caps + spill-to-disk | **Implemented** | `internal/agentexec/toolset.go` `ToolLimits{MaxResultChars,SpillDir}`, applied in `toolExecute` via `tools.CapPayload` (`limit.go`); no **aggregate** turn cap by design (`toolset.go`). `config.ToolPolicy.SpillDir`; default cap 50k chars, spill dir deliberately not defaulted |
|
||||
| Tool guardrails (repeat-failure / no-progress) | **Implemented, not on the call path** | `internal/tools/guardrail.go` engine exists. Its only non-test caller is `dispatchOne` — which is itself unreachable — so **the chat path never consults it**, and the agent path only records per _stage_ (`domain/workflow/agent.go`) |
|
||||
| Structured capture tools (model reports into a typed store, not prose) | **Implemented** | `internal/app/agentworker/review.go` `record_finding` / `record_checked` — `core.NewTypedTool` appending to a caller-owned slice. This is the pattern a research source ledger should reuse |
|
||||
| Curator engine (interval, declared tool set, lifecycle) | **Implemented, tools broken** | `internal/domain/curator`; a curator declaring tools is **refused** at registration (`registry.go`, no `ToolBuilder` implementation) and `curatorLLMRunner` (`internal/app/archied/main.go`) drops `ChatRequest.Tools`. Budgets are time+concurrency only (`runtime.go`) — **no token budget** |
|
||||
| Cron / scheduling + delivery router | **Implemented, wired into the daemon** | `internal/domain/scheduling` (ticker engine), `internal/infrastructure/cronstore` (schema v2, `Kind` discriminator), and `internal/infrastructure/crondelivery`; `internal/app/archied/scheduling.go` composes them and `main.go` starts the engine. |
|
||||
| Workflow engines (multi-stage, resumable) | **Implemented, worktree-bound** | `internal/domain/workflow` — every non-triage workflow opens with `StagePrepareWorktree()` and mounts `tc.Dir` into a container; the task persists after every stage (`workflow.go`). `triage.go` documents there is "no cheaper directory-less classification primitive" |
|
||||
| Long-running chat-initiated work with progress | **Partial** | Chat turns run **once, synchronously**, inline in the channel's turn runner (`internal/gateway/turn.go`). Chat can spawn a _workflow task_ (`task_spawn`) which is asynchronous — but that path is worktree/PR-shaped |
|
||||
| **Operator-push delivery of an async result** | **Aspirational — zero code** | Nothing pushes a finished result to a chat. No channel subscribes to the event bus (Telegram only _publishes_ `KindTurnCompleted`); `crondelivery.Courier` is the intended seam but has **no implementation and no caller**; `send_file` works only inside the live turn. The one out-of-band notification in the tree is feasibility's n8n webhook (`feasibility.go`) |
|
||||
| Citation storage / source ledger | **Aspirational — zero code** | No source, citation, or provenance store exists for research output |
|
||||
|
||||
> **Target state, not current state.** Everything marked aspirational below is
|
||||
> design, not a description of the daemon as it runs.
|
||||
|
||||
## Problem
|
||||
|
||||
Sam's requirement: *"Deep research should spawn 1 or many subagents for
|
||||
Sam's requirement: _"Deep research should spawn 1 or many subagents for
|
||||
exploration or research work. And they should collate all findings, they
|
||||
should use web search/fetch features."*
|
||||
should use web search/fetch features."_
|
||||
|
||||
None of the three primitives that sentence needs can be assembled from what
|
||||
ships:
|
||||
|
||||
1. **Web search does not exist.** `web_fetch` reads a URL you already have. A
|
||||
research loop's first act is to *discover* URLs from a query, and there is
|
||||
research loop's first act is to _discover_ URLs from a query, and there is
|
||||
no tool, provider, or config for that — in archie-core or in the shared SDK.
|
||||
2. **Nothing can fan out.** `agent.Subagent` can nest *one* nested generation,
|
||||
2. **Nothing can fan out.** `agent.Subagent` can nest _one_ nested generation,
|
||||
synchronously, and only the PR reviewer calls it. There is no N-way fan-out,
|
||||
no bounded concurrency, no shared budget across children, no collation pass.
|
||||
`agentloop` explicitly refuses to orchestrate: it runs one mission and the
|
||||
@@ -63,7 +63,7 @@ from spending unbounded money.
|
||||
|
||||
## What the run actually is
|
||||
|
||||
Six stages, each of which must be a *stage* rather than a prompt instruction:
|
||||
Six stages, each of which must be a _stage_ rather than a prompt instruction:
|
||||
|
||||
1. **Frame.** One cheap model call turns the request into a research brief: the
|
||||
question, 3..N distinct sub-questions, and a per-sub-question budget. Output
|
||||
@@ -72,12 +72,12 @@ Six stages, each of which must be a *stage* rather than a prompt instruction:
|
||||
2. **Fan out.** One subagent per sub-question, **in parallel**, with a bounded
|
||||
concurrency, each running a read-only research toolset (search + fetch +
|
||||
read) against its own fresh context window, each required to record its
|
||||
findings as *typed source records* before finishing, and each compressing
|
||||
findings as _typed source records_ before finishing, and each compressing
|
||||
what it returns.
|
||||
3. **Cross-check.** Deterministic, no model: group by canonical URL and by
|
||||
claim, flag single-sourced claims, mark conflicts. See D6.
|
||||
4. **Collate.** One model pass over the children's *conclusions and source
|
||||
records* — never their transcripts — that writes the report body against the
|
||||
4. **Collate.** One model pass over the children's _conclusions and source
|
||||
records_ — never their transcripts — that writes the report body against the
|
||||
pre-reconciled source set.
|
||||
5. **Citation pass.** Its own stage: validate every marker in the body resolves
|
||||
to a stored source, and every stored source was fetched successfully.
|
||||
@@ -98,8 +98,8 @@ peer-reviewed benchmarks), one on open-source deep-research implementations
|
||||
read at pinned commits. The findings that changed decisions:
|
||||
|
||||
**Only one fan-out unit buys capacity.** Four different units are in use:
|
||||
Anthropic fans out *agents with their own context windows*; Google fans out
|
||||
*queries*; Perplexity fans out *generated programs*; OpenAI uses pipeline-stage
|
||||
Anthropic fans out _agents with their own context windows_; Google fans out
|
||||
_queries_; Perplexity fans out _generated programs_; OpenAI uses pipeline-stage
|
||||
agents for query enrichment only. Query fan-out is cheap and buys breadth of
|
||||
retrieval; agent fan-out is what buys context capacity. Our step 2 is agent
|
||||
fan-out, deliberately, because context isolation is the thing a single GPU
|
||||
@@ -114,9 +114,9 @@ not a mapped merge.
|
||||
|
||||
**Citations are lost at the merge in 8 of 10 surveyed repos.** Only `lajosdeme/mole`
|
||||
assigns citation markers **mechanically in code before the prompt is built** —
|
||||
its `internal/output/report.go` carries the comment *"it cannot introduce a
|
||||
its `internal/output/report.go` carries the comment _"it cannot introduce a
|
||||
citation, because the citation markers are assigned mechanically before the
|
||||
prompt is built"* — and stores a verbatim `Quote` plus a `QuoteOffset` (byte
|
||||
prompt is built"_ — and stores a verbatim `Quote` plus a `QuoteOffset` (byte
|
||||
offset into the fetched document) so a citation can be re-verified later.
|
||||
Claims whose quote is not found in the source are dropped by code
|
||||
(`internal/actors/mine.go`: `"claim rejected: quote not found in source"`).
|
||||
@@ -137,7 +137,7 @@ Both are adopted here: D1 (store, not prose) and a citation pass that is its
|
||||
own stage.
|
||||
|
||||
**A cross-check stage that no vendor has.** Worker A and worker B never compare
|
||||
notes in any disclosed design, and nothing in the published set *resolves*
|
||||
notes in any disclosed design, and nothing in the published set _resolves_
|
||||
conflicts — Perplexity only "notes" them. Grouping findings by URL and by claim,
|
||||
flagging single-sourced claims, and marking unresolved conflicts is the
|
||||
cheapest correctness win available and is where a local implementation can beat
|
||||
@@ -152,28 +152,28 @@ same weights and KV budget, so **wall clock scales roughly linearly with worker
|
||||
count** — the isolation benefit survives, the throughput benefit does not. One
|
||||
instrumented study puts **web search at 73% of wall-clock time on average (up to
|
||||
91%)** (https://cseweb.ucsd.edu/~yiying/2025_NIPS_ERW_Deep_Research_Perf_Study.pdf),
|
||||
which is the argument for fanning out *retrieval* aggressively and *generation*
|
||||
which is the argument for fanning out _retrieval_ aggressively and _generation_
|
||||
sparingly, and for overlapping generation with retrieval.
|
||||
|
||||
**Frontier citation volume is not a target.** Frontier runs emit 41-113
|
||||
citation URLs per query, while 3-13% of citation URLs are hallucinated and "more
|
||||
citations per query do not mean fewer errors per citation"
|
||||
(https://arxiv.org/abs/2604.03173). Ten to twenty *verified* citations is a
|
||||
(https://arxiv.org/abs/2604.03173). Ten to twenty _verified_ citations is a
|
||||
defensible, evidence-backed target.
|
||||
|
||||
**Do not port Perplexity's style.** Search-as-code-generation needs
|
||||
frontier-class codegen against a bespoke SDK and an atomised self-owned search
|
||||
stack. Port the *intent* — deterministic fan-out, dedupe and filter in code
|
||||
stack. Port the _intent_ — deterministic fan-out, dedupe and filter in code
|
||||
before anything reaches a model — and leave the code generation to the Go
|
||||
orchestrator.
|
||||
|
||||
## Architecture: three candidate shapes
|
||||
|
||||
| # | Shape | Where a run starts | Durability | New code | Cost |
|
||||
|---|---|---|---|---|---|
|
||||
| **A** | New capability family `internal/domain/research` + `infrastructure/research`, typed engine, owning registry, lifecycle, background run, completion delivered through an injected courier | A chat tool `research_start` returns a run id | Runs survive the turn; progress observable; resumable | Domain + infra + store + wiring + UI + config | Largest |
|
||||
| **B** | A fourth cron job kind (`KindResearch`) in `crondelivery`, reusing `scheduling` + `cronstore` + the delivery router | Chat enqueues a one-shot immediate job | Same store and delivery as cron; no new persistence | Runner + kind + blueprint only | Medium — but fakes "on demand" as a scheduled job, and a job store keyed on a schedule is the wrong shape for a request |
|
||||
| **C** | A `deep_research` **tool** that runs the whole fan-out synchronously inside one chat turn, using `agent.Subagent` for the children | Directly — the model calls the tool | None: the run dies with the turn | Search seam + tool + fan-out helper | Smallest |
|
||||
| # | Shape | Where a run starts | Durability | New code | Cost |
|
||||
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| **A** | New capability family `internal/domain/research` + `infrastructure/research`, typed engine, owning registry, lifecycle, background run, completion delivered through an injected courier | A chat tool `research_start` returns a run id | Runs survive the turn; progress observable; resumable | Domain + infra + store + wiring + UI + config | Largest |
|
||||
| **B** | A fourth cron job kind (`KindResearch`) in `crondelivery`, reusing `scheduling` + `cronstore` + the delivery router | Chat enqueues a one-shot immediate job | Same store and delivery as cron; no new persistence | Runner + kind + blueprint only | Medium — but fakes "on demand" as a scheduled job, and a job store keyed on a schedule is the wrong shape for a request |
|
||||
| **C** | A `deep_research` **tool** that runs the whole fan-out synchronously inside one chat turn, using `agent.Subagent` for the children | Directly — the model calls the tool | None: the run dies with the turn | Search seam + tool + fan-out helper | Smallest |
|
||||
|
||||
**Recommendation: ship C's machinery, then promote it to A.** Slice 2 (below)
|
||||
builds the orchestrator as a tool because that is the smallest thing that
|
||||
@@ -183,29 +183,29 @@ runtime cost and shape are known from real use — which is exactly the order
|
||||
AGENTS.md's solo-project rule asks for ("prefer the smallest workable change"),
|
||||
and it avoids inventing persistence for a shape that has not been exercised.
|
||||
|
||||
Shape B is rejected as the primary path: `cronstore.JobSpec` is a *schedule*
|
||||
Shape B is rejected as the primary path: `cronstore.JobSpec` is a _schedule_
|
||||
(cron expression, next-run, catch-up); an on-demand research request is not.
|
||||
Reusing it would mean every ad-hoc research run leaves a permanent job row.
|
||||
|
||||
### Where the pieces live (shape C, then A)
|
||||
|
||||
| Piece | Home | Contract |
|
||||
|---|---|---|
|
||||
| Search provider seam | `internal/domain/research` (interface) + `internal/infrastructure/research/search/<provider>` (impls) | `Searcher.Search(ctx, query, opts) ([]Result, error)`; `Result{URL, Title, Snippet, RetrievedAt}`. Consumer-owned and one-method, per the `crondelivery.Courier` precedent — nothing here talks to a network |
|
||||
| `web_search` tool | `internal/tools/search` | Mirrors `internal/tools/webfetch`: `Tool(cfg) *tools.ToolEntry`, returns `nil` when disabled, `ClassIdempotent`, `Toolset: "web"` |
|
||||
| Source store | `internal/domain/research` entity + store | `Source{ID, URL, CanonicalURL, Title, RetrievedAt, Hash, State(ok/failed/duplicate), CitedBy []subq}` |
|
||||
| Fan-out orchestrator | `internal/domain/research` (pure) with the model/tool access injected | Bounded worker pool over sub-questions; per-child `agent.Subagent`-shaped `Researcher` seam; shared step/token/wall-clock budget |
|
||||
| Collator | `internal/domain/research` | Model pass over `[]ChildConclusion` + source store → report body |
|
||||
| Report renderer | `internal/domain/research` | Markdown + numbered citation list rendered **from the store** |
|
||||
| Chat trigger | slice 2: `internal/tools/research`; slice 3: gateway tool + courier in `internal/app/archied` | — |
|
||||
| Durable run + delivery (slice 3) | `internal/domain/research` + `internal/infrastructure/research` + `internal/app/archied` wiring | Follows the strict plugin-engine rule in `docs/architecture/plugins-and-extensions.md` ("Plugin engine
|
||||
rule (strict)"): typed contract, owning registry with start/health/stop, narrow typed registrar |
|
||||
| Piece | Home | Contract |
|
||||
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Search provider seam | `internal/domain/research` (interface) + `internal/infrastructure/research/search/<provider>` (impls) | `Searcher.Search(ctx, query, opts) ([]Result, error)`; `Result{URL, Title, Snippet, RetrievedAt}`. Consumer-owned and one-method, per the `crondelivery.Courier` precedent — nothing here talks to a network |
|
||||
| `web_search` tool | `internal/tools/search` | Mirrors `internal/tools/webfetch`: `Tool(cfg) *tools.ToolEntry`, returns `nil` when disabled, `ClassIdempotent`, `Toolset: "web"` |
|
||||
| Source store | `internal/domain/research` entity + store | `Source{ID, URL, CanonicalURL, Title, RetrievedAt, Hash, State(ok/failed/duplicate), CitedBy []subq}` |
|
||||
| Fan-out orchestrator | `internal/domain/research` (pure) with the model/tool access injected | Bounded worker pool over sub-questions; per-child `agent.Subagent`-shaped `Researcher` seam; shared step/token/wall-clock budget |
|
||||
| Collator | `internal/domain/research` | Model pass over `[]ChildConclusion` + source store → report body |
|
||||
| Report renderer | `internal/domain/research` | Markdown + numbered citation list rendered **from the store** |
|
||||
| Chat trigger | slice 2: `internal/tools/research`; slice 3: gateway tool + courier in `internal/app/archied` | — |
|
||||
| Durable run + delivery (slice 3) | `internal/domain/research` + `internal/infrastructure/research` + `internal/app/archied` wiring | Follows the strict plugin-engine rule in `docs/architecture/plugins-and-extensions.md` ("Plugin engine |
|
||||
| rule (strict)"): typed contract, owning registry with start/health/stop, narrow typed registrar |
|
||||
|
||||
### Why not the curator
|
||||
|
||||
The curator family already looks like the right home — a declared interval, a
|
||||
declared tool set, an owning registry, per-pass budgets and panic isolation.
|
||||
Two facts rule it out as the host for *this*:
|
||||
Two facts rule it out as the host for _this_:
|
||||
|
||||
- **Its tool path does not work.** A curator declaring tools is refused
|
||||
registration because `ToolBuilder` has no implementation, and even if it were
|
||||
@@ -216,7 +216,7 @@ Two facts rule it out as the host for *this*:
|
||||
curators as periodic peers reasoning over memory. A deep-research run is
|
||||
operator-initiated work with a deliverable, on the operator's clock.
|
||||
|
||||
A research *curator* is a legitimate later idea — "research this standing topic
|
||||
A research _curator_ is a legitimate later idea — "research this standing topic
|
||||
weekly" — but it is a consumer of this capability, not its foundation.
|
||||
|
||||
## Decisions this design takes
|
||||
@@ -226,7 +226,7 @@ weekly" — but it is a consumer of this capability, not its foundation.
|
||||
Each subagent gets a `record_source` typed tool (the `record_finding` pattern,
|
||||
`review.go`) whose handler canonicalises the URL, deduplicates against the
|
||||
store, marks which sub-question recorded it, and appends. The collator may
|
||||
*select and order* sources; it may not author them. Rendering the reference
|
||||
_select and order_ sources; it may not author them. Rendering the reference
|
||||
list is then a pure function of the store.
|
||||
|
||||
The strongest prior art goes further, and one step of it is worth adopting:
|
||||
@@ -237,7 +237,7 @@ each claim, and drop any claim whose quote cannot be found in the source
|
||||
"the model said so" into a re-checkable "the document says so, at offset N", and
|
||||
it makes citation re-verification cheap rather than a second research run.
|
||||
|
||||
*Rejected alternative:* require the child to end with a JSON block of sources
|
||||
_Rejected alternative:_ require the child to end with a JSON block of sources
|
||||
and parse it. A parse failure loses every source in the child's run, and a
|
||||
model that reformats its output for readability silently drops citations.
|
||||
|
||||
@@ -267,14 +267,14 @@ serialised, expensive half.
|
||||
`Subagent.Run` sends a prompt and returns a string; the parent's history is
|
||||
never passed down and the child's is never returned. That is the property that
|
||||
makes N children affordable at all — the parent's context grows by N
|
||||
conclusions, not N conversations. This is also why collation is a *separate
|
||||
pass* rather than an accumulating agent loop: the collator is the only place
|
||||
conclusions, not N conversations. This is also why collation is a _separate
|
||||
pass_ rather than an accumulating agent loop: the collator is the only place
|
||||
that must hold all N conclusions, and it holds nothing else.
|
||||
|
||||
Each child compresses its own findings before returning, so what crosses the
|
||||
boundary is a summary, not a transcript. Anthropic names the same pattern
|
||||
(filesystem artefacts with lightweight references back) and Perplexity arrived
|
||||
at it independently; it is the one disclosed primitive that *increases*
|
||||
at it independently; it is the one disclosed primitive that _increases_
|
||||
effective capacity without a bigger context window.
|
||||
|
||||
### D4. Search is a provider seam with no silent default
|
||||
@@ -282,7 +282,7 @@ effective capacity without a bigger context window.
|
||||
`web_search` is registered only when a provider resolves, following two
|
||||
existing conventions: return `nil` for a disabled capability
|
||||
(`webfetch/tool.go` — "an advertised tool that never works costs a round
|
||||
trip") and resolve the credential *before* registering
|
||||
trip") and resolve the credential _before_ registering
|
||||
(`registerMinimaxTool`, `bootstrap.go`). At least two implementations are
|
||||
wanted — a self-hosted meta-search endpoint (no per-query cost, no data egress)
|
||||
and one hosted API (quality fallback) — behind the same one-method interface,
|
||||
@@ -298,13 +298,13 @@ cannot tell a negative finding from a missing one.
|
||||
### D6. Two stages no surveyed design has: a mechanical cross-check and a separate citation pass
|
||||
|
||||
Children never compare notes in any disclosed design, and nothing in the
|
||||
published set *resolves* conflicts — Perplexity only "notes" them. Because
|
||||
published set _resolves_ conflicts — Perplexity only "notes" them. Because
|
||||
84.7% of final-report errors originate at the orchestrator (mostly citation
|
||||
errors), both gaps are worth closing in code rather than in a prompt:
|
||||
|
||||
- **Cross-check (deterministic, no model).** Group findings by canonical URL and
|
||||
by claim. Flag single-sourced claims, mark unresolved conflicts explicitly,
|
||||
and count sources per sub-question. This runs *before* the collator, so the
|
||||
and count sources per sub-question. This runs _before_ the collator, so the
|
||||
collator receives a pre-reconciled set rather than raw prose to untangle.
|
||||
- **Citation pass (its own stage, after collation).** Anthropic runs synthesis
|
||||
and then a separate CitationAgent. Here the pass is cheaper for being partly
|
||||
@@ -312,7 +312,7 @@ errors), both gaps are worth closing in code rather than in a prompt:
|
||||
source, and that every stored source was actually fetched successfully.
|
||||
|
||||
Both stages are small, both are testable without a model, and together they are
|
||||
where this implementation can be *better* than the frontier products rather
|
||||
where this implementation can be _better_ than the frontier products rather
|
||||
than an imitation of them. A run that is expected to emit 10-20 well-verified
|
||||
citations rather than 41-113 partly-unverified ones is making a deliberate,
|
||||
evidence-supported trade.
|
||||
@@ -340,7 +340,7 @@ evidence-supported trade.
|
||||
## Failure and security paths
|
||||
|
||||
- **SSRF.** Search results are attacker-influenceable (a page can rank for a
|
||||
query). `web_fetch` already vets the *resolved address* at dial time with
|
||||
query). `web_fetch` already vets the _resolved address_ at dial time with
|
||||
`AllowPrivateNetworks` off, which is the property to preserve — a search
|
||||
tool must not become a way to reach the daemon's own control surfaces by
|
||||
returning an internal URL.
|
||||
|
||||
@@ -11,24 +11,24 @@
|
||||
|
||||
Every claim in this document is mapped to what exists in the tree.
|
||||
|
||||
| Claim | Status | Where it stands |
|
||||
|---|---|---|
|
||||
| Curator engine family: typed contract, owning registry, start/health/stop, narrow host access | **Implemented** | `internal/domain/curator/{contract,registry,runtime,registrar,activity,wake}.go` |
|
||||
| Curator declared shape (`Manifest`: interval, cooldown, on_input, tools, skills, memory engine, conversations, model) | **Implemented** | `internal/domain/curator/contract.go`; `Validate()` requires `Interval > 0` |
|
||||
| Two reference curators run through the registry | **Implemented** | `internal/infrastructure/skillcurator`, `internal/infrastructure/sessioncurator` |
|
||||
| Curator definitions as persisted, API-editable data | **Aspirational -- zero code** | No table, no entity, no RPC, no config block |
|
||||
| Generic definition-driven engine that executes a declared tool set + free-form instructions | **Aspirational -- zero code** | Only the two code-registered curators exist |
|
||||
| `Registrar.Tools` (`ToolBuilder`) resolved and bound at registration | **Partial** | Interface declared (`registrar.go`); **no implementation anywhere**; `bootstrap.go` builds the `Registrar` with no `Tools` field |
|
||||
| A curator can declare tools at all | **Partial** | `Manifest.Tools` exists, but `registry.go` fails registration with `"curator manifest: declares tools but the registrar has no ToolBuilder"` |
|
||||
| Curator passes that actually reach a model with tools | **Cosmetic only** | `curator.ChatRequest` carries `Tools`/`MaxSteps`; `curatorLLMRunner` (`internal/app/archied/main.go`) drops both and returns `ChatResult{Text}` only |
|
||||
| Dynamic registration / removal (no restart) | **Aspirational -- zero code** | `Registry` has `Register`, no `Unregister`; `Runtime` has `Start`/`Nudge`/`Stop`, no `Add`/`Remove`; `Start()` snapshots membership |
|
||||
| Curator definition CRUD over REST | **Partial** | `GET /api/curators` read-only (`internal/webui/server.go`); no write routes |
|
||||
| Curator definition config | **Aspirational -- zero code** | No `[curator]` block in `internal/config/config.go` |
|
||||
| Store/API as definition authority | **Aspirational -- zero code** | No curator persistence of any kind |
|
||||
| No live-path defaults for interval/cooldown/tools/model/memory engine | **Partial** | `skillcurator.DefaultInterval` / `sessioncurator.DefaultInterval` are Go consts read at registration; `curator.NewRuntime(..., RuntimeConfig{})` uses code defaults for pass timeout and concurrency |
|
||||
| Idle curators are observable in logs | **Partial** | `runtime.go` logs nothing when `Check` reports not-due; the session-memory curator's hourly pass is the only curator activity ever logged |
|
||||
| Sampler family | **Implemented** | `internal/domain/sampling`, shipped; no curator consumes a `Sampler` yet |
|
||||
| Forge/issue reach from chat | **Implemented** (via `shell`) | No dedicated issue tool exists, but the chat agent's `shell` is unconfined (`chat.unrestricted_filesystem = true`), so `gh issue edit|comment|create|close` works. Dedicated tools (#161) are convenience, not a blocker |
|
||||
| Claim | Status | Where it stands |
|
||||
| --------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Curator engine family: typed contract, owning registry, start/health/stop, narrow host access | **Implemented** | `internal/domain/curator/{contract,registry,runtime,registrar,activity,wake}.go` |
|
||||
| Curator declared shape (`Manifest`: interval, cooldown, on_input, tools, skills, memory engine, conversations, model) | **Implemented** | `internal/domain/curator/contract.go`; `Validate()` requires `Interval > 0` |
|
||||
| Two reference curators run through the registry | **Implemented** | `internal/infrastructure/skillcurator`, `internal/infrastructure/sessioncurator` |
|
||||
| Curator definitions as persisted, API-editable data | **Aspirational -- zero code** | No table, no entity, no RPC, no config block |
|
||||
| Generic definition-driven engine that executes a declared tool set + free-form instructions | **Aspirational -- zero code** | Only the two code-registered curators exist |
|
||||
| `Registrar.Tools` (`ToolBuilder`) resolved and bound at registration | **Partial** | Interface declared (`registrar.go`); **no implementation anywhere**; `bootstrap.go` builds the `Registrar` with no `Tools` field |
|
||||
| A curator can declare tools at all | **Partial** | `Manifest.Tools` exists, but `registry.go` fails registration with `"curator manifest: declares tools but the registrar has no ToolBuilder"` |
|
||||
| Curator passes that actually reach a model with tools | **Cosmetic only** | `curator.ChatRequest` carries `Tools`/`MaxSteps`; `curatorLLMRunner` (`internal/app/archied/main.go`) drops both and returns `ChatResult{Text}` only |
|
||||
| Dynamic registration / removal (no restart) | **Aspirational -- zero code** | `Registry` has `Register`, no `Unregister`; `Runtime` has `Start`/`Nudge`/`Stop`, no `Add`/`Remove`; `Start()` snapshots membership |
|
||||
| Curator definition CRUD over REST | **Partial** | `GET /api/curators` read-only (`internal/webui/server.go`); no write routes |
|
||||
| Curator definition config | **Aspirational -- zero code** | No `[curator]` block in `internal/config/config.go` |
|
||||
| Store/API as definition authority | **Aspirational -- zero code** | No curator persistence of any kind |
|
||||
| No live-path defaults for interval/cooldown/tools/model/memory engine | **Partial** | `skillcurator.DefaultInterval` / `sessioncurator.DefaultInterval` are Go consts read at registration; `curator.NewRuntime(..., RuntimeConfig{})` uses code defaults for pass timeout and concurrency |
|
||||
| Idle curators are observable in logs | **Partial** | `runtime.go` logs nothing when `Check` reports not-due; the session-memory curator's hourly pass is the only curator activity ever logged |
|
||||
| Sampler family | **Implemented** | `internal/domain/sampling`, shipped; no curator consumes a `Sampler` yet |
|
||||
| Forge/issue reach from chat | **Implemented** (via `shell`) | No dedicated issue tool exists, but the chat agent's `shell` is unconfined (`chat.unrestricted_filesystem = true`), so `gh issue edit | comment | create | close` works. Dedicated tools (#161) are convenience, not a blocker |
|
||||
|
||||
> **Target state, not current state.** Everything below marked aspirational is
|
||||
> design, not a description of the daemon as it runs.
|
||||
@@ -44,9 +44,9 @@ daemon's model adapter drops the tools even if it were bound. The curator family
|
||||
therefore has exactly one shape (cheap, tool-less maintenance pass) and its only
|
||||
extension point is compiling Go.
|
||||
|
||||
Sam's requirement is the opposite: *"Curators should be dynamically created and
|
||||
defined, in addition to being able to be defined in code/config/webui"* and *"No
|
||||
configuration should ever be hard-coded."* The motivating consumer is a
|
||||
Sam's requirement is the opposite: _"Curators should be dynamically created and
|
||||
defined, in addition to being able to be defined in code/config/webui"_ and _"No
|
||||
configuration should ever be hard-coded."_ The motivating consumer is a
|
||||
project/orchestrator curator -- declared as data, given forge issue tools, and
|
||||
pointed at a repo to review, refine, and propose issues.
|
||||
|
||||
@@ -60,11 +60,11 @@ skills, memory engine, conversations, and model, and `Validate()` already
|
||||
enforces what a valid shape means. The definition adds only what `Manifest`
|
||||
cannot express:
|
||||
|
||||
| Definition field | Relationship to `Manifest` |
|
||||
|---|---|
|
||||
| `name`, `enabled` | Identity and lifecycle; the registry's key is the name |
|
||||
| `instructions` | **Free-form** system prompt for the generic engine -- the piece that makes a definition more than a knob set |
|
||||
| interval, cooldown, on_input, tools, skills, memory_engine, conversations, model | The existing `Manifest` fields verbatim; the definition **is** a `Manifest` |
|
||||
| Definition field | Relationship to `Manifest` |
|
||||
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `name`, `enabled` | Identity and lifecycle; the registry's key is the name |
|
||||
| `instructions` | **Free-form** system prompt for the generic engine -- the piece that makes a definition more than a knob set |
|
||||
| interval, cooldown, on_input, tools, skills, memory_engine, conversations, model | The existing `Manifest` fields verbatim; the definition **is** a `Manifest` |
|
||||
|
||||
Code-registered engines keep `CuratorEngine` unchanged. A data-defined curator is
|
||||
served by one registered engine whose `Manifest()` is the stored definition and
|
||||
@@ -78,11 +78,11 @@ This is the curator domain's missing half, not a standalone tool: it lands in
|
||||
|
||||
Three sources, per Sam's requirement. **The store is authoritative.**
|
||||
|
||||
| Source | Role | Collision behaviour |
|
||||
|---|---|---|
|
||||
| Source | Role | Collision behaviour |
|
||||
| --------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **Code** (a registered Go engine) | The escape hatch: a curator whose strategy is Go, not tools+instructions | Wins over data for its own name -- a data definition cannot silently replace a compiled engine; the store refuses the collision and logs it |
|
||||
| **Config** (`[[curators]]`) | **Seed data only**, merged at startup | Insert-if-absent. A store row of the same name is never overwritten, and deleting a store row is not undone by config on the next boot |
|
||||
| **WebUI/API** (the store) | **Authoritative** | Wins over config on a name collision; the only source of truth after first boot |
|
||||
| **Config** (`[[curators]]`) | **Seed data only**, merged at startup | Insert-if-absent. A store row of the same name is never overwritten, and deleting a store row is not undone by config on the next boot |
|
||||
| **WebUI/API** (the store) | **Authoritative** | Wins over config on a name collision; the only source of truth after first boot |
|
||||
|
||||
Config existing at all is what makes a definition reproducible on a fresh host;
|
||||
making it authoritative would make the API a lie, so it is seed data with a
|
||||
@@ -135,11 +135,11 @@ must not block removal forever.
|
||||
|
||||
Mirror `internal/webui/api_binding.go`, not a new pattern:
|
||||
|
||||
| Route | Handler shape |
|
||||
|---|---|
|
||||
| `GET /api/curators` | Existing read-only list, fields unchanged (dashboard keeps working) |
|
||||
| `POST /api/curators` | `handleCuratorCreate` |
|
||||
| `GET /api/curators/{id}` / `PATCH` / `DELETE` | `handleCuratorGet` / `Update` / `Delete` |
|
||||
| Route | Handler shape |
|
||||
| --------------------------------------------- | ------------------------------------------------------------------- |
|
||||
| `GET /api/curators` | Existing read-only list, fields unchanged (dashboard keeps working) |
|
||||
| `POST /api/curators` | `handleCuratorCreate` |
|
||||
| `GET /api/curators/{id}` / `PATCH` / `DELETE` | `handleCuratorGet` / `Update` / `Delete` |
|
||||
|
||||
All mutations behind `authorizeTaskMutation`, same as bindings and mappings. A
|
||||
successful mutation goes through the runtime apply path above, so it is live
|
||||
@@ -153,11 +153,11 @@ and Gateway never open it (`TestOpenStoresNeverOwnsTaskDB` guards this), and
|
||||
contract. AGENTS.md forbids adding a Go interface method without a matching RPC.
|
||||
That fixes the order:
|
||||
|
||||
| Phase | Ships | Proto work |
|
||||
|---|---|---|
|
||||
| 1. Engine + config source | `ToolBuilder`, tool-carrying passes, generic engine, `[[curators]]`, idle logging | None -- nothing persisted yet |
|
||||
| 2. Runtime mutation | `Unregister`, `Add`/`Remove`, apply path | None -- in-memory membership |
|
||||
| 3. Persistence | definition entity + store schema, config seed (store authoritative), REST CRUD | **Same change**: request/response messages + RPCs, `staterpc.Client` façade, `mapError`/`unmapError`, and an update to `docs/prds/state-store-contract.md` |
|
||||
| Phase | Ships | Proto work |
|
||||
| ------------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1. Engine + config source | `ToolBuilder`, tool-carrying passes, generic engine, `[[curators]]`, idle logging | None -- nothing persisted yet |
|
||||
| 2. Runtime mutation | `Unregister`, `Add`/`Remove`, apply path | None -- in-memory membership |
|
||||
| 3. Persistence | definition entity + store schema, config seed (store authoritative), REST CRUD | **Same change**: request/response messages + RPCs, `staterpc.Client` façade, `mapError`/`unmapError`, and an update to `docs/prds/state-store-contract.md` |
|
||||
|
||||
Phases 1 and 2 are genuinely independent of the wire boundary, so they are not
|
||||
blocked on it. Phase 3 is where the boundary is unavoidable: a definition the
|
||||
@@ -184,7 +184,7 @@ stop being read at registration (the value becomes seed data), and
|
||||
the same authority as bindings -- not exposed on the chat tool surface.
|
||||
- **No dashboard SPA editor page.** The REST surface is the WebUI definition
|
||||
source; the dashboard can adopt it separately.
|
||||
- **No forge issue tools here.** This design only ensures a curator *can declare*
|
||||
- **No forge issue tools here.** This design only ensures a curator _can declare_
|
||||
tools. Dedicated issue tools (#161) are a convenience, not a prerequisite: the
|
||||
chat agent already reaches issues through the unconfined `shell` tool
|
||||
(`gh issue edit|comment|create|close`). See the correction on #789.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
**Status:** Finalised
|
||||
|
||||
Epic: archie-core-enfj. Scope: give `workflow.Route()` a real, content-aware
|
||||
fallback instead of unconditionally defaulting every unlabeled task to the
|
||||
fallback instead of unconditionally defaulting every unlabelled task to the
|
||||
heaviest workflow.
|
||||
|
||||
## Problem
|
||||
@@ -17,8 +17,8 @@ since `task_spawn` rarely sets labels — falls straight through to
|
||||
commit-push → review → open-pr` pipeline, regardless of what the task
|
||||
actually asks for.
|
||||
|
||||
`task_spawn`'s own tool schema overpromises: *"workflow: … Omit to let the
|
||||
daemon route it"* (`internal/gateway/task_tools.go`) implies real
|
||||
`task_spawn`'s own tool schema overpromises: _"workflow: … Omit to let the
|
||||
daemon route it"_ (`internal/gateway/task_tools.go`) implies real
|
||||
routing exists. It doesn't — "route" means "check labels, then
|
||||
give up and run the heaviest workflow anyway."
|
||||
|
||||
@@ -26,7 +26,7 @@ Confirmed in production: a chat-spawned task whose
|
||||
entire content was "this is just a test, close it when you receive it" ran
|
||||
the full `implement` pipeline end to end — 669,421 tokens, ~7 minutes —
|
||||
when nothing about the request needed a worktree-driven build at all. The
|
||||
`plan` stage's own LLM output *correctly* concluded no code change was
|
||||
`plan` stage's own LLM output _correctly_ concluded no code change was
|
||||
needed, but that conclusion arrives two expensive stages (`baseline`,
|
||||
`plan`) too late to save anything.
|
||||
|
||||
@@ -39,7 +39,7 @@ task immediately or hands off to the workflow the task actually needs.
|
||||
`implement` fallback — a two-line change, fully backward compatible when
|
||||
`triage` isn't wired up.
|
||||
|
||||
Triage does **not** replace label-based routing. A labeled task
|
||||
Triage does **not** replace label-based routing. A labelled task
|
||||
(`bug`/`feature`/bootstrap) already has a free, reliable signal and goes
|
||||
straight to its known workflow unchanged — spending a classification
|
||||
call there would be pure waste. Triage only fires in the gap that
|
||||
@@ -76,7 +76,7 @@ production incident: a no-op request now costs one classification call
|
||||
|
||||
`needs_code_change: true` → sets `tc.Task.Workflow` to the classifier's
|
||||
chosen workflow (`implement`/`tdd`/`feasibility`, defaulting to
|
||||
`implement` if the field is missing or unrecognized) and an Outcome that
|
||||
`implement` if the field is missing or unrecognised) and an Outcome that
|
||||
requeues the task under it, the same requeue mechanism
|
||||
`chatTaskControllerAdapter.ApproveChatTask` already uses
|
||||
(`main.go`, `requeue(ctx, taskID, fromStatus, workflow)`). The task then
|
||||
@@ -87,7 +87,7 @@ classification twice for the same task.
|
||||
### Non-goals (v1)
|
||||
|
||||
- Full bug/feature intent classification quality — the classifier only
|
||||
needs to be *directionally* right; a wrong `tdd` vs `implement` call
|
||||
needs to be _directionally_ right; a wrong `tdd` vs `implement` call
|
||||
still produces a working PR, just via a slightly less-tailored pipeline.
|
||||
Tightening this is a follow-up, not a blocker.
|
||||
- Any change to label-based routing, `Route()`'s explicit-workflow branch,
|
||||
@@ -99,7 +99,7 @@ classification twice for the same task.
|
||||
## Testing
|
||||
|
||||
- `workflow_test.go`: `Route()` picks `reg["triage"]` over `reg["implement"]`
|
||||
for an unlabeled task when both are registered; falls back to
|
||||
for an unlabelled task when both are registered; falls back to
|
||||
`reg["implement"]` unchanged when `triage` isn't registered (regression
|
||||
guard for every existing `Route()` test).
|
||||
- New `triage_test.go`: classify → `needs_code_change: false` closes
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"Which workflow runs for which trigger" is hardcoded Go: a literal
|
||||
label vocabulary (`workintake.labelKinds`) and a literal label->workflow map
|
||||
(`workflow/routing.go`), extended only by adding a Go case or shipping a
|
||||
skill whose `metadata.archie.workflow` overrides one *named* built-in
|
||||
skill whose `metadata.archie.workflow` overrides one _named_ built-in
|
||||
workflow. Extending the system to a new trigger, a new action, or a new
|
||||
event source means a feature branch, a code change in a hardcoded
|
||||
path, and new Go tests -- for every addition. That is the barrier this
|
||||
@@ -50,10 +50,10 @@ long as it's implemented behind one of the typed engine families below.
|
||||
- Yaegi is already a proven in-process extension mechanism
|
||||
(`internal/plugin`, `internal/domain/workflow/wfeval/yaegi.go`,
|
||||
`internal/gate/gateeval/yaegi.go`, `internal/skill/plugin.go`) -- this
|
||||
design generalizes its existing role, it does not introduce a new
|
||||
design generalises its existing role, it does not introduce a new
|
||||
execution mechanism.
|
||||
- `internal/domain/workflow/skillbuild.BuildRegistry` already composes a
|
||||
`workflow.Registry` from a skills catalog, plugin-defined overriding
|
||||
`workflow.Registry` from a skills catalogue, plugin-defined overriding
|
||||
built-in. The playbook loader described here supersedes label routing
|
||||
specifically; it does not replace `skillbuild`'s workflow-composition role,
|
||||
it becomes an additional input the daemon composes at startup.
|
||||
@@ -142,7 +142,7 @@ A playbook declares no embedded logic -- only:
|
||||
|
||||
Playbooks live in a configured directory (repo/directory-scoped, per Sam's
|
||||
"define repos, directories, playbooks" framing) and are loaded at archied
|
||||
startup, alongside the existing skills-catalog composition.
|
||||
startup, alongside the existing skills-catalogue composition.
|
||||
|
||||
## Dedup: detect and log, no arbitration mechanism
|
||||
|
||||
@@ -159,7 +159,7 @@ a case that should just be visible and fixed by a human. Instead:
|
||||
only. The schema is the definition; a schema conflict is a reported
|
||||
failure, not something the daemon silently arbitrates.
|
||||
- **Linter**: a CI/dev-time tool, reading the same generated schemas, that
|
||||
flags duplicate or conflicting trigger definitions *within* a single
|
||||
flags duplicate or conflicting trigger definitions _within_ a single
|
||||
maintained tree before merge.
|
||||
|
||||
**Resolved** (`archie-core-t2db.12`). A standalone
|
||||
@@ -173,8 +173,9 @@ a case that should just be visible and fixed by a human. Instead:
|
||||
lints an `eda_playbook_dir` the same way, through `playbook.Load` with its
|
||||
CEL, action-id and args checks.
|
||||
Discoverable via `task lint:playbooks` or direct `go run
|
||||
./cmd/archie-playbooks lint -dir ...`. The LSP/serve mode is a later
|
||||
./cmd/archie-playbooks lint -dir ...`. The LSP/serve mode is a later
|
||||
entrypoint of the SAME binary, per the shared-package decision above.
|
||||
|
||||
- **LSP**: same schema source again, feeding author-time hover/completion/
|
||||
inline errors while someone edits a playbook YAML in an editor. Kept
|
||||
explicitly in scope per Sam (not deferred), because it's the same schema
|
||||
@@ -199,6 +200,7 @@ The validation logic (`LoadKindWorkflowsYAML`, `LoadLabelWorkflowsYAML`, the
|
||||
directory-merge from t2db.11) lives in `internal/domain/workflow`, a plain
|
||||
Go package with no knowledge of which binary calls it. This makes "should
|
||||
the linter/LSP be bundled into archied or a separate tool" a non-question:
|
||||
|
||||
- `archied` already imports the package directly and validates in-process
|
||||
at startup -- no subprocess, no external tool call.
|
||||
- An agent that needs to validate a playbook in-process can import the same
|
||||
@@ -216,8 +218,8 @@ narrow capability families.
|
||||
|
||||
## Execution-time gaps (both resolved)
|
||||
|
||||
Everything above covers *loading* a playbook. Nothing above covers what
|
||||
happens while one *runs*. Two gaps, both load-bearing enough to resolve
|
||||
Everything above covers _loading_ a playbook. Nothing above covers what
|
||||
happens while one _runs_. Two gaps, both load-bearing enough to resolve
|
||||
before implementation, not defer:
|
||||
|
||||
### 1. Mid-playbook action failure
|
||||
@@ -254,7 +256,7 @@ are the complete decision.
|
||||
against clever automatic recovery, and it is now a stated decision
|
||||
rather than a nobody-chose default.
|
||||
2. **Interruption** (the daemon is shutting down mid-dispatch, `ctx.Err()
|
||||
!= nil`) is explicitly **not** a failure. `Run` already treats this
|
||||
!= nil`) is explicitly **not** a failure. `Run` already treats this
|
||||
case specially -- "Daemon shutdown is not a workflow failure. Leave
|
||||
the task running ...; parking here would publish a false failure and
|
||||
require manual intervention" (`workflow.go`) -- and the same
|
||||
@@ -263,7 +265,7 @@ are the complete decision.
|
||||
alone for restart" means for a playbook run (there is no `store.Task`
|
||||
row a playbook run inherently owns the way a workflow stage does) is
|
||||
an open implementation detail for whoever builds the coordinator, not
|
||||
decided here -- but the *semantic* (interruption ≠ failure) is decided.
|
||||
decided here -- but the _semantic_ (interruption ≠ failure) is decided.
|
||||
3. **A run that produces no outcome at all** (every action ran without
|
||||
error, but nothing was assigned to happen) is itself an error
|
||||
condition, matching `Run`'s own "a workflow must end with an explicit
|
||||
@@ -276,7 +278,7 @@ are the complete decision.
|
||||
gap's own description named -- a posted forge comment is not revocable.
|
||||
This is not a limitation to work around later; it is the correct
|
||||
semantic. An operator who needs a corrective action after a failure
|
||||
writes a *new* playbook/action for that, they do not get automatic
|
||||
writes a _new_ playbook/action for that, they do not get automatic
|
||||
undo.
|
||||
|
||||
**This stays inside the producer-only rule.** Stop-on-first-failure is the
|
||||
@@ -322,11 +324,11 @@ than assumed, because it changes what the answer must be:
|
||||
**`PublishUnique`'s dedup is not a consumer-redelivery guard at all.**
|
||||
`PublishUnique` only sets the JetStream `Nats-Msg-Id` header on the
|
||||
outgoing message (`internal/infrastructure/eventbus/nats/publisher.go`;
|
||||
key constant `message.go`); JetStream suppresses *republished*
|
||||
key constant `message.go`); JetStream suppresses _republished_
|
||||
messages carrying a repeated key inside `Config.DedupWindow`
|
||||
(`client.go`, `Duplicates: cfg.DedupWindow`), default 2 minutes
|
||||
(`config.go`, `DefaultDedupWindow = 2 * time.Minute`). A consumer
|
||||
redelivery is the same *stored* message re-delivered on Nak or
|
||||
redelivery is the same _stored_ message re-delivered on Nak or
|
||||
acknowledge-timeout (`internal/eventbus/eventbus.go`: "a handler
|
||||
returning an error causes redelivery") -- not a republish; its
|
||||
`Nats-Msg-Id` is never re-firewalled, and even if it were, two minutes is
|
||||
@@ -341,11 +343,11 @@ mechanism rather than designing a new one.
|
||||
**Granularity: per-action-per-event -- one dedup record per
|
||||
(action, event) pair, not per playbook run.** Whole-run keying, the
|
||||
obvious alternative, has two crash windows: the run row is written when the run starts, so a crash mid-run
|
||||
leaves the run "started" and a redelivery skips *every remaining
|
||||
action* (work silently lost); a crash before the row write re-runs
|
||||
*every already-fired action* (duplicate side effects -- the exact harm
|
||||
leaves the run "started" and a redelivery skips _every remaining
|
||||
action_ (work silently lost); a crash before the row write re-runs
|
||||
_every already-fired action_ (duplicate side effects -- the exact harm
|
||||
this gap exists to prevent). Per-action keys collapse both into one
|
||||
window and one behavior: an action's record is written immediately
|
||||
window and one behaviour: an action's record is written immediately
|
||||
before that action's side effect is invoked, so an action fires iff its
|
||||
own record is absent, no fired action ever re-fires, and a redelivered
|
||||
event resumes at the first unrecorded action. For the shipped
|
||||
@@ -400,10 +402,10 @@ silently decay, which is exactly the property that disqualifies
|
||||
event, action) pairs and is accepted, the same tradeoff
|
||||
`binding_dispatches` already makes.
|
||||
|
||||
**Redelivery behavior: skip the recorded action and continue the run.**
|
||||
**Redelivery behaviour: skip the recorded action and continue the run.**
|
||||
A detected duplicate is not re-invoked, is not reported to the caller as
|
||||
an error, and is logged at debug level rather than as a warning -- this
|
||||
is the expected, correct behavior of at-least-once delivery, not an
|
||||
is the expected, correct behaviour of at-least-once delivery, not an
|
||||
anomaly (same treatment as `ErrAlreadyDispatched` at
|
||||
`daemon.go`).
|
||||
The run continues with the next action (or ends, for a single-action
|
||||
@@ -415,7 +417,7 @@ computed by the coordinator -- not a CEL expression.** The key is the
|
||||
`(playbook_id, playbook_version, event_id, action_id)` tuple above, where:
|
||||
|
||||
- `playbook_id` is `Playbook.ID` -- the playbook file's path relative to
|
||||
its configured directory root, slash-normalized, unique within the load
|
||||
its configured directory root, slash-normalised, unique within the load
|
||||
composition by construction (`internal/domain/eda/playbook`).
|
||||
- `playbook_version` is `Playbook.Version` -- a SHA-256 of the loaded
|
||||
file, recomputed on every load (`internal/domain/eda/playbook`),
|
||||
@@ -435,12 +437,12 @@ computed by the coordinator -- not a CEL expression.** The key is the
|
||||
issue identity rather than the delivery source is the load-bearing
|
||||
property the existing contract already established for `TaskEnvelope`
|
||||
(`event-sources-and-reactions.md` question 4: a webhook-sourced
|
||||
envelope for the same issue produces the *same* idempotency key as a
|
||||
envelope for the same issue produces the _same_ idempotency key as a
|
||||
poll-discovered one; `internal/forge/webhook/receiver.go` --
|
||||
"Idempotency is not this package's job"); this resolution inherits that
|
||||
property rather than re-deciding it. Consequence, stated explicitly:
|
||||
same-issue re-discoveries (a re-label that re-triggers the same kind)
|
||||
are the *same event* by design -- the workintake trigger vocabulary is
|
||||
are the _same event_ by design -- the workintake trigger vocabulary is
|
||||
issue-granular, exactly as `TaskEnvelope`'s own key is. A future
|
||||
capture/binding-originated trigger type keys on `captured_events.id`
|
||||
instead; derivation is per-trigger-type, not one formula for all
|
||||
@@ -472,7 +474,7 @@ fragment the ledger. The key is therefore structural by construction:
|
||||
every component above is an immutable identity of the run's inputs, so
|
||||
two deliveries of the same event derive the same key with no evaluation.
|
||||
The exercise's actual outcome is the derivation rule above; CEL remains
|
||||
a *condition* surface (`when`), never a key surface. An action kind that
|
||||
a _condition_ surface (`when`), never a key surface. An action kind that
|
||||
genuinely needs finer granularity than (action, event), such as "per
|
||||
comment, not per issue", arrives with its own trigger type and its own
|
||||
event identity, per the per-trigger-type rule.
|
||||
@@ -506,7 +508,7 @@ for a playbook run" to whoever builds the coordinator). One consequence
|
||||
of record-before: an action that FAILED (gap 1's real-action-error case)
|
||||
has a ledger row, so a later redelivery of the same event skips it --
|
||||
consistent with gap 1's "no automatic retry" resolve (a corrective
|
||||
action is a *new* playbook/action, per gap 1's rollback paragraph). A
|
||||
action is a _new_ playbook/action, per gap 1's rollback paragraph). A
|
||||
failed action is never re-attempted by the bus; if a run must be
|
||||
recovered, an operator edits the playbook -- new version, new key --
|
||||
rather than fighting ledger state.
|
||||
@@ -516,7 +518,7 @@ contradiction.** Keyed to that document's sections:
|
||||
|
||||
1. Its decision 2 commits reactions to at-least-once delivery via
|
||||
`PublishUnique`'s "without duplicate enqueue" guarantee -- which, with
|
||||
the code facts above, is accurate for the *publish* path only:
|
||||
the code facts above, is accurate for the _publish_ path only:
|
||||
`PublishUnique` absorbs duplicate publishes of the same event (poll
|
||||
vs. webhook), which is what that decision was actually about. This
|
||||
document's own problem statement, taken literally, overstates it
|
||||
@@ -564,7 +566,7 @@ the side-effecting positions are gated.
|
||||
**Resolved** (`archie-core-t2db.14`). CEL (`cel.dev/cel-go`, pinned) is
|
||||
the one mechanism for both an action's `when` condition and its `args`
|
||||
values. The trust boundary, evaluation context, load-time validation and
|
||||
the five judgment calls are in
|
||||
the five judgement calls are in
|
||||
`docs/prds/playbook-expression-syntax.md`.
|
||||
|
||||
2. **Playbook directory config field.** Where this lives in
|
||||
@@ -604,6 +606,7 @@ the side-effecting positions are gated.
|
||||
to the label layer.
|
||||
- Precedence in `Route()`: explicit `t.Workflow` → arbitrary-label
|
||||
binding → kind binding → triage → implement → default.
|
||||
|
||||
3. **Trust boundary for Module Yaegi code.** The plugin engine rule's
|
||||
invariant 6 draws a line between operator-trusted in-process code and
|
||||
repository-supplied code that must run in a container.
|
||||
@@ -612,6 +615,7 @@ the side-effecting positions are gated.
|
||||
Module is operator-installed, in-process and daemon-privileged, the same
|
||||
tier as `PluginDir` and `SecretEngineDir`, never repository-supplied
|
||||
task code.
|
||||
|
||||
4. **First implementation slice.** Recommend: Module position + the
|
||||
playbook loader + trigger-to-workflow dispatch only (subsuming the existing
|
||||
label routing) first, proving the schema-gen -> Yaegi -> playbook path
|
||||
@@ -636,7 +640,7 @@ the side-effecting positions are gated.
|
||||
that parks the task rather than a silent fall-through to the binding's
|
||||
choice.
|
||||
|
||||
`Store.Dispatch` returns the selected workflow *name* and the matching
|
||||
`Store.Dispatch` returns the selected workflow _name_ and the matching
|
||||
playbook's id and version, not a compiled `workflow.Workflow`: the
|
||||
production caller decides against the active definition collection, and
|
||||
the id and version are the first two components of the gap-2 idempotency
|
||||
@@ -650,9 +654,10 @@ the side-effecting positions are gated.
|
||||
The single-action hard boundary is superseded by
|
||||
`docs/prds/multi-action-playbooks.md` (two-shape rule); Module, Channel,
|
||||
and Forge positions still have no production dispatch path.
|
||||
|
||||
## Standing constraint
|
||||
|
||||
This may be commercialized, and is to be discernible from other open-source
|
||||
This may be commercialised, and is to be discernible from other open-source
|
||||
event-driven-automation tooling. No design decision follows from that yet;
|
||||
it bears on licensing or feature-gating questions about playbook authoring
|
||||
and the LSP when they arise.
|
||||
|
||||
@@ -24,9 +24,9 @@ the embedded deployment is selected. It does not run an autonomous model loop.
|
||||
|
||||
NATS has two supported deployment shapes:
|
||||
|
||||
| mode | meaning |
|
||||
| --- | --- |
|
||||
| `embedded` | `archied` owns an in-process JetStream server (default). |
|
||||
| mode | meaning |
|
||||
| ---------- | --------------------------------------------------------- |
|
||||
| `embedded` | `archied` owns an in-process JetStream server (default). |
|
||||
| `external` | `archied` and workers connect to the configured NATS URL. |
|
||||
|
||||
Both shapes have identical task semantics: one container and one full-task
|
||||
|
||||
@@ -97,7 +97,7 @@ id: firewall-investigate
|
||||
inputs:
|
||||
src_ip: { type: string, required: true }
|
||||
severity: { type: string }
|
||||
repository: none # none | optional | required
|
||||
repository: none # none | optional | required
|
||||
profile: network-investigator
|
||||
steps: ...
|
||||
```
|
||||
@@ -125,7 +125,7 @@ steps:
|
||||
- type: workflow.call
|
||||
workflow: firewall-contain
|
||||
inputs: { src_ip: inputs.src_ip }
|
||||
wait: true # false starts the callee and continues
|
||||
wait: true # false starts the callee and continues
|
||||
```
|
||||
|
||||
- With `wait: true` the caller receives the callee's outputs and fails if the
|
||||
|
||||
@@ -56,16 +56,16 @@ against a real need, not now against a speculative one.
|
||||
`captured_events` table (`internal/store/captures.go`, mirrors
|
||||
`internal/store/events.go`'s pattern):
|
||||
|
||||
| column | type | notes |
|
||||
|-----------------|---------|-------------------------------------------------|
|
||||
| id | INTEGER | primary key, autoincrement |
|
||||
| received_at | TEXT | RFC3339Nano |
|
||||
| source | TEXT | opaque path segment chosen by the sender's operator |
|
||||
| remote_addr | TEXT | `RemoteAddr` at capture time |
|
||||
| content_type | TEXT | `Content-Type` header |
|
||||
| headers | TEXT | JSON, redacted |
|
||||
| body | TEXT | JSON, redacted (`webhookguard.RedactPayload`) |
|
||||
| authenticated | INTEGER | 0/1; always 0 until a source registers a secret (future: `t2db.4`) |
|
||||
| column | type | notes |
|
||||
| ------------- | ------- | ------------------------------------------------------------------ |
|
||||
| id | INTEGER | primary key, autoincrement |
|
||||
| received_at | TEXT | RFC3339Nano |
|
||||
| source | TEXT | opaque path segment chosen by the sender's operator |
|
||||
| remote_addr | TEXT | `RemoteAddr` at capture time |
|
||||
| content_type | TEXT | `Content-Type` header |
|
||||
| headers | TEXT | JSON, redacted |
|
||||
| body | TEXT | JSON, redacted (`webhookguard.RedactPayload`) |
|
||||
| authenticated | INTEGER | 0/1; always 0 until a source registers a secret (future: `t2db.4`) |
|
||||
|
||||
Indexed on `(source, id)` for per-source listing and pruning, and `id` alone
|
||||
for the global cap.
|
||||
@@ -80,7 +80,7 @@ and this bead's own "capture cannot exhaust disk" criterion:
|
||||
POST is rejected (413) before redaction or storage sees it.
|
||||
2. **Per-remote-address rate limit.** `webhookguard.RateLimiter`, keyed by
|
||||
the request's remote address, applied before the body is even read.
|
||||
*Not* keyed by the `source` path segment: `RateLimiter`'s own doc comment
|
||||
_Not_ keyed by the `source` path segment: `RateLimiter`'s own doc comment
|
||||
states its bucket map assumes a bounded, operator-registered key space,
|
||||
never evicted. `source` is exactly the opposite here -- an unregistered,
|
||||
attacker-chosen URL segment, since capturing senders with no registration
|
||||
|
||||
@@ -38,7 +38,7 @@ causes redelivery." Do not design new delivery semantics; use this contract.
|
||||
**Do not reuse the existing `nats.Client` as-is.** `Config.StreamName` and
|
||||
`Config.Subjects` are already composition-supplied ("the bus must not know
|
||||
which subjects belong to which domain," `config.go`), but the
|
||||
retention policy is not parameterized: `New` hardcodes
|
||||
retention policy is not parameterised: `New` hardcodes
|
||||
`Retention: jetstream.WorkQueuePolicy` (`client.go`), the competing-consumer
|
||||
policy correct for `ARCHIE_TASKS` task distribution -- one message, claimed by
|
||||
exactly one consumer -- and wrong for reactions. Two independent reactions
|
||||
@@ -76,7 +76,7 @@ else:
|
||||
and produces a `workintake.TaskEnvelope`. A webhook source is a second
|
||||
producer into the same path, not a new capability -- see question 4.
|
||||
|
||||
A reaction that can veto or mutate an *in-flight* task (block a PR from
|
||||
A reaction that can veto or mutate an _in-flight_ task (block a PR from
|
||||
opening, alter a running stage) is a different, harder problem with its own
|
||||
ordering and failure semantics, and belongs to `archie-core-h019` (adversarial
|
||||
self-review) if and when that epic needs one -- not here. Do not build a
|
||||
@@ -99,22 +99,23 @@ limiting, capture/audit, and the draft/pending_approval/armed gate. This
|
||||
package owns none of forge, chat, or workintake's vocabulary.
|
||||
|
||||
**What stays domain-owned, per existing convention:**
|
||||
|
||||
- Forge-issue intake needs no new type. `internal/domain/workintake.TaskEnvelope`
|
||||
already is the typed contract -- `Subject()`, `IdempotencyKey()` (keyed on
|
||||
`owner/repo/number`, not on delivery source), `Encode()`. A webhook-sourced
|
||||
envelope for the same issue produces the *same* idempotency key as a
|
||||
envelope for the same issue produces the _same_ idempotency key as a
|
||||
poll-discovered one, so `PublishUnique` dedups the two paths for free. This
|
||||
is `7d5u.5`'s answer, not a new mechanism: reuse `TaskEnvelope` and
|
||||
`publishTask`, don't invent a second envelope shape.
|
||||
- Chat-webhook intake stays exactly what it is:
|
||||
`internal/channels/webhook`'s `RouteConfig` routes into `gateway.Router`,
|
||||
documented as chat-scoped ("External services push messages into
|
||||
archie-core's gateway for LLM processing"). Do not generalize this package
|
||||
archie-core's gateway for LLM processing"). Do not generalise this package
|
||||
into a multi-domain receiver -- it already does one thing per "a package
|
||||
owns its own format end to end."
|
||||
- A forge webhook receiver (`7d5u.4`) is new: it builds on the shared
|
||||
mechanics above, decodes a GitHub payload into the *same*
|
||||
`workintake.TaskEnvelope`, and calls the *same* `publishTask` the poller
|
||||
mechanics above, decodes a GitHub payload into the _same_
|
||||
`workintake.TaskEnvelope`, and calls the _same_ `publishTask` the poller
|
||||
calls. It does not get its own dispatch predicate -- `7d5u.4`'s bead
|
||||
already requires reusing the poller's label/assignee predicate rather than
|
||||
reimplementing it, and this decision extends that to the envelope and
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Extensions center
|
||||
# Extensions centre
|
||||
|
||||
**Status:** Draft
|
||||
|
||||
Epic: `archie-core-1786637490708-35-38424ead` / GitHub `#56` ("Replace Skills
|
||||
with a bundled Extensions center").
|
||||
with a bundled Extensions centre").
|
||||
|
||||
Skills, Workflows, and Tools/MCP already exist as separate, working
|
||||
inventories with their own APIs (`api_skills.go`, `api_workflows.go`,
|
||||
@@ -131,7 +131,7 @@ that writes through the existing `UpdateConfig` seam (`api_config.go`) —
|
||||
this document does not add a second config-write endpoint. New
|
||||
`ui/src/extensions/` (colocated `.js`/`.css` per CLAUDE.md's frontend rule)
|
||||
as an index/dashboard that **links to**, not replaces, the existing
|
||||
`ui/src/skills/` and `ui/src/workflows/` detail views — Extensions center is
|
||||
`ui/src/skills/` and `ui/src/workflows/` detail views — Extensions centre is
|
||||
where an operator sees everything and toggles enablement; the family-specific
|
||||
pages remain where they inspect a family's own detail.
|
||||
|
||||
@@ -140,27 +140,27 @@ pages remain where they inspect a family's own detail.
|
||||
|
||||
## Call site inventory
|
||||
|
||||
| concern | file | change |
|
||||
|---|---|---|
|
||||
| Plugin metadata type | `internal/plugin/plugin.go` | none — already handles this |
|
||||
| concern | file | change |
|
||||
| ------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------- |
|
||||
| Plugin metadata type | `internal/plugin/plugin.go` | none — already handles this |
|
||||
| Family controllers (curator/health/image/workflow registries) | `internal/domain/curator/registry.go`, `internal/domain/health/health.go`, etc. | none — pattern already proven, reused not rewritten |
|
||||
| Unified inventory | `internal/domain/extensions/inventory.go` | new |
|
||||
| Composition wiring | `internal/app/archied/server.go` (near existing optional fields) | new |
|
||||
| Config enablement fields | `internal/config/config.go` | new fields per family |
|
||||
| Config docs | `config.example.toml` | new field documentation |
|
||||
| API surface | `internal/webui/api_extensions.go` | new |
|
||||
| Existing skills/workflows APIs | `internal/webui/api_skills.go`, `api_workflows.go` | none — linked from, not replaced |
|
||||
| Config save path | `internal/webui/api_config.go` (`UpdateConfig`) | reused, not duplicated |
|
||||
| UI | `ui/src/extensions/` | new |
|
||||
| Existing UI detail views | `ui/src/skills/`, `ui/src/workflows/` | none — linked from Extensions center |
|
||||
| Unified inventory | `internal/domain/extensions/inventory.go` | new |
|
||||
| Composition wiring | `internal/app/archied/server.go` (near existing optional fields) | new |
|
||||
| Config enablement fields | `internal/config/config.go` | new fields per family |
|
||||
| Config docs | `config.example.toml` | new field documentation |
|
||||
| API surface | `internal/webui/api_extensions.go` | new |
|
||||
| Existing skills/workflows APIs | `internal/webui/api_skills.go`, `api_workflows.go` | none — linked from, not replaced |
|
||||
| Config save path | `internal/webui/api_config.go` (`UpdateConfig`) | reused, not duplicated |
|
||||
| UI | `ui/src/extensions/` | new |
|
||||
| Existing UI detail views | `ui/src/skills/`, `ui/src/workflows/` | none — linked from Extensions centre |
|
||||
|
||||
## Execution: multi-agent team breakdown
|
||||
|
||||
| sub-feature | issue | implementer scope | suggested council lenses | why |
|
||||
|---|---|---|---|---|
|
||||
| Unified inventory type + composition | file as child of `#56` | `internal/domain/extensions/inventory.go`, wiring in `server.go` | `lens-boundary`, `lens-deletionist` | boundary: aggregator must not duplicate family-owned state; deletionist: must not become a new domain that shadows existing registries |
|
||||
| Config enablement fields | file as child of `#56` | `config.go` per-family `Enabled` fields, `config.example.toml` | `lens-contract` | config field is a wire contract other tooling (`docsgen`) generates from |
|
||||
| API + UI surface | file as child of `#56` | `api_extensions.go`, `ui/src/extensions/` | `lens-maintainer` | new user-facing state machine (available/enabled/active/degraded/skipped/pending-restart) must be legible to an operator with no prior context |
|
||||
| sub-feature | issue | implementer scope | suggested council lenses | why |
|
||||
| ------------------------------------ | ---------------------- | ---------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Unified inventory type + composition | file as child of `#56` | `internal/domain/extensions/inventory.go`, wiring in `server.go` | `lens-boundary`, `lens-deletionist` | boundary: aggregator must not duplicate family-owned state; deletionist: must not become a new domain that shadows existing registries |
|
||||
| Config enablement fields | file as child of `#56` | `config.go` per-family `Enabled` fields, `config.example.toml` | `lens-contract` | config field is a wire contract other tooling (`docsgen`) generates from |
|
||||
| API + UI surface | file as child of `#56` | `api_extensions.go`, `ui/src/extensions/` | `lens-maintainer` | new user-facing state machine (available/enabled/active/degraded/skipped/pending-restart) must be legible to an operator with no prior context |
|
||||
|
||||
## File and link the beads
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ hand-rolls either fails this document.
|
||||
|
||||
**Authelia is the only identity provider**, because the estate already runs it in
|
||||
front of the dashboard and it issues credentials for both kinds of caller: humans
|
||||
use the authorization code flow, and machines use the `client_credentials` grant,
|
||||
use the authorisation code flow, and machines use the `client_credentials` grant,
|
||||
which yields a token whose subject is the client's own identifier.
|
||||
|
||||
**Each agent is its own provider client.** A shared client would make two agents
|
||||
@@ -69,7 +69,7 @@ answer when agents run on infrastructure the operator does not control.
|
||||
## What archie never owns
|
||||
|
||||
A credential, a password, a session, a token, a signing key, a second-factor
|
||||
enrollment, or a permission rule.
|
||||
enrolment, or a permission rule.
|
||||
|
||||
## How an agent proves who it is
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ Validation (`internal/infrastructure/configuration/validate.go`, alongside
|
||||
- A `Hosted` entry with `Enabled = true` must have `Class` non-empty and
|
||||
either `APIKeyEnv` or a resolvable `APIKey` — the same shape check
|
||||
`Provider` (chat) already gets, not a new invention.
|
||||
- No cross-field surprise: an *absent* `[image]` section is valid and
|
||||
- No cross-field surprise: an _absent_ `[image]` section is valid and
|
||||
produces zero registered providers, matching the epic's non-goal
|
||||
("silently selecting a paid hosted provider" must never happen by
|
||||
omission either).
|
||||
@@ -222,7 +222,7 @@ whole point of the contract being provider-neutral.
|
||||
provider that ignores cancellation is a provider bug, not a contract gap
|
||||
— mirrors every other Lifecycle-less call in the codebase (chat's
|
||||
`runtime.Chat`).
|
||||
- `ImageData` size limits are enforced by the *caller* (the future routing
|
||||
- `ImageData` size limits are enforced by the _caller_ (the future routing
|
||||
bead) before constructing a request, using a configured max — not by this
|
||||
contract, which has no config surface for "current caller's limit". This
|
||||
package only defines `ErrInputTooLarge` so a provider that discovers an
|
||||
@@ -280,14 +280,14 @@ this epic's call to make on someone else's project's timeline. Instead:
|
||||
**Provider error mapping** (every ai-sdk/HTTP error translated at the
|
||||
adapter boundary, never leaked as-is):
|
||||
|
||||
| ai-sdk / HTTP condition | contract error |
|
||||
|---|---|
|
||||
| `image.ErrNoProvider`, `image.ErrAuthFailed`, missing/invalid credential, backend unreachable | `ErrUnavailable` |
|
||||
| `image.ErrEditNotSupported`, request needs a `Capability` the provider didn't declare | `ErrUnsupported` |
|
||||
| input image over configured byte limit (checked before the call, per "Timeouts, size limits, cancellation" above) | `ErrInputTooLarge` |
|
||||
| `ctx.Err() == context.DeadlineExceeded` | `ErrTimeout` |
|
||||
| `ctx.Err() == context.Canceled` | `ErrCanceled` |
|
||||
| `image.ErrRateLimited`, `image.ErrContentFiltered`, any other 4xx/5xx | wrapped verbatim under `ErrUnavailable` with the provider's own message as detail — a rate limit or content filter is "unavailable for this request", not a new sentinel the caller needs to branch on differently |
|
||||
| ai-sdk / HTTP condition | contract error |
|
||||
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `image.ErrNoProvider`, `image.ErrAuthFailed`, missing/invalid credential, backend unreachable | `ErrUnavailable` |
|
||||
| `image.ErrEditNotSupported`, request needs a `Capability` the provider didn't declare | `ErrUnsupported` |
|
||||
| input image over configured byte limit (checked before the call, per "Timeouts, size limits, cancellation" above) | `ErrInputTooLarge` |
|
||||
| `ctx.Err() == context.DeadlineExceeded` | `ErrTimeout` |
|
||||
| `ctx.Err() == context.Canceled` | `ErrCanceled` |
|
||||
| `image.ErrRateLimited`, `image.ErrContentFiltered`, any other 4xx/5xx | wrapped verbatim under `ErrUnavailable` with the provider's own message as detail — a rate limit or content filter is "unavailable for this request", not a new sentinel the caller needs to branch on differently |
|
||||
|
||||
**Testing**: `httptest.Server` fixtures for the edit client (request
|
||||
multipart shape, response decoding, 4xx/5xx mapping); a fake `ai-sdk/image.Provider`
|
||||
@@ -412,12 +412,12 @@ video-specific.
|
||||
|
||||
**Per-channel state, checked directly rather than assumed:**
|
||||
|
||||
| channel | image delivery | evidence |
|
||||
|---|---|---|
|
||||
| Telegram | **already works** | `internal/channels/telegram/media.go`'s `telegramMediaSender.dispatch` already branches on `att.Type` and calls `bot.SendPhoto` for `"image"` (`SendVideo` for `"video"` is the same function) |
|
||||
| Dashboard (webui) | **tracked gap, not new** | `internal/webui/api_chat.go`'s `chatStreamSink.Media` has no inline rendering path yet and degrades to a link/error string — already tracked as archie-core-1786748942243-6-f109697e. This epic does not need to fix it, but #501's acceptance criterion ("unsupported paths report a clear limitation") is already met by the existing degrade-to-text behavior; closing the dashboard gap is that bead's job, not this one's |
|
||||
| Email | **no attachment sender exists** | `grep MediaAttachment internal/channels/email` returns nothing. Out of scope for this epic per #496's non-goals (no channel-abstraction rework) — email delivery of a generated image degrades the same way the dashboard does which is acceptable under #501's "or unsupported paths report a clear limitation" clause |
|
||||
| Webhook | not applicable | webhook is an inbound intake channel (`internal/channels/webhook`), not an outbound chat reply target — no `/image` command can originate there in the first place |
|
||||
| channel | image delivery | evidence |
|
||||
| ----------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Telegram | **already works** | `internal/channels/telegram/media.go`'s `telegramMediaSender.dispatch` already branches on `att.Type` and calls `bot.SendPhoto` for `"image"` (`SendVideo` for `"video"` is the same function) |
|
||||
| Dashboard (webui) | **tracked gap, not new** | `internal/webui/api_chat.go`'s `chatStreamSink.Media` has no inline rendering path yet and degrades to a link/error string — already tracked as archie-core-1786748942243-6-f109697e. This epic does not need to fix it, but #501's acceptance criterion ("unsupported paths report a clear limitation") is already met by the existing degrade-to-text behaviour; closing the dashboard gap is that bead's job, not this one's |
|
||||
| Email | **no attachment sender exists** | `grep MediaAttachment internal/channels/email` returns nothing. Out of scope for this epic per #496's non-goals (no channel-abstraction rework) — email delivery of a generated image degrades the same way the dashboard does which is acceptable under #501's "or unsupported paths report a clear limitation" clause |
|
||||
| Webhook | not applicable | webhook is an inbound intake channel (`internal/channels/webhook`), not an outbound chat reply target — no `/image` command can originate there in the first place |
|
||||
|
||||
**The only new work `internal/tools/minimax` didn't already need**: the
|
||||
autonomous-tool call site. `/image` (previous section) calls a provider
|
||||
@@ -444,20 +444,20 @@ whichever change originally proved it out.
|
||||
Every file a full implementation touches, so no bead re-derives this by
|
||||
grep:
|
||||
|
||||
| concern | file | change |
|
||||
|---|---|---|
|
||||
| domain contract | `internal/domain/image/{contract,registry}.go` | done (#497) |
|
||||
| config schema + validation | `internal/infrastructure/configuration/{types,validate}.go` | done (#497); extended here only if ComfyUI's `Workflow` field needs a new validation rule (path exists, non-empty when `Local.Enabled`) |
|
||||
| hosted provider | `internal/infrastructure/image/openai/*.go` (or per `Class`) | new (#498) |
|
||||
| local provider | `internal/infrastructure/image/comfyui/*.go` | new (#499) |
|
||||
| `/image` command spec | `internal/domain/messaging/commands.go` | new entry in `localCommandSpecs` |
|
||||
| `/image` routing | `internal/gateway/gateway.go` (`Router.Images`, `handleImage`) | new (#500) |
|
||||
| autonomous tool | `internal/tools/image/tool.go` | new (#501) |
|
||||
| tool registration | `internal/app/archied/bootstrap.go` (`registerImageTool`, beside `registerMinimaxTool`) | new (#501) |
|
||||
| `Registry` wiring | `internal/app/archied/bootstrap.go` (construct `image.Registry`, register configured providers, hand to `Router.Images`) | new — this is the "nothing to wire until a real provider exists" step the original contract doc deferred |
|
||||
| Telegram delivery | `internal/channels/telegram/media.go` | none — already handles `"image"` |
|
||||
| Dashboard delivery | `internal/webui/api_chat.go` | none in this epic — tracked separately (archie-core-1786748942243-6-f109697e) |
|
||||
| docs | `docs/` user-facing guide (#502) | new, against this design |
|
||||
| concern | file | change |
|
||||
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| domain contract | `internal/domain/image/{contract,registry}.go` | done (#497) |
|
||||
| config schema + validation | `internal/infrastructure/configuration/{types,validate}.go` | done (#497); extended here only if ComfyUI's `Workflow` field needs a new validation rule (path exists, non-empty when `Local.Enabled`) |
|
||||
| hosted provider | `internal/infrastructure/image/openai/*.go` (or per `Class`) | new (#498) |
|
||||
| local provider | `internal/infrastructure/image/comfyui/*.go` | new (#499) |
|
||||
| `/image` command spec | `internal/domain/messaging/commands.go` | new entry in `localCommandSpecs` |
|
||||
| `/image` routing | `internal/gateway/gateway.go` (`Router.Images`, `handleImage`) | new (#500) |
|
||||
| autonomous tool | `internal/tools/image/tool.go` | new (#501) |
|
||||
| tool registration | `internal/app/archied/bootstrap.go` (`registerImageTool`, beside `registerMinimaxTool`) | new (#501) |
|
||||
| `Registry` wiring | `internal/app/archied/bootstrap.go` (construct `image.Registry`, register configured providers, hand to `Router.Images`) | new — this is the "nothing to wire until a real provider exists" step the original contract doc deferred |
|
||||
| Telegram delivery | `internal/channels/telegram/media.go` | none — already handles `"image"` |
|
||||
| Dashboard delivery | `internal/webui/api_chat.go` | none in this epic — tracked separately (archie-core-1786748942243-6-f109697e) |
|
||||
| docs | `docs/` user-facing guide (#502) | new, against this design |
|
||||
|
||||
## Execution: multi-agent team breakdown
|
||||
|
||||
@@ -468,12 +468,12 @@ re-explained, only its row. Lenses are picked from
|
||||
`operator`, `maintainer`) by what each slice actually risks getting wrong,
|
||||
not all five by default.
|
||||
|
||||
| sub-feature | issue | implementer scope (call-site rows) | suggested lenses | why |
|
||||
|---|---|---|---|---|
|
||||
| Hosted provider | #498 | `internal/infrastructure/image/openai/*.go` (generate via ai-sdk, edit via direct HTTP client) | `lens-contract`, `lens-operator` | contract: the error-mapping table must actually produce the sentinels it claims, not leak ai-sdk/HTTP errors raw; operator: a live paid API's rate-limit/timeout/auth-failure paths are exactly the 3am-unattended-host case this lens exists for |
|
||||
| Local GPU provider | #499 | `internal/infrastructure/image/comfyui/*.go` (submit/poll against ComfyUI) | `lens-operator`, `lens-deletionist` | operator: backend-down, workflow-missing, and stuck-job failure modes on a host the operator's GPU actually runs; deletionist: a second, unevidenced "recipe" added later without real-hardware proof is exactly the speculative scaffolding this lens rejects |
|
||||
| `/image` routing | #500 | `internal/domain/messaging/commands.go`, `internal/gateway/gateway.go` (`Router.Images`, `handleImage`) | `lens-boundary`, `lens-maintainer` | boundary: a new `Router` field and its dependency on `image.Registry` must respect the same layering `Models`/`Tasks`/`Controller` already do; maintainer: this is the first local command with an explicit ask-once clarification exchange, not a single-shot reply — legibility for the next person who adds a command matters here |
|
||||
| Delivery + autonomous tool | #501 | `internal/tools/image/tool.go`, `internal/app/archied/bootstrap.go` (`registerImageTool`) | `lens-deletionist`, `lens-contract` | deletionist: the whole point of this section is "reuse `generate_video`'s pipeline, do not rebuild it" — this lens is the check that the implementation actually did that; contract: the new tool's `MultimodalResult`/`MediaRef{Type: "image"}` output must match the shape `multimodalMediaRefs` already decodes, not a near-miss |
|
||||
| sub-feature | issue | implementer scope (call-site rows) | suggested lenses | why |
|
||||
| -------------------------- | ----- | ------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Hosted provider | #498 | `internal/infrastructure/image/openai/*.go` (generate via ai-sdk, edit via direct HTTP client) | `lens-contract`, `lens-operator` | contract: the error-mapping table must actually produce the sentinels it claims, not leak ai-sdk/HTTP errors raw; operator: a live paid API's rate-limit/timeout/auth-failure paths are exactly the 3am-unattended-host case this lens exists for |
|
||||
| Local GPU provider | #499 | `internal/infrastructure/image/comfyui/*.go` (submit/poll against ComfyUI) | `lens-operator`, `lens-deletionist` | operator: backend-down, workflow-missing, and stuck-job failure modes on a host the operator's GPU actually runs; deletionist: a second, unevidenced "recipe" added later without real-hardware proof is exactly the speculative scaffolding this lens rejects |
|
||||
| `/image` routing | #500 | `internal/domain/messaging/commands.go`, `internal/gateway/gateway.go` (`Router.Images`, `handleImage`) | `lens-boundary`, `lens-maintainer` | boundary: a new `Router` field and its dependency on `image.Registry` must respect the same layering `Models`/`Tasks`/`Controller` already do; maintainer: this is the first local command with an explicit ask-once clarification exchange, not a single-shot reply — legibility for the next person who adds a command matters here |
|
||||
| Delivery + autonomous tool | #501 | `internal/tools/image/tool.go`, `internal/app/archied/bootstrap.go` (`registerImageTool`) | `lens-deletionist`, `lens-contract` | deletionist: the whole point of this section is "reuse `generate_video`'s pipeline, do not rebuild it" — this lens is the check that the implementation actually did that; contract: the new tool's `MultimodalResult`/`MediaRef{Type: "image"}` output must match the shape `multimodalMediaRefs` already decodes, not a near-miss |
|
||||
|
||||
Run `/council --lenses <picked>` once a row's implementation is gate-clean
|
||||
(`task check` passing), before opening its PR — same timing as any other
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
## Problem
|
||||
|
||||
Findings reach the operator only as a flat list in the PR body
|
||||
(`renderPRReviewSection`, h019.6): `` - `file.go` (confirmed, error): <defect>
|
||||
— <scenario> ``. That is a report *about* the code, not a review *of* it. A real
|
||||
(`renderPRReviewSection`, h019.6): ``- `file.go` (confirmed, error): <defect>
|
||||
— <scenario>``. That is a report _about_ the code, not a review _of_ it. A real
|
||||
reviewer anchors each finding to the line it is about, so the author sees it in
|
||||
context — and, when the fix is mechanical, attaches the replacement so it can be
|
||||
applied in one click.
|
||||
@@ -16,7 +16,7 @@ applied in one click.
|
||||
Both halves are missing:
|
||||
|
||||
- **No line-anchored comment.** `forge.Forge.Comment` posts to the PR
|
||||
*conversation* (`Issues.CreateComment`); nothing creates a review comment at
|
||||
_conversation_ (`Issues.CreateComment`); nothing creates a review comment at
|
||||
`path` + `line`.
|
||||
- **No suggested fix.** `ReviewFinding` carries `File`/`Line`/`Defect`/
|
||||
`FailureScenario`/`Verdict`/`Level`/`Category` — no replacement code, so even
|
||||
@@ -107,7 +107,7 @@ New `StagePostReviewComments`, after `StageOpenPR`:
|
||||
`tc.ReviewedHeadSHA` alongside them.
|
||||
|
||||
Nothing in the run pushes between `StageReview` and this stage, so at that
|
||||
moment the pull request's head *is* the revision the review read. That was an
|
||||
moment the pull request's head _is_ the revision the review read. That was an
|
||||
assumption, and a collaborator can falsify it by pushing to the branch between
|
||||
the review and the posting. A line number is not validated against a revision:
|
||||
both forges anchor it to whatever now occupies that line, so a stale anchor
|
||||
|
||||
@@ -23,7 +23,7 @@ production-wired.
|
||||
|
||||
`bd search "MCP client"` shows five closed transport beads and one open:
|
||||
server-initiated sampling (`#151`). `internal/tools/mcp/client.go`
|
||||
holds a single `callMu *sync.Mutex` that serializes every `tools/call`
|
||||
holds a single `callMu *sync.Mutex` that serialises every `tools/call`
|
||||
regardless of server — `ParallelToolCalls` does not exist on the `MCPServer`
|
||||
config struct (`internal/config/config.go`), confirming `#177` is a
|
||||
real gap, not a stale bead. `#178` (wire MCP tool servers for the chat agent,
|
||||
@@ -64,11 +64,11 @@ parallel model-calling path for MCP sampling.
|
||||
|
||||
**Failure mapping.**
|
||||
|
||||
| condition | contract error |
|
||||
|---|---|
|
||||
| no `SamplingHandler` configured | JSON-RPC method-not-found, per spec |
|
||||
| handler returns error | JSON-RPC internal error, message from handler |
|
||||
| handler timeout | JSON-RPC timeout error; use the transport's existing request-timeout config, not a new one |
|
||||
| condition | contract error |
|
||||
| ------------------------------- | ------------------------------------------------------------------------------------------ |
|
||||
| no `SamplingHandler` configured | JSON-RPC method-not-found, per spec |
|
||||
| handler returns error | JSON-RPC internal error, message from handler |
|
||||
| handler timeout | JSON-RPC timeout error; use the transport's existing request-timeout config, not a new one |
|
||||
|
||||
**Testing.** Fakeable entirely — a stub `SamplingHandler` and a fake
|
||||
transport that emits a `sampling/createMessage` frame. No real backend
|
||||
@@ -79,11 +79,11 @@ needed; belongs in `task check`.
|
||||
**Decision.** `ParallelToolCalls bool` (default `false`) goes on `MCPServer`
|
||||
in `internal/config/config.go`, next to `Transport`/`Command`. The
|
||||
mutex in `client.go` becomes per-server: when `ParallelToolCalls` is
|
||||
false (default, and the only behavior), keep the single `callMu`
|
||||
serializing that server's calls exactly as now; when true, drop the mutex for
|
||||
false (default, and the only behaviour), keep the single `callMu`
|
||||
serialising that server's calls exactly as now; when true, drop the mutex for
|
||||
that server's `Client` instance entirely and let the caller's own
|
||||
concurrency (already proven by the closed concurrent-dispatch bead, `#183`)
|
||||
handle it. This is additive — no server's behavior changes unless an operator
|
||||
handle it. This is additive — no server's behaviour changes unless an operator
|
||||
opts in.
|
||||
|
||||
**Call site.** `internal/config/config.go` (struct field),
|
||||
@@ -130,10 +130,10 @@ there rather than duplicating the pool).
|
||||
|
||||
**Error/failure mapping.**
|
||||
|
||||
| condition | contract error |
|
||||
|---|---|
|
||||
| pool exhausted (no container slot) | MCP client returns connection-refused equivalent; server marked unavailable in the registry until retried |
|
||||
| container fails health/start | same as `#151`'s handler-error path — surfaced through the client's existing reconnect/backoff (`transport.go`), not a new retry loop |
|
||||
| condition | contract error |
|
||||
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| pool exhausted (no container slot) | MCP client returns connection-refused equivalent; server marked unavailable in the registry until retried |
|
||||
| container fails health/start | same as `#151`'s handler-error path — surfaced through the client's existing reconnect/backoff (`transport.go`), not a new retry loop |
|
||||
|
||||
**Testing.** `Sandboxed=false` path is the existing, already-tested
|
||||
unsandboxed flow — no change. `Sandboxed=true` needs a real
|
||||
@@ -149,7 +149,7 @@ is for a turn where each result should be surfaced to the operator (or the
|
||||
next tool call) before the next call fires — e.g. a mutating tool chain where
|
||||
showing intermediate state matters. Add a `DispatchMode` enum
|
||||
(`Concurrent`/`Sequential`) to whatever type selects the closed
|
||||
`#183` concurrent path, defaulting to `Concurrent` (its only behavior).
|
||||
`#183` concurrent path, defaulting to `Concurrent` (its only behaviour).
|
||||
|
||||
**Call site.** The tool-dispatch entry point that `#183`'s closed
|
||||
implementation lives in (grep the concurrent-dispatch symbol added for
|
||||
@@ -164,27 +164,27 @@ preview callbacks fire in order before the next call starts. `task check`.
|
||||
|
||||
## Call site inventory
|
||||
|
||||
| concern | file | change |
|
||||
|---|---|---|
|
||||
| MCP client transports (stdio/HTTP/SSE) | `internal/tools/mcp/transport*.go` | none — already handles this |
|
||||
| MCP client call serialization | `internal/tools/mcp/client.go` | change (`#177`) |
|
||||
| MCP server config | `internal/config/config.go` | new fields: `ParallelToolCalls`, `Sandboxed` |
|
||||
| Sampling dispatch | `internal/tools/mcp/client.go` | new (`#151`) |
|
||||
| Sampling handler wiring | `internal/app/archied/main.go` | new (`#151`), reuses `chatGenerateOptions` |
|
||||
| Sandboxed MCP launch | MCP client constructor + `internal/container/pool.go` | new (`#178`/`#179`) |
|
||||
| Concurrent tool dispatch | dispatch entry point (closed `#183`) | none — already handles this |
|
||||
| Sequential tool dispatch + previews | same dispatch entry point | new (`#182`) |
|
||||
| Guardrails / classification / registry / disclosure | `internal/tools/guardrail.go`, `classification.go`, `registry.go`, `disclosure.go` | none — already handles this |
|
||||
| `config.example.toml` MCP block | `config.example.toml` | doc update for new fields |
|
||||
| concern | file | change |
|
||||
| --------------------------------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------- |
|
||||
| MCP client transports (stdio/HTTP/SSE) | `internal/tools/mcp/transport*.go` | none — already handles this |
|
||||
| MCP client call serialisation | `internal/tools/mcp/client.go` | change (`#177`) |
|
||||
| MCP server config | `internal/config/config.go` | new fields: `ParallelToolCalls`, `Sandboxed` |
|
||||
| Sampling dispatch | `internal/tools/mcp/client.go` | new (`#151`) |
|
||||
| Sampling handler wiring | `internal/app/archied/main.go` | new (`#151`), reuses `chatGenerateOptions` |
|
||||
| Sandboxed MCP launch | MCP client constructor + `internal/container/pool.go` | new (`#178`/`#179`) |
|
||||
| Concurrent tool dispatch | dispatch entry point (closed `#183`) | none — already handles this |
|
||||
| Sequential tool dispatch + previews | same dispatch entry point | new (`#182`) |
|
||||
| Guardrails / classification / registry / disclosure | `internal/tools/guardrail.go`, `classification.go`, `registry.go`, `disclosure.go` | none — already handles this |
|
||||
| `config.example.toml` MCP block | `config.example.toml` | doc update for new fields |
|
||||
|
||||
## Execution: multi-agent team breakdown
|
||||
|
||||
| sub-feature | issue | implementer scope | suggested council lenses | why |
|
||||
|---|---|---|---|---|
|
||||
| Server-initiated sampling | `#151` | `client.go` dispatch branch, `main.go` handler wiring | `lens-contract` | new JSON-RPC method surface crossing the MCP wire contract |
|
||||
| Parallel-tool-calls flag | `#177` | config field, conditional mutex, constructor wiring | `lens-boundary` | per-server behavior change must not leak into other servers' serialization |
|
||||
| sub-feature | issue | implementer scope | suggested council lenses | why |
|
||||
| ------------------------------------ | -------------- | ---------------------------------------------------------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------- |
|
||||
| Server-initiated sampling | `#151` | `client.go` dispatch branch, `main.go` handler wiring | `lens-contract` | new JSON-RPC method surface crossing the MCP wire contract |
|
||||
| Parallel-tool-calls flag | `#177` | config field, conditional mutex, constructor wiring | `lens-boundary` | per-server behaviour change must not leak into other servers' serialisation |
|
||||
| Sandboxed MCP + Firecracker deferral | `#178`, `#179` | config field, constructor routing through `ContainerPool`, pool entrypoint variant | `lens-operator`, `lens-deletionist` | operator: sandbox-down failure path; deletionist: keeps `#179` from becoming unused scaffolding |
|
||||
| Sequential dispatch with previews | `#182` | `DispatchMode` enum, sequential branch, preview reuse of streaming seam | `lens-maintainer` | two coexisting dispatch modes need a reader to tell which applies without re-deriving both |
|
||||
| Sequential dispatch with previews | `#182` | `DispatchMode` enum, sequential branch, preview reuse of streaming seam | `lens-maintainer` | two coexisting dispatch modes need a reader to tell which applies without re-deriving both |
|
||||
|
||||
## File and link the beads
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ not)
|
||||
There are **two live memory stores for one assistant**, split by which component
|
||||
writes them, and the chat turn reads neither.
|
||||
|
||||
| Family | Written by | Root | Format |
|
||||
|---|---|---|---|
|
||||
| `internal/memory` (`Manager`, `builtin.Provider`) | the chat agent's `memory_edit` tool via `memorytoolprovider` (`bootstrap.go`) | `<workDir>/memory` | `MEMORY.md` / `USER.md` |
|
||||
| `internal/domain/memory` + `internal/infrastructure/memory` | the session curator (`sessioncurator.go`) | `<workDir>/memory-engine` | identity-keyed blocks |
|
||||
| Family | Written by | Root | Format |
|
||||
| ----------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------- | ----------------------- |
|
||||
| `internal/memory` (`Manager`, `builtin.Provider`) | the chat agent's `memory_edit` tool via `memorytoolprovider` (`bootstrap.go`) | `<workDir>/memory` | `MEMORY.md` / `USER.md` |
|
||||
| `internal/domain/memory` + `internal/infrastructure/memory` | the session curator (`sessioncurator.go`) | `<workDir>/memory-engine` | identity-keyed blocks |
|
||||
|
||||
They share no code, no format and no scope vocabulary. Neither reaches a prompt:
|
||||
`Manager.SystemPromptBlock` (`internal/memory/manager.go`) has no production
|
||||
@@ -30,10 +30,10 @@ Three further defects fall out of the same split:
|
||||
|
||||
1. **The engine's contract is not CRUD.** `Store` is `Write`/`Query`/`List`/
|
||||
`Forget` — create, read, delete, and **no Update**. The retired file provider
|
||||
*does* have `handleAdd`/`handleReplace`/`handleRemove`, so the family being
|
||||
_does_ have `handleAdd`/`handleReplace`/`handleRemove`, so the family being
|
||||
deleted is operationally richer than its replacement.
|
||||
2. **There is no scope model.** The contract carries one opaque `Identity
|
||||
string`, and the curator fills it with a **session id** (`sessioncurator.go`)
|
||||
string`, and the curator fills it with a **session id** (`sessioncurator.go`)
|
||||
— which is none of the four scopes `docs/architecture/agent-system.md`
|
||||
requires, and stops meaning anything when the session ends.
|
||||
3. **The chat turn has no user identity on half the channels.** Telegram and
|
||||
@@ -201,12 +201,12 @@ memory step reads what those later steps produce.
|
||||
The memory tool is built **per turn**, not registered once at boot, because it
|
||||
must write into a scope derived from the turn's resolved subject:
|
||||
|
||||
| action | engine call |
|
||||
|---|---|
|
||||
| `create` | `Create` |
|
||||
| action | engine call |
|
||||
| -------- | ---------------- |
|
||||
| `create` | `Create` |
|
||||
| `update` | `Update` (by id) |
|
||||
| `delete` | `Forget` (by id) |
|
||||
| `list` | `List` |
|
||||
| `list` | `List` |
|
||||
|
||||
**The model chooses the scope kind; it never chooses the ids.** Agent and user
|
||||
ids come from the turn's resolution and there is no schema field to put anything
|
||||
@@ -326,26 +326,26 @@ Each step is independently verifiable and lands green on its own.
|
||||
2. **Scope, CRUD and revisions.** The `internal/domain/memory` contract, the
|
||||
builtin engine with `HISTORY.md`, the store relocation, the scanner move, and
|
||||
the curator rewritten onto agent-user scope (it is the engine's only live
|
||||
consumer, so it belongs in this slice). *Depends on 1 for the curator half.*
|
||||
consumer, so it belongs in this slice). _Depends on 1 for the curator half._
|
||||
3. **Chat read path.** The `Memory` seam, the template block, subject resolution,
|
||||
and the composition-ordering fix. *Depends on 2.*
|
||||
and the composition-ordering fix. _Depends on 2._
|
||||
4. **Chat write path.** The tool adapter onto CRUD and the turn's subject on the
|
||||
context. *Depends on 3, because a write is only observable through the read.*
|
||||
context. _Depends on 3, because a write is only observable through the read._
|
||||
5. **Delete `internal/memory` and the dead config/dashboard surface**, and
|
||||
rewrite the "Memory engine family" section of
|
||||
`docs/architecture/plugins-and-extensions.md` to describe the
|
||||
engine family rather than a manager it deleted. *Depends on 3 and 4.*
|
||||
engine family rather than a manager it deleted. _Depends on 3 and 4._
|
||||
|
||||
Steps 3 and 4 are separable from each other; step 1 is separable from everything.
|
||||
|
||||
## Settles these open items in `migration-decisions.md` §5
|
||||
|
||||
| §5 open item | Settled by |
|
||||
|---|---|
|
||||
| §5 open item | Settled by |
|
||||
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| authoritative memory record and revision model | §1, §2 — the live marker becomes JSON, since the ratified `<!--mem:<ulid>-->` cannot carry provenance; superseded states live in a per-scope `HISTORY.md` |
|
||||
| provider and infrastructure boundaries | §2 — contract in `internal/domain/memory`, builtin format in `internal/infrastructure/memory/builtin` |
|
||||
| retrieval and access enforcement | §1 — caller-named scope sets, no engine-side policy |
|
||||
| provenance representation | §2 |
|
||||
| provider and infrastructure boundaries | §2 — contract in `internal/domain/memory`, builtin format in `internal/infrastructure/memory/builtin` |
|
||||
| retrieval and access enforcement | §1 — caller-named scope sets, no engine-side policy |
|
||||
| provenance representation | §2 |
|
||||
|
||||
## Not determined
|
||||
|
||||
|
||||
@@ -7,28 +7,29 @@
|
||||
**Parent:** [`service-decomposition.md`](service-decomposition.md)
|
||||
**Prerequisites:** Gateway contract extraction (Phase 1), State Store extraction (Phase 2), UI extraction (Phase 3)
|
||||
|
||||
This document is the authoritative specification for Phase 4: Messaging Service extraction. It fixes the process boundary, configuration ownership, client contracts, security posture, readiness behavior, channel invariants, and deletion criteria required by `archie-core-8cda.6` and its child tasks.
|
||||
This document is the authoritative specification for Phase 4: Messaging Service extraction. It fixes the process boundary, configuration ownership, client contracts, security posture, readiness behaviour, channel invariants, and deletion criteria required by `archie-core-8cda.6` and its child tasks.
|
||||
|
||||
## Decision
|
||||
|
||||
The Messaging Service (`cmd/archie-messaging`, composed via `internal/app/archiemessaging`) owns external channel connections (Telegram, email, webhook) and dispatches inbound messages and commands to the standalone Gateway Service over gRPC via `messaging.ChatContract`.
|
||||
|
||||
It is a peer service to the UI Service and the daemon:
|
||||
|
||||
- It serves external chat participants across configured communication platforms.
|
||||
- It consumes Gateway's `messaging.ChatContract` exclusively for chat turn execution, streaming, session queries, cancellation, persona selection, and task control actions.
|
||||
- It holds no direct database connections, owns no LLM execution or model provider credentials, and has no dependency on the daemon runtime or the UI HTTP server.
|
||||
|
||||
## Boundary and Ownership
|
||||
|
||||
| Concern | Messaging Service owns | Messaging Service consumes | Messaging Service must not own or link |
|
||||
|---|---|---|---|
|
||||
| **Channel transports** | Telegram bot long-polling, Email IMAP/SMTP loops, Inbound Webhook HTTP listener | Gateway `ChatContract` | Direct LLM providers, model runtimes, tokenizer libraries |
|
||||
| **Turn dispatch** | Inbound message packaging, typing indicators, live streaming updates | `ChatContract.Route`, `ChatContract.Stream` | `gateway.Router`, `runtime.Runtime`, agent prompt builders |
|
||||
| **Sessions & History** | Platform-to-session key mapping, conversation thread ID translation | `ChatContract.GetSession`, `RecentMessages`, `RecentTurns` | store implementations, `SessionStore` database handles |
|
||||
| **Control & Actions** | Platform command parsing (`/status`, `/tasks`, `/cancel`, `/stop`, `/persona`) | `ChatContract.Snapshot`, `ApplyTaskAction`, `Cancel`, `SetPersona` | `daemon.Daemon`, workflow execution engine, worktree operations |
|
||||
| **Task Approvals** | Channel interactive keyboards, approval callbacks | `ChatContract.ApplyTaskAction` | Direct task status mutations, forge comment posters |
|
||||
| **Configuration** | Platform bot tokens, allowed sender/user IDs, webhook listen ports | `[chat.*]` channel configs, Gateway target/token | `config.Holder`, forge tokens, repo configs, agent container specs |
|
||||
| **Readiness** | Messaging process liveness, channel connectivity, Gateway probe | Gateway `ChatContract.Snapshot` | Internal daemon subsystem probes |
|
||||
| Concern | Messaging Service owns | Messaging Service consumes | Messaging Service must not own or link |
|
||||
| ---------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| **Channel transports** | Telegram bot long-polling, Email IMAP/SMTP loops, Inbound Webhook HTTP listener | Gateway `ChatContract` | Direct LLM providers, model runtimes, tokenizer libraries |
|
||||
| **Turn dispatch** | Inbound message packaging, typing indicators, live streaming updates | `ChatContract.Route`, `ChatContract.Stream` | `gateway.Router`, `runtime.Runtime`, agent prompt builders |
|
||||
| **Sessions & History** | Platform-to-session key mapping, conversation thread ID translation | `ChatContract.GetSession`, `RecentMessages`, `RecentTurns` | store implementations, `SessionStore` database handles |
|
||||
| **Control & Actions** | Platform command parsing (`/status`, `/tasks`, `/cancel`, `/stop`, `/persona`) | `ChatContract.Snapshot`, `ApplyTaskAction`, `Cancel`, `SetPersona` | `daemon.Daemon`, workflow execution engine, worktree operations |
|
||||
| **Task Approvals** | Channel interactive keyboards, approval callbacks | `ChatContract.ApplyTaskAction` | Direct task status mutations, forge comment posters |
|
||||
| **Configuration** | Platform bot tokens, allowed sender/user IDs, webhook listen ports | `[chat.*]` channel configs, Gateway target/token | `config.Holder`, forge tokens, repo configs, agent container specs |
|
||||
| **Readiness** | Messaging process liveness, channel connectivity, Gateway probe | Gateway `ChatContract.Snapshot` | Internal daemon subsystem probes |
|
||||
|
||||
## Target Service Shape
|
||||
|
||||
@@ -47,6 +48,7 @@ It is a peer service to the UI Service and the daemon:
|
||||
## Load-Bearing Channel Invariants
|
||||
|
||||
The Messaging Service preserves existing invariants defined in `AGENTS.md` and channel documentation:
|
||||
|
||||
1. **Telegram long-polling**: Must call `dropPendingUpdates(ctx, b)` before `b.Start(ctx)` and on `/restart`.
|
||||
2. **Telegram command menus**: Must register command menus simultaneously to `default`, `all_private_chats`, and `all_group_chats` via `commands.go` to prevent menu shadowing.
|
||||
3. **No UI detour**: Turns and task actions route directly to Gateway's `ChatContract`; no HTTP request may ever be sent to `archie-ui` or `internal/webui`.
|
||||
@@ -55,6 +57,7 @@ The Messaging Service preserves existing invariants defined in `AGENTS.md` and c
|
||||
## Configuration Ownership
|
||||
|
||||
`cmd/archie-messaging` reads only:
|
||||
|
||||
- `[services.gateway].target` and `[services.gateway].target_token` (or CLI flags).
|
||||
- `[chat.telegram]` (token, allowed user IDs).
|
||||
- `[chat.email]` (IMAP/SMTP host, ports, credentials).
|
||||
@@ -66,6 +69,7 @@ It does not read or decode `[forge]`, `[repos]`, `[models]`, `[providers]`, `[ru
|
||||
## Deletion Gate and Verification
|
||||
|
||||
The extraction is guarded by `cmd/archie-messaging/architecture_test.go`, verifying that `go list -deps ./cmd/archie-messaging` links zero banned runtime packages:
|
||||
|
||||
- `modernc.org/sqlite`, `github.com/jackc/pgx`, `internal/infrastructure/postgres` and `internal/infrastructure/legacyread` (State Store)
|
||||
- `internal/daemon`, `internal/app/archied`, `internal/container`, `internal/worktree` (Daemon runtime)
|
||||
- `internal/domain/workflow`, `internal/agentexec`, `internal/taskrun` (Workflow engine)
|
||||
|
||||
@@ -14,22 +14,22 @@ not started, because it needs a schema-generation mechanism the parent
|
||||
doc deliberately deferred: "This document does not attempt to design the
|
||||
full generator." This is that design.
|
||||
|
||||
## Do not invent a new mechanism -- generalize the one used three times
|
||||
## Do not invent a new mechanism -- generalise the one used three times
|
||||
|
||||
Yaegi-interpreted extension code with a fixed, resolved-by-name exported
|
||||
function already exists in this codebase for three surfaces, and all three
|
||||
follow the identical shape:
|
||||
|
||||
| Surface | Fixed signature | Export path | Symbol table |
|
||||
|---|---|---|---|
|
||||
| Custom gate (`internal/gate/gateeval`) | `func(gate.GateContext) []gate.Finding` | `"gate.Check"` | `gateextract.Symbols` |
|
||||
| Workflow stage plugin (`skillbuild`) | stage-specific | skill-declared | `wfextract.Symbols` |
|
||||
| Skill plugin (`internal/skill/plugin.go`) | `func(string) string` | `"main.Run"` | none (stdlib only) |
|
||||
| Surface | Fixed signature | Export path | Symbol table |
|
||||
| ----------------------------------------- | --------------------------------------- | -------------- | --------------------- |
|
||||
| Custom gate (`internal/gate/gateeval`) | `func(gate.GateContext) []gate.Finding` | `"gate.Check"` | `gateextract.Symbols` |
|
||||
| Workflow stage plugin (`skillbuild`) | stage-specific | skill-declared | `wfextract.Symbols` |
|
||||
| Skill plugin (`internal/skill/plugin.go`) | `func(string) string` | `"main.Run"` | none (stdlib only) |
|
||||
|
||||
Each is: read a `.go` file -> `yaegiutil.New` with that surface's symbol
|
||||
table -> `yaegiutil.Resolve[T](i, src, exportPath)` -> call the resolved
|
||||
function wrapped in `yaegiutil.Safe` for panic recovery. **Module is a
|
||||
fourth instance of this same shape**, parameterized by action kind instead
|
||||
fourth instance of this same shape**, parameterised by action kind instead
|
||||
of hardcoded to one fixed signature. No new interpreter construction, no
|
||||
new panic-recovery mechanism, no new symbol-table generation tool --
|
||||
`go generate ... yaegi extract` is already how `wfextract`/`gateextract`
|
||||
@@ -173,7 +173,7 @@ side effect. Concretely:
|
||||
## Recommended first slice
|
||||
|
||||
1. `internal/domain/eda/module` package: `ModuleRegistry`, the
|
||||
discover/resolve/invoke mechanics, generalizing `gateeval`'s pattern.
|
||||
discover/resolve/invoke mechanics, generalising `gateeval`'s pattern.
|
||||
2. One proof-of-concept kind, side-effect-free (`log`), with its schema
|
||||
source + generated extract file, to prove schema -> `go:generate` ->
|
||||
Yaegi load -> registry -> playbook dispatch end to end.
|
||||
@@ -205,7 +205,7 @@ registry as-is.
|
||||
to declare its kind name explicitly (frontmatter-style, like a skill's
|
||||
`metadata.archie.workflow`) or is the kind inferred from directory/file
|
||||
naming (`module/notify/impl.go` implies kind `notify`)? Follow the
|
||||
skill catalog's existing declared-metadata convention unless there's a
|
||||
skill catalogue's existing declared-metadata convention unless there's a
|
||||
reason not to -- not decided here.
|
||||
2. **Where schema source files live.** This doc assumes
|
||||
`internal/domain/eda/module/<kind>/types.go` per kind, but the exact
|
||||
|
||||
@@ -1,109 +1,64 @@
|
||||
# Public news and per-version release notes -- decision
|
||||
# Public news and per-version release notes
|
||||
|
||||
**Status:** Approved
|
||||
**Date:** 2026-09-21
|
||||
**Beads issue:** `archie-core-2ncm.2`
|
||||
**Superseded in part:** `docs/prds/release-stream-and-commit-rules.md` supersedes the
|
||||
sections "Source of truth" and "Two components" below. There is now one release
|
||||
stream: a single `CHANGELOG.md` carries every release section, the per-component
|
||||
`CHANGELOG.archied.md` and `CHANGELOG.archie.md` are deleted, and one `vX.Y.Z` tag
|
||||
names a release. The rest of this document still holds.
|
||||
**Superseded in part:** `docs/prds/release-stream-and-commit-rules.md` defines the
|
||||
single release stream. `CHANGELOG.md` carries every release and one `vX.Y.Z` tag
|
||||
names each release.
|
||||
|
||||
A public news page and a release-notes page for every version. Both are derived
|
||||
from the changelogs the release process already produces, so publishing a
|
||||
release adds no writing. Part A is the derivation and the artifact any renderer
|
||||
consumes; it is not tied to MkDocs. Part B is the MkDocs rendering that
|
||||
publishes them at `offloaded.dev/news/`.
|
||||
The Astro website renders public news and per-version release notes from the
|
||||
artifacts generated here. Both derive from `CHANGELOG.md`, so publishing a
|
||||
release adds no writing.
|
||||
|
||||
## Part A -- release facts and their derivation
|
||||
## Source of truth
|
||||
|
||||
### Source of truth
|
||||
Release notes come from the frozen sections in `CHANGELOG.md`:
|
||||
`tools/release.sh --prepare` writes a section, and `--tag` refuses to tag a
|
||||
version without it. The generated artifact has one entry per release version.
|
||||
|
||||
Release notes come from `CHANGELOG.archied.md` and `CHANGELOG.archie.md`. Those
|
||||
are the release process's frozen notes: `tools/release.sh --prepare` writes a
|
||||
section, the maintainer edits it, and `--tag` refuses to tag a version without
|
||||
its section. A page exists exactly for a release the process cut, and no second
|
||||
copy of release prose can drift from the changelog.
|
||||
Tags and raw commits are not the source. The changelog is the edited release
|
||||
record, and its `## [<version>] - <date>` headings provide the version and date.
|
||||
|
||||
Tags are not the source. CI and deployment check out shallow, so tags are absent
|
||||
from a site build; the changelogs are always present and their
|
||||
`## [<version>] - <date>` headings carry the same version and date the tags
|
||||
carry. Raw commits are not the source either: the changelog is the edited text,
|
||||
not the commit list.
|
||||
## Release data
|
||||
|
||||
### What a version's notes contain
|
||||
The generator skips `## [Unreleased]`. Any other `## [` heading that is not
|
||||
`[version] - date` stops generation. A relative Markdown link in a changelog
|
||||
body also stops generation because the Astro site must be able to render the
|
||||
content without depending on repository-relative paths.
|
||||
|
||||
The version and date parsed from the section heading, and the section body
|
||||
unchanged. The body keeps the maintainer's headings and bullets; the generator
|
||||
does not regroup them into feature and fix categories, because those categories
|
||||
exist only on commits the edited changelog does not preserve.
|
||||
`archied` and `archie-agent` version independently. Each
|
||||
`docs/news/releases.json` entry carries the tag prefix (`archied`, `archie`),
|
||||
product name (`archied`, `archie-agent`), version, date, and changelog body.
|
||||
`docs/news/redirects.json` maps retired per-component news URLs to each unified
|
||||
release route. The Astro site must apply this table so previously published
|
||||
release URLs continue to resolve.
|
||||
|
||||
`## [Unreleased]` is skipped. Any other `## [` heading that is not
|
||||
`[version] - date` stops generation, so a malformed heading cannot silently drop
|
||||
a release. A relative Markdown link in a body stops generation too: a rendered
|
||||
page sits at a different depth from the changelog, and a host's link checking
|
||||
would fail on the dead link. Absolute links pass through.
|
||||
Both JSON files are committed generated artifacts. `task news` regenerates
|
||||
them, `task news:check` detects drift, and `tools/release.sh --tag` regenerates
|
||||
and stages them with the release commit. The Astro site renders from these
|
||||
artifacts rather than re-parsing `CHANGELOG.md`.
|
||||
|
||||
### Two components
|
||||
## Site ownership
|
||||
|
||||
`archied` and `archie-agent` version independently and either can be held back,
|
||||
so the data carries the tag prefix (`archied`, `archie`), the product name
|
||||
(`archied`, `archie-agent`), and the version as separate fields. A release that
|
||||
moved one component is one entry. The generator never pairs two component
|
||||
versions or invents a combined product version.
|
||||
|
||||
### The canonical artifact
|
||||
|
||||
`docs/news/releases.json` is the host hand-off: a committed, generated,
|
||||
newest-first array of `{component, name, version, date, body}`. Every adapter
|
||||
renders from this file rather than re-parsing a changelog. The JSON is the
|
||||
contract; a host adapter may add markup, but not facts.
|
||||
|
||||
### Zero per-release maintenance
|
||||
|
||||
`task news` regenerates the JSON and the MkDocs pages from the changelogs.
|
||||
`task news:check` regenerates them in a temporary directory and fails when the
|
||||
committed files differ; it runs in `task check`, so a changelog edit cannot land
|
||||
without its regeneration. `tools/release.sh --tag` regenerates and stages them
|
||||
in the release commit, so a tag's tree carries its own facts.
|
||||
|
||||
The generator owns `docs/news/releases.json`, `docs/news/index.md` and the two
|
||||
component directories end-to-end: it rewrites expected files and reports an
|
||||
unexpected file in a component directory as drift. It leaves every other file
|
||||
under `docs/news/` alone, so a future hand-written announcement is not its
|
||||
business.
|
||||
|
||||
## Part B -- publishing
|
||||
|
||||
MkDocs is the host. `docs/news/index.md` is the news page: date-grouped, newest
|
||||
first, one entry per release carrying the component, the version, and a link to
|
||||
its notes. `docs/news/archied/<version>.md` and `docs/news/archie/<version>.md`
|
||||
hold the notes. `site_url` is `https://offloaded.dev/`, so the pages are served
|
||||
at `offloaded.dev/news/`.
|
||||
|
||||
The version pages stay out of the derived navigation (`not_in_nav` in
|
||||
`mkdocs.yml`) while remaining published; the news page is their entry point, so
|
||||
a version list that grows with every release cannot push the architecture tree
|
||||
off the screen.
|
||||
|
||||
A different renderer would read `docs/news/releases.json` instead of these
|
||||
Markdown files. That is a separate change in that renderer's repository and
|
||||
does not alter Part A; the JSON, not the Markdown, is the reusable half.
|
||||
The Astro website is maintained outside this repository and serves the
|
||||
documentation at `offloaded.dev/docs/`. This repository generates and validates
|
||||
the news and documentation data artifacts; it does not build, preview, or
|
||||
deploy the Astro site.
|
||||
|
||||
## Not in scope
|
||||
|
||||
- Generated summaries, categories, or section headings; the changelog has no
|
||||
structured summary field to derive one from.
|
||||
- Per-release download or install links; where to get the artifacts is
|
||||
documented once, not restated for every version.
|
||||
- Hand-written news items. The generated page lists releases.
|
||||
- Changes to `infra/ansible`. Serving the site at a hostname other than
|
||||
`offloaded.dev` is an infrastructure decision.
|
||||
documented once, not restated for every release.
|
||||
- Hand-written news items.
|
||||
- Changes to `infra/ansible` or to the external Astro website repository.
|
||||
|
||||
## Verification
|
||||
|
||||
- `go test ./tools/newsgen/...` covers parsing, ordering, rendering, the link
|
||||
and heading refusals, and check-mode drift.
|
||||
- `go test ./tools/newsgen/...` covers parsing, ordering, artifact generation,
|
||||
heading and link refusals, and check-mode drift.
|
||||
- `task news:check` passes inside `task check`.
|
||||
- `task docs:site` builds the MkDocs adapter under `--strict`, which fails on a
|
||||
dead internal link.
|
||||
- `task docs:artifact:check` verifies the generated documentation data against
|
||||
its Markdown sources.
|
||||
@@ -6,7 +6,7 @@
|
||||
This PRD reuses the adversarial-self-review contract
|
||||
(`docs/prds/adversarial-self-review.md`) and the `workflow.Reviewer` /
|
||||
`workflow.ReviewReport` types from `internal/domain/workflow`. It decides
|
||||
only what is new: how an operator asks for a review of an *existing* PR, and
|
||||
only what is new: how an operator asks for a review of an _existing_ PR, and
|
||||
how that PR's content reaches the reviewer.
|
||||
|
||||
## Problem
|
||||
@@ -29,14 +29,14 @@ planner/builder.
|
||||
|
||||
1. **Forge read.** `GetPullRequest(owner, repo, number)` returns a
|
||||
forge-neutral `PullRequest{Number, Title, Body, HeadRef, BaseRef, HeadSHA,
|
||||
BaseSHA, State}`. Declared as a narrow `PullRequestReader` interface,
|
||||
BaseSHA, State}`. Declared as a narrow `PullRequestReader` interface,
|
||||
implemented by GitHub and Gitea; the noop forge does not implement it, so
|
||||
the composition root type-asserts and refuses review with "forge does not support PR
|
||||
review". Adding to the fat `Forge` interface would churn every test fake for
|
||||
a capability the noop forge cannot honestly provide.
|
||||
|
||||
2. **Materialisation.** `worktree.Manager.CheckoutPR(owner, repo, headRef,
|
||||
baseRef)` clones the repository fully and checks out `origin/<headRef>`.
|
||||
baseRef)` clones the repository fully and checks out `origin/<headRef>`.
|
||||
`Diff(dir, baseRef)` and `Snapshot(dir, destDir)` then work unchanged:
|
||||
`Diff` resolves `origin/<baseRef>` via the existing `resolveBase`, and
|
||||
`Snapshot` strips `.git` exactly as the workflow stage does. The head must
|
||||
@@ -57,7 +57,7 @@ planner/builder.
|
||||
shape (gateway states what it needs, the composition root adapts — the
|
||||
`ChatTaskActor` pattern).
|
||||
|
||||
5. **Authorization.** Identity-scoped repository allow-list, the
|
||||
5. **Authorisation.** Identity-scoped repository allow-list, the
|
||||
`task_spawn` rule: a chat identity may only review a repo in its
|
||||
`TaskProfile.Repos`. `identity == nil` denotes an authenticated dashboard
|
||||
operator who may review any configured repository.
|
||||
|
||||
@@ -29,17 +29,18 @@ by the policies over it, never by the event that started it.
|
||||
Signing in and verifying credentials stay separate from identity; identity
|
||||
is who acts. Memberships, roles, grants and audit records all reference the
|
||||
identity ID.
|
||||
|
||||
- **Instance admin.** Operates the installation: orgs, the sign-in provider,
|
||||
instance policies. Instance admins see an org's resources only as members
|
||||
of it.
|
||||
|
||||
## What belongs where
|
||||
|
||||
| Level | Owns |
|
||||
|---|---|
|
||||
| Instance | the shipped workflow catalogue, instance policies |
|
||||
| Org | members, identities and their grants, secrets, agent profiles, workspaces, org workflows and their enabled state |
|
||||
| Workspace | sources, event types, mappings, bindings, runs, captures, run events and logs, chat sessions, memory |
|
||||
| Level | Owns |
|
||||
| --------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| Instance | the shipped workflow catalogue, instance policies |
|
||||
| Org | members, identities and their grants, secrets, agent profiles, workspaces, org workflows and their enabled state |
|
||||
| Workspace | sources, event types, mappings, bindings, runs, captures, run events and logs, chat sessions, memory |
|
||||
|
||||
Every owned record carries its `org_id`, and workspace records also carry their
|
||||
`workspace_id`. An identity, secret or profile is used in a workspace only
|
||||
@@ -112,12 +113,12 @@ instance (+ network rules) ─▶ org ─▶ workspace ─▶ identity + workflo
|
||||
Archie ships these org roles as policies. A member may hold a different role in
|
||||
each workspace.
|
||||
|
||||
| Role | Can |
|
||||
|---|---|
|
||||
| Owner | everything in the org, including members, identities, policies and deleting the org |
|
||||
| Admin | everything except deleting the org and changing owners |
|
||||
| Developer | create and edit workspace resources and org workflows; run workflows; read logs |
|
||||
| Viewer | read everything except secret values |
|
||||
| Role | Can |
|
||||
| --------- | ----------------------------------------------------------------------------------- |
|
||||
| Owner | everything in the org, including members, identities, policies and deleting the org |
|
||||
| Admin | everything except deleting the org and changing owners |
|
||||
| Developer | create and edit workspace resources and org workflows; run workflows; read logs |
|
||||
| Viewer | read everything except secret values |
|
||||
|
||||
### Approvals
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
|
||||
Answers what a "mapping" is, where it lives, and what "resolve against a
|
||||
real event" means precisely enough to implement. `t2db.4` (binding: matcher
|
||||
+ mapping + workflow) is out of scope -- this bead ships the mapping
|
||||
concept and its preview only, as a standalone entity `t2db.4` will later
|
||||
reference by ID.
|
||||
|
||||
- mapping + workflow) is out of scope -- this bead ships the mapping
|
||||
concept and its preview only, as a standalone entity `t2db.4` will later
|
||||
reference by ID.
|
||||
|
||||
## Decision: a new `internal/domain/mapping` package, SQLite storage
|
||||
|
||||
@@ -104,7 +105,7 @@ the operator every problem at once, not the first one.
|
||||
it against an operator-picked capture and renders every result, pass or
|
||||
fail, in the UI -- that satisfies this bead's "fail loudly" acceptance
|
||||
criterion, because at this stage the only runtime consumer of a mapping
|
||||
*is* the human previewing it. `t2db.4` will call the identical function
|
||||
_is_ the human previewing it. `t2db.4` will call the identical function
|
||||
when a live event triggers a binding and turn any non-empty `failures` into
|
||||
a visible operator-facing failure (park the task / surface in the
|
||||
inspector) instead of starting a workflow with blank fields -- that wiring
|
||||
@@ -131,7 +132,7 @@ bypass -- unlike capture, nothing here accepts unauthenticated input):
|
||||
- `GET /api/mappings` / `POST /api/mappings` -- list / create
|
||||
- `GET|PATCH|DELETE /api/mappings/{id}`
|
||||
- `POST /api/mappings/preview` -- body `{fields: []Field, capture_id:
|
||||
int64}`, calls `mapping.Resolve` against that capture's stored (already
|
||||
int64}`, calls `mapping.Resolve` against that capture's stored (already
|
||||
redacted) `Body` and returns `{values, failures}`. Deliberately takes
|
||||
loose `fields` rather than a saved mapping ID, so an operator can iterate
|
||||
before saving anything -- "never ship a mapping the operator has not seen
|
||||
|
||||
@@ -33,13 +33,13 @@ actions:
|
||||
position: module
|
||||
kind: log
|
||||
args:
|
||||
message: '"build finished"' # literal
|
||||
when: 'event.label == "bugfix"' # gate on event field
|
||||
message: '"build finished"' # literal
|
||||
when: 'event.label == "bugfix"' # gate on event field
|
||||
- position: module
|
||||
kind: log
|
||||
args:
|
||||
message: '"done: " + string(actions.build.result.written)'
|
||||
when: 'actions.build.result.written == true'
|
||||
when: "actions.build.result.written == true"
|
||||
```
|
||||
|
||||
## Trust boundary of the expression
|
||||
@@ -48,7 +48,7 @@ A playbook YAML is **operator-installed, in-process, daemon-privileged**
|
||||
-- the same tier as `ModuleDir`/`PluginDir`/`SecretEngineDir`
|
||||
(module-position.md's trust-boundary section): loaded from a configured
|
||||
directory at startup, never from a webhook body or task worktree. The
|
||||
schema-by-example flow uses live events to *design against*; the saved
|
||||
schema-by-example flow uses live events to _design against_; the saved
|
||||
playbook is operator-authored file content in an operator-configured
|
||||
location.
|
||||
|
||||
@@ -90,8 +90,8 @@ expression body.
|
||||
The plugin engine rule forbids a generic `Module` interface with an
|
||||
`any` payload; it exists to keep static implementation contracts
|
||||
typed. Evaluating CEL against runtime `map[string]any` is **not the
|
||||
same problem**: the rule concerns *implementation contracts* (static
|
||||
operations a capability family exposes), not *runtime data values*
|
||||
same problem**: the rule concerns _implementation contracts_ (static
|
||||
operations a capability family exposes), not _runtime data values_
|
||||
(legitimately dynamic -- an event payload's shape is unknown until it
|
||||
arrives). The Module contract stays fully typed (generated
|
||||
`Args`/`Result` schemas); CEL is a read-only data reader under the
|
||||
@@ -102,9 +102,9 @@ playbook engine family, not a new capability contract. Stated once.
|
||||
One flat context, namespaced from the playbook run, built at dispatch
|
||||
time:
|
||||
|
||||
| Name | Type | Source |
|
||||
|---|---|---|
|
||||
| `event` | `map(string, dyn)` | The triggering event's decoded payload (webhook body / forge issue / schedule tick). Field access via `event.<field>`, map access via `event["field"]`, presence via `has(event.<field>)`. |
|
||||
| Name | Type | Source |
|
||||
| --------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `event` | `map(string, dyn)` | The triggering event's decoded payload (webhook body / forge issue / schedule tick). Field access via `event.<field>`, map access via `event["field"]`, presence via `has(event.<field>)`. |
|
||||
| `actions` | per-playbook object type | Previous actions' results, one field per declared action `id` (`actions.<id>`), each field typed `{ result: <KindResult> }` so a later action reads an earlier one's `Result` struct (`actions.<id>.result.<field>`) with field-level checking. The current action and later actions are not present. |
|
||||
|
||||
Expressions may also read literal-only state (numbers, strings,
|
||||
@@ -153,13 +153,13 @@ This means the lint tool and the daemon share one checker
|
||||
|
||||
## Candidate comparison
|
||||
|
||||
| Candidate | Maintenance | Safety surface | Cost (measured) | Verdict |
|
||||
|---|---|---|---|---|
|
||||
| **CEL (cel.dev/cel-go)** | Actively maintained (google/cel, monthly releases) | Non-Turing-complete, linear eval, `CostLimit`/`CostTracking`/`ParserRecursionLimit`, no side effects, error values not panics | **+13.0MB** (2.34MB -> 15.25MB) | **Chosen** |
|
||||
| `expr-lang/expr` v1.17.8 | Actively maintained | Side-effect-free, `DisableAllBuiltins`, depth limits (CVE fixed w/ tests) | +3.9MB (2.34MB -> 6.28MB) | Not chosen: two safety CVEs this cycle; smaller ecosystem; no protobuf/type-model fit with future schema-gen |
|
||||
| `gval` v1.2.3 | Maintained, slower | No builtin-restriction surface; extras (ternary/`??`) not wanted | +3.0MB (2 transitive deps) | Not chosen |
|
||||
| `govaluate` | **ARCHIVED** (author archived 2024) | n/a | n/a | Not chosen: dead |
|
||||
| `starlark-go` | Maintained (Bazel) | Turing-complete with step limits | large (full language) | Not chosen: whole-language surface |
|
||||
| Candidate | Maintenance | Safety surface | Cost (measured) | Verdict |
|
||||
| ------------------------ | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| **CEL (cel.dev/cel-go)** | Actively maintained (google/cel, monthly releases) | Non-Turing-complete, linear eval, `CostLimit`/`CostTracking`/`ParserRecursionLimit`, no side effects, error values not panics | **+13.0MB** (2.34MB -> 15.25MB) | **Chosen** |
|
||||
| `expr-lang/expr` v1.17.8 | Actively maintained | Side-effect-free, `DisableAllBuiltins`, depth limits (CVE fixed w/ tests) | +3.9MB (2.34MB -> 6.28MB) | Not chosen: two safety CVEs this cycle; smaller ecosystem; no protobuf/type-model fit with future schema-gen |
|
||||
| `gval` v1.2.3 | Maintained, slower | No builtin-restriction surface; extras (ternary/`??`) not wanted | +3.0MB (2 transitive deps) | Not chosen |
|
||||
| `govaluate` | **ARCHIVED** (author archived 2024) | n/a | n/a | Not chosen: dead |
|
||||
| `starlark-go` | Maintained (Bazel) | Turing-complete with step limits | large (full language) | Not chosen: whole-language surface |
|
||||
|
||||
## Vetting record
|
||||
|
||||
@@ -200,7 +200,7 @@ Source reviewed at HEAD:
|
||||
|
||||
A bespoke grammar for the shipped cases (path read + comparison + bool
|
||||
composition) is small, but the load-time-validation requirement makes
|
||||
the comparison: the reject-at-load rule requires *field-level* static
|
||||
the comparison: the reject-at-load rule requires _field-level_ static
|
||||
checking of result paths against generated `Result` schemas, which is
|
||||
CEL's type-checker's job. Re-implementing that on a hand-rolled
|
||||
grammar means re-implementing a type system -- more code than the
|
||||
@@ -209,7 +209,7 @@ community surface for future expression needs (even declarative ones).
|
||||
The bespoke option only wins on binary size, and the size cost of CEL
|
||||
is measured and bounded.
|
||||
|
||||
## Judgment calls (flagged for sign-off)
|
||||
## Judgement calls (flagged for sign-off)
|
||||
|
||||
- **J1 -- `id` required on referenced actions, unknown id = load
|
||||
failure.** Matches the reject-at-load rule. Alternative considered: an alternative
|
||||
@@ -221,7 +221,7 @@ is measured and bounded.
|
||||
any value that reads context data is written in CEL. One mechanism,
|
||||
no interpolation marker, no second syntax to learn. Alternative considered: cEL
|
||||
string literals must be quoted inside YAML (e.g. `message:
|
||||
'"build finished"'`), which is slightly noisy for mostly-literal
|
||||
'"build finished"'`), which is slightly noisy for mostly-literal
|
||||
args; accepted for uniformity -- the linter catches quoting mistakes
|
||||
at load.
|
||||
- **J3 -- condition failure semantics.** A condition that errors at
|
||||
|
||||
@@ -86,14 +86,14 @@ The daemon resolves `PRNumber` → the task that owns it. An unmatched PR (not
|
||||
an archie task) is dropped with a counter — a public webhook must not be able
|
||||
to start an agent against an arbitrary repository. A PR whose task is merged,
|
||||
closed or archived is dropped through the same counter: the reaction is only
|
||||
ever work against a PR archie itself opened *and still owns*.
|
||||
ever work against a PR archie itself opened _and still owns_.
|
||||
|
||||
That lookup does not exist. `pr_number` is written by
|
||||
`internal/infrastructure/postgres/store.go` and never read in a `WHERE` clause, so this needs a
|
||||
`TaskStore` method keyed on `(owner, repo, pr_number)`, a matching
|
||||
`StateStoreService` RPC (a Go interface method on a store facade without one
|
||||
is forbidden, `CLAUDE.md`), and an index on those three columns. It is the
|
||||
authorization boundary, so it is sequenced as its own step below rather than
|
||||
authorisation boundary, so it is sequenced as its own step below rather than
|
||||
carried along with the envelope.
|
||||
|
||||
**Identity is derived from the resolved task, never carried in the reaction.**
|
||||
@@ -202,12 +202,12 @@ point 2) — but every other constraint holds: HMAC (already in the receiver),
|
||||
per-source rate limiting (add when the receiver gains a second event family),
|
||||
and blast radius bounded by the existing gate/sandbox/worktree enforcement,
|
||||
**plus** the new archie-owned-task check (decision 3), which is the actual
|
||||
authorization boundary: a review event only ever causes work against a PR
|
||||
authorisation boundary: a review event only ever causes work against a PR
|
||||
archie itself opened and still owns.
|
||||
|
||||
Accepting other bots' comments (decision 5) does not widen that boundary: an
|
||||
author is never a reason to act, only the owned-task check is. It does widen
|
||||
the *spend* surface, which the round cap bounds.
|
||||
the _spend_ surface, which the round cap bounds.
|
||||
|
||||
### 7. Sequencing
|
||||
|
||||
@@ -220,7 +220,7 @@ the *spend* surface, which the round cap bounds.
|
||||
stream. This step is first because nothing after it can be exercised
|
||||
without it.
|
||||
2. `PullRequestReviewReader` + GitHub/Gitea implementations + `ReplyToReview`.
|
||||
*(Landed.)*
|
||||
_(Landed.)_
|
||||
3. `ReviewCommentEnvelope` + the kinded idempotency key.
|
||||
4. **The owned-task guard**: `(owner, repo, pr_number)` lookup, its
|
||||
`StateStoreService` RPC, its index, and the drop-with-counter path for an
|
||||
@@ -233,7 +233,7 @@ the *spend* surface, which the round cap bounds.
|
||||
8. Tests + `task check`.
|
||||
|
||||
Steps 6 and 7 are the producers and come last on purpose. Building a producer
|
||||
before its consumer and its authorization guard yields a path that publishes
|
||||
before its consumer and its authorisation guard yields a path that publishes
|
||||
into nothing, and becomes an unguarded intake the moment a stream appears.
|
||||
|
||||
## Out of scope
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
The bridge-tool pattern is **implemented and tested** in
|
||||
`internal/tools/disclosure.go` (`tool_search`, `tool_describe`, `tool_call`
|
||||
+ `ContextPressureGate` + `DisclosureMode`, section 17.14/17.15) — but it is
|
||||
**never wired into the daemon**. `BridgeTools` and `ContextPressureGate` are
|
||||
referenced only in `disclosure_test.go`. This task is therefore a **wiring**
|
||||
task, not a feature build.
|
||||
|
||||
- `ContextPressureGate` + `DisclosureMode`, section 17.14/17.15) — but it is
|
||||
**never wired into the daemon**. `BridgeTools` and `ContextPressureGate` are
|
||||
referenced only in `disclosure_test.go`. This task is therefore a **wiring**
|
||||
task, not a feature build.
|
||||
|
||||
Wire the existing bridge into the per-chat-turn toolset:
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ contributor material with no signal that it is not for them.
|
||||
|
||||
One source tree, two published sets, two artifacts, two URL bases.
|
||||
|
||||
| Set | Holds | Served under | Artifact |
|
||||
|---|---|---|---|
|
||||
| Public | `index.md`, `guides/` | `/docs/` | `docs/data/generated/docs.json` |
|
||||
| Development | `architecture/`, `prds/` | `/dev/` | `docs/data/generated/dev-docs.json` |
|
||||
| Set | Holds | Served under | Artifact |
|
||||
| ----------- | ------------------------ | ------------ | ----------------------------------- |
|
||||
| Public | `index.md`, `guides/` | `/docs/` | `docs/data/generated/docs.json` |
|
||||
| Development | `architecture/`, `prds/` | `/dev/` | `docs/data/generated/dev-docs.json` |
|
||||
|
||||
`archive/`, `inspiration/`, `news/` and `github-token.md` stay out of both, for
|
||||
the reasons the generator already records.
|
||||
|
||||
@@ -125,7 +125,7 @@ is a pipeline that can be forgotten, which is the property this change removes.
|
||||
trigger is also not dependent on repairing manual triggering: in this estate a manual
|
||||
run fails with zero steps while the same configuration runs on a push, and the
|
||||
estate's own Woodpecker configurations trigger on push with cron, manual or
|
||||
pull-request events *added* to it rather than instead of it.
|
||||
pull-request events _added_ to it rather than instead of it.
|
||||
|
||||
**Prerequisite: Woodpecker must watch this repository.** Adding the workflow to the
|
||||
repository and enabling the repository in Woodpecker are two steps, and the second is
|
||||
|
||||
@@ -13,7 +13,7 @@ The shipped contract (`internal/domain/workflow/review_findings.go`, h019.2)
|
||||
already makes only a **confirmed** error-level finding block
|
||||
(`Blocking() == Verdict == confirmed && Level == error`), and a zero-finding
|
||||
review is already distinguishable from one that never ran (`ReviewStatus`).
|
||||
What is missing is the other half: a reviewer can report *nothing*
|
||||
What is missing is the other half: a reviewer can report _nothing_
|
||||
and say only "I found nothing" in free text. The operator cannot tell "I
|
||||
checked the five things that matter and they are clean" from "I did not look."
|
||||
That is the failure the epic names -- a findings surface that consumes attention
|
||||
|
||||
@@ -49,7 +49,7 @@ edits to an old version.
|
||||
|
||||
The API has four operations:
|
||||
|
||||
1. **Catalog** tells clients what can be viewed or changed and how to edit it.
|
||||
1. **Catalogue** tells clients what can be viewed or changed and how to edit it.
|
||||
2. **Query** reads data and versions without exposing secrets.
|
||||
3. **Command** asks the owning feature to make a change.
|
||||
4. **Watch** streams changes and errors to clients.
|
||||
@@ -95,7 +95,7 @@ A workflow is a list of steps. Each step has a known type and its own settings.
|
||||
Plugins can add step types. Each run keeps the workflow version it started with.
|
||||
|
||||
Yaegi, `.archie/stages/*.go`, and `.archie/gate.go` will be removed. Their useful
|
||||
behavior must first be available as normal workflow steps.
|
||||
behaviour must first be available as normal workflow steps.
|
||||
|
||||
## First implementation
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Epic: `archie-core-hj1t` / GitHub `#804` ("[EPIC] Self-update: artifact
|
||||
install, topology migration, journaled transaction").
|
||||
|
||||
The update *contract* (`internal/releaseupdate`: `Catalog.Check`,
|
||||
The update _contract_ (`internal/releaseupdate`: `Catalog.Check`,
|
||||
`Installer.Install`, plus defer/watchdog/verify) is settled and unchanged by
|
||||
this document — it stays a thin Go interface shelling out to
|
||||
`CommandCatalog`/`CommandInstaller`. This document decides what the reference
|
||||
@@ -41,7 +41,7 @@ daemon fails at `bootstrap.go`'s `[services.state].target` check with no
|
||||
prior diagnosis. The self-refresh trap is confirmed at
|
||||
`scripts/archie-update-install:195-199`: new adapter copies land on disk but
|
||||
bash keeps executing the in-memory copy, so a pre-flight check added to the
|
||||
script only protects the *next* update.
|
||||
script only protects the _next_ update.
|
||||
|
||||
## Design
|
||||
|
||||
@@ -75,7 +75,7 @@ not `task check`.
|
||||
|
||||
### Topology migration (`#804` item 2)
|
||||
|
||||
**Decision.** Add a topology *observer* to the daemon, not the shell
|
||||
**Decision.** Add a topology _observer_ to the daemon, not the shell
|
||||
adapter — CLAUDE.md's own "known trap" note says the shell copy is defence
|
||||
in depth only, and the daemon is what "knows the deployment and holds the
|
||||
approved snapshot." The observer inspects which systemd user units exist
|
||||
@@ -107,11 +107,11 @@ declared topology matches the units `install.sh` would create for it.
|
||||
|
||||
**Failure mapping.**
|
||||
|
||||
| condition | contract error |
|
||||
|---|---|
|
||||
| condition | contract error |
|
||||
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
||||
| observed topology cannot be determined (systemctl unavailable, non-systemd host) | refuse with "topology unknown" plan naming the manual steps, never guess |
|
||||
| required units missing, migration plan derivable | apply plan before binary install, in dependency order |
|
||||
| required units missing, no derivable plan (e.g. conflicting existing unit) | refuse, print the plan, do not proceed |
|
||||
| required units missing, migration plan derivable | apply plan before binary install, in dependency order |
|
||||
| required units missing, no derivable plan (e.g. conflicting existing unit) | refuse, print the plan, do not proceed |
|
||||
|
||||
**Testing.** `ObservedTopology`/`MigrationPlan` comparison logic is pure —
|
||||
table-driven unit tests belong in `task check`. Actual `systemctl` inspection
|
||||
@@ -130,7 +130,7 @@ atomically rename over the live path (`rename(2)` is atomic on the same
|
||||
filesystem — this replaces whatever non-atomic copy the current script uses)
|
||||
rather than overwriting in place; (4) run each replaced binary's existing
|
||||
health/ready check (the same checks `internal/domain/health` already exposes
|
||||
per the health registry pattern, not a new one) against the *candidate*, not
|
||||
per the health registry pattern, not a new one) against the _candidate_, not
|
||||
a hardcoded default port/binary; (5) hold the process open for a bounded
|
||||
observation window (e.g. 120s) watching for crash-loop before declaring
|
||||
success; (6) on any failure at any stage, roll back using the journal:
|
||||
@@ -150,11 +150,11 @@ existing bootstrap sequencing).
|
||||
|
||||
**Failure mapping.**
|
||||
|
||||
| condition | contract error |
|
||||
|---|---|
|
||||
| lock held by another update | refuse immediately, name the holder's PID/journal |
|
||||
| health check fails post-switch | automatic rollback within the observation window, journal records the failure reason |
|
||||
| crash mid-transaction, journal present at boot | daemon completes rollback before normal startup, logs it |
|
||||
| condition | contract error |
|
||||
| ---------------------------------------------- | ------------------------------------------------------------------------------------ |
|
||||
| lock held by another update | refuse immediately, name the holder's PID/journal |
|
||||
| health check fails post-switch | automatic rollback within the observation window, journal records the failure reason |
|
||||
| crash mid-transaction, journal present at boot | daemon completes rollback before normal startup, logs it |
|
||||
|
||||
**Testing.** Stage-then-rename and rollback logic against a fixture
|
||||
directory tree is fully fakeable — `task check`. Real systemd unit
|
||||
@@ -163,7 +163,7 @@ start/stop as part of rollback needs a real host; manual smoke command.
|
||||
### Channel, pinning, automation (`#804` item 4)
|
||||
|
||||
**Decision.** Add `channel = "stable" | "next" | "<exact-version-pin>"`
|
||||
to whatever config section already governs update behavior (next to
|
||||
to whatever config section already governs update behaviour (next to
|
||||
`ARCHIE_UPDATE_CHANNEL`'s existing chat-channel field in
|
||||
`internal/releaseupdate/command.go` — name this new field distinctly,
|
||||
e.g. `ReleaseChannel`, to avoid colliding with the existing chat-notification
|
||||
@@ -190,27 +190,27 @@ is a shell-script unit test against a fixture profile.
|
||||
|
||||
## Call site inventory
|
||||
|
||||
| concern | file | change |
|
||||
|---|---|---|
|
||||
| Update contract (Catalog/Installer interfaces) | `internal/releaseupdate/service.go` | none — already handles this |
|
||||
| Command adapters | `internal/releaseupdate/command.go` | new `ReleaseChannel` field distinct from existing chat-channel field |
|
||||
| Install script body | `scripts/archie-update-install:139-160,170,195-199` | replace clone+compile default with download+verify; add journal, lock, stage-then-rename, digest check |
|
||||
| CI release publishing | `.github/workflows/deploy.yml` | none — already handles this |
|
||||
| Deployment profiles | `deployments/*.toml` | none — already digest-pinned |
|
||||
| First-install unit creation | `install.sh:414-445` | change — consume shared topology declaration |
|
||||
| Topology assertions | `deployment_contract_test.go` | new assertion: profile topology matches install.sh output |
|
||||
| Topology observation | `internal/app/archied/bootstrap.go` (new sibling code) | new |
|
||||
| Resume-on-boot rollback | `internal/app/archied` startup | new |
|
||||
| Health check reuse for candidate verification | `internal/domain/health` | reuse — confirm exact symbol before implementing |
|
||||
| concern | file | change |
|
||||
| ------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
|
||||
| Update contract (Catalogue/Installer interfaces) | `internal/releaseupdate/service.go` | none — already handles this |
|
||||
| Command adapters | `internal/releaseupdate/command.go` | new `ReleaseChannel` field distinct from existing chat-channel field |
|
||||
| Install script body | `scripts/archie-update-install:139-160,170,195-199` | replace clone+compile default with download+verify; add journal, lock, stage-then-rename, digest check |
|
||||
| CI release publishing | `.github/workflows/deploy.yml` | none — already handles this |
|
||||
| Deployment profiles | `deployments/*.toml` | none — already digest-pinned |
|
||||
| First-install unit creation | `install.sh:414-445` | change — consume shared topology declaration |
|
||||
| Topology assertions | `deployment_contract_test.go` | new assertion: profile topology matches install.sh output |
|
||||
| Topology observation | `internal/app/archied/bootstrap.go` (new sibling code) | new |
|
||||
| Resume-on-boot rollback | `internal/app/archied` startup | new |
|
||||
| Health check reuse for candidate verification | `internal/domain/health` | reuse — confirm exact symbol before implementing |
|
||||
|
||||
## Execution: multi-agent team breakdown
|
||||
|
||||
| sub-feature | issue | implementer scope | suggested council lenses | why |
|
||||
|---|---|---|---|---|
|
||||
| Artifact install | item 1 (file if unfiled) | `archie-update-install` download+verify, opt-in source-build flag | `lens-deletionist` | must not leave the clone+compile path as silent default cruft |
|
||||
| Topology migration | item 2 (file if unfiled) | daemon-side observer, `release.json` schema, `install.sh` consumption, contract test | `lens-boundary`, `lens-operator` | boundary: observation belongs in daemon not shell; operator: refusal-with-plan is the whole safety property |
|
||||
| Journaled transaction | item 3 (file if unfiled) | journal format, stage-then-rename, lock, resume-on-boot | `lens-operator`, `lens-maintainer` | operator: crash-mid-update is the core failure mode; maintainer: someone must be able to read a journal file during an incident |
|
||||
| Channel/pinning/automation | item 4 (file if unfiled) | config field, catalog filtering, digest refusal, in-flight guard | `lens-contract` | digest-refusal changes what a config value is allowed to resolve to |
|
||||
| sub-feature | issue | implementer scope | suggested council lenses | why |
|
||||
| -------------------------- | ------------------------ | ------------------------------------------------------------------------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Artifact install | item 1 (file if unfiled) | `archie-update-install` download+verify, opt-in source-build flag | `lens-deletionist` | must not leave the clone+compile path as silent default cruft |
|
||||
| Topology migration | item 2 (file if unfiled) | daemon-side observer, `release.json` schema, `install.sh` consumption, contract test | `lens-boundary`, `lens-operator` | boundary: observation belongs in daemon not shell; operator: refusal-with-plan is the whole safety property |
|
||||
| Journaled transaction | item 3 (file if unfiled) | journal format, stage-then-rename, lock, resume-on-boot | `lens-operator`, `lens-maintainer` | operator: crash-mid-update is the core failure mode; maintainer: someone must be able to read a journal file during an incident |
|
||||
| Channel/pinning/automation | item 4 (file if unfiled) | config field, catalogue filtering, digest refusal, in-flight guard | `lens-contract` | digest-refusal changes what a config value is allowed to resolve to |
|
||||
|
||||
## File and link the beads
|
||||
|
||||
|
||||
@@ -27,31 +27,31 @@ This is a **distribution decision**, not a rewrite of Archie's domain
|
||||
model. The six-domain split already approved in
|
||||
`docs/architecture/index.md` and `docs/architecture/organisation.md`
|
||||
(Identity, Agent, Messaging, Workflow, Work Intake, Plugin) is unchanged;
|
||||
this PRD is about how the *processes* running that domain logic get
|
||||
this PRD is about how the _processes_ running that domain logic get
|
||||
packaged, contracted, and discovered -- not about redrawing domain
|
||||
boundaries.
|
||||
|
||||
### Target services
|
||||
|
||||
| Service | Contract it owns | Existing code it replaces/wraps |
|
||||
|---|---|---|
|
||||
| UI Service | thin client only; talks to Gateway and State Store contracts | `internal/webui` (SPA hosting stays; API surface becomes typed contract clients, not a peer with direct access) |
|
||||
| Gateway Service | routing / turn / session contract | `internal/gateway` |
|
||||
| Messaging Service | channel-plugin contract (Telegram, email, Discord, Teams, ...) | `internal/channels` |
|
||||
| Curator Service | curator contract; **optional**, installs as a Gateway plugin | `internal/domain/curator` |
|
||||
| Scheduler Service | cron/ticker contract | `internal/domain/scheduling` |
|
||||
| Execution Environment | execution-dispatch contract | `internal/domain/workflow`, task dispatch paths |
|
||||
| Runner | isolated worktree/container execution | `internal/container`, `internal/agentexec`, `internal/worktree` |
|
||||
| State Store | state-access contract | `internal/infrastructure/postgres` |
|
||||
| Service | Contract it owns | Existing code it replaces/wraps |
|
||||
| --------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| UI Service | thin client only; talks to Gateway and State Store contracts | `internal/webui` (SPA hosting stays; API surface becomes typed contract clients, not a peer with direct access) |
|
||||
| Gateway Service | routing / turn / session contract | `internal/gateway` |
|
||||
| Messaging Service | channel-plugin contract (Telegram, email, Discord, Teams, ...) | `internal/channels` |
|
||||
| Curator Service | curator contract; **optional**, installs as a Gateway plugin | `internal/domain/curator` |
|
||||
| Scheduler Service | cron/ticker contract | `internal/domain/scheduling` |
|
||||
| Execution Environment | execution-dispatch contract | `internal/domain/workflow`, task dispatch paths |
|
||||
| Runner | isolated worktree/container execution | `internal/container`, `internal/agentexec`, `internal/worktree` |
|
||||
| State Store | state-access contract | `internal/infrastructure/postgres` |
|
||||
|
||||
### Discovery
|
||||
|
||||
Per `docs/inspiration/service-discovery-research-2026-09-05.md`:
|
||||
|
||||
- **Primary:** Kubernetes-native discovery (Service + headless-Service/DNS
|
||||
+ EndpointSlice, served by CoreDNS), delivered as a Helm chart + Operator,
|
||||
on k3s for single-host installs and a real cluster for multi-host or a
|
||||
hosted offering.
|
||||
- EndpointSlice, served by CoreDNS), delivered as a Helm chart + Operator,
|
||||
on k3s for single-host installs and a real cluster for multi-host or a
|
||||
hosted offering.
|
||||
- **Fallback:** NATS-based discovery (micro `$SRV` announce + JetStream KV
|
||||
registry) for no-K8s single-host installs, with a custom gRPC resolver
|
||||
reading `host:port` from the KV bucket.
|
||||
@@ -135,9 +135,10 @@ historical record rather than an outstanding gate.
|
||||
monolith) phase. Confirms the hypothesis and strengthens it: the
|
||||
Gateway is already store-decoupled (it uses narrow contract adapters,
|
||||
not `internal/store`) and already owns an isolated session SQLite, so it
|
||||
is both the stickiest capability *and* the one with a ready seam and
|
||||
is both the stickiest capability _and_ the one with a ready seam and
|
||||
isolated data — extractable alone, first. Full phase list and reasoning:
|
||||
`docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md#1`.
|
||||
|
||||
2. **Contract definition mechanism.** Protobuf/gRPC service definitions
|
||||
need a home (a new `proto/` or `contracts/` tree, versioning scheme,
|
||||
codegen wiring into `Taskfile.yml`). Not yet designed.
|
||||
@@ -154,6 +155,7 @@ historical record rather than an outstanding gate.
|
||||
rationale, and scratch-verified `buf`/`buf breaking`/`connect-go`
|
||||
results:
|
||||
`docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md#2`.
|
||||
|
||||
3. **In-process vs. out-of-process during migration.** Whether services
|
||||
can run multiplexed inside one binary behind the same `ServiceRegistry`
|
||||
interface during a transition period (so extraction is incremental and
|
||||
@@ -186,6 +188,7 @@ historical record rather than an outstanding gate.
|
||||
`docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md#3`
|
||||
(the State Store's concrete ratified config shape is
|
||||
`docs/prds/state-store-contract.md` §10).
|
||||
|
||||
4. **State Store's contract shape.** Whether every service gets its own
|
||||
storage (true microservice isolation) or several services share the
|
||||
State Store service's contract (less isolation, less migration risk).
|
||||
@@ -194,10 +197,10 @@ historical record rather than an outstanding gate.
|
||||
**RESOLVED.** One State Store service owns the task data
|
||||
(now PostgreSQL, see `docs/prds/state-store-contract.md`) behind narrow typed contracts (`TaskStore`,
|
||||
`CaptureStore`, `MappingStore`, `BindingStore`, `WorkflowStore`) over
|
||||
gRPC. *(Ratified 2026-09-06: the workflow contract is now the
|
||||
gRPC. _(Ratified 2026-09-06: the workflow contract is now the
|
||||
domain-owned `workflow.Store`, which supersedes
|
||||
`internal/store`'s `WorkflowStore`. See note below and
|
||||
`docs/prds/state-store-contract.md`.)*
|
||||
`docs/prds/state-store-contract.md`.)_
|
||||
No physical database-per-service: the solo-maintainer / team-
|
||||
topology rule of thumb plus the low value of per-service autonomy for
|
||||
one person rule it out, and one store means no distributed-transactions
|
||||
@@ -215,15 +218,16 @@ historical record rather than an outstanding gate.
|
||||
#2/#7), producer-owned daemon/webui store surfaces in `internal/domain/storecontract`;
|
||||
the `Task`/`Status`/`Source` + interface relocation is a Phase 2
|
||||
prerequisite pulled from migration-decisions §4 (`store.Task →
|
||||
WorkflowExecution`); `RecordDispatch` drops `*sql.Tx`; `Close` off-wire;
|
||||
WorkflowExecution`); `RecordDispatch` drops `*sql.Tx`; `Close` off-wire;
|
||||
structured gRPC error codes with sanitised details; explicit agent State
|
||||
Store gRPC handoff (`STATE_STORE_URL`/`STATE_STORE_TOKEN`); loopback+bearer
|
||||
transport-security boundary; presence-based `[services.state].target`
|
||||
defaulting local; migration order `workflow.Store -> archie-state-store ->
|
||||
Capture -> Mapping -> Binding -> TaskStore`. `.4.2` and `.4.3` implement
|
||||
Capture -> Mapping -> Binding -> TaskStore`. `.4.2` and `.4.3` implement
|
||||
against that doc.
|
||||
|
||||
5. **Helm chart / Operator ownership.** Net-new work with no existing
|
||||
analog in this repository (`deployments/` holds TOML profiles
|
||||
analogue in this repository (`deployments/` holds TOML profiles
|
||||
and a `docker-compose.yml`, not Kubernetes manifests). Scoping not yet
|
||||
started.
|
||||
|
||||
@@ -243,7 +247,7 @@ historical record rather than an outstanding gate.
|
||||
## Completion criteria
|
||||
|
||||
Not applicable yet -- this PRD records the target shape and the discovery
|
||||
decision. It does not authorize implementation. Before work begins: file
|
||||
decision. It does not authorise implementation. Before work begins: file
|
||||
a beads epic, resolve the open questions above (at minimum #1-#3), and
|
||||
get explicit go-ahead given the scale of this change relative to
|
||||
`AGENTS.md`'s "smallest workable change" default for this solo project.
|
||||
@@ -13,10 +13,10 @@ that branch: `RegisterService`'s `listen` argument has nothing to carry without
|
||||
A service is already one Go type, `config.ServiceConnection`. What is duplicated is its
|
||||
**name**, in three layers:
|
||||
|
||||
| Layer | Location | What is hard-coded |
|
||||
|---|---|---|
|
||||
| Declaration | `internal/config/services.go` | `Gateway` and `State` as struct fields |
|
||||
| Defaulting | `internal/infrastructure/configuration/defaults.go` | three `if cfg.Services.X.Y == ""` branches |
|
||||
| Layer | Location | What is hard-coded |
|
||||
| ----------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
||||
| Declaration | `internal/config/services.go` | `Gateway` and `State` as struct fields |
|
||||
| Defaulting | `internal/infrastructure/configuration/defaults.go` | three `if cfg.Services.X.Y == ""` branches |
|
||||
| Consumption | `internal/app/archied/{bootstrap.go,state_store.go,gateway.go}`, `internal/app/archieui/config.go` | `cfg.Services.State` / `cfg.Services.Gateway` field access |
|
||||
|
||||
Adding a service means editing all three. The drift this permits is already visible:
|
||||
@@ -93,7 +93,7 @@ states in prose or in a branch:
|
||||
- `state-store-contract.md` §10 must be revised in the same change, or the tree contradicts
|
||||
its own ratified authority. Its summary (`:7`) already says `[services.<name>]`.
|
||||
- A typo'd `[services.gatway]` is **reported** (`UnknownKeys = [services.gatway,
|
||||
services.gatway.target]`), because the struct form leaves it in `toml.MetaData.Undecoded()`.
|
||||
services.gatway.target]`), because the struct form leaves it in `toml.MetaData.Undecoded()`.
|
||||
A map decodes any section, so preserving that is a requirement, not an optional extra:
|
||||
`unregisteredServiceKeys` asks the registry which names exist. This costs nothing in
|
||||
extensibility, because the answer comes from registration data rather than a fixed list.
|
||||
|
||||
@@ -110,7 +110,7 @@ copied logic, not shared code, since the source type
|
||||
5. Each extracted string becomes one `Write` through
|
||||
`Registrar.MemoryEngines.Get("builtin")`
|
||||
(`Observation{Identity: sessionID, Kind: "note", Content: text}`).
|
||||
One `Action` per session summarizes the count and lists the session
|
||||
One `Action` per session summarises the count and lists the session
|
||||
ID; a session with nothing extracted gets no `Action`, matching the
|
||||
skill curator's "a pass with nothing to report is not an error, and
|
||||
not every subject needs an entry every time."
|
||||
@@ -138,7 +138,7 @@ honestly rather than always returning true.
|
||||
these observations, not this curator's job to solve by inventing a
|
||||
dedup index.
|
||||
- **No `Forget`.** Nothing here decides a memory is stale; that is a
|
||||
different, harder judgment call than "is this worth keeping," and nothing
|
||||
different, harder judgement call than "is this worth keeping," and nothing
|
||||
reads these observations back into a chat turn to notice if
|
||||
one turned out wrong.
|
||||
- **No tool declarations.** `Manifest.Tools` is empty; the model call is
|
||||
|
||||
+11
-11
@@ -8,7 +8,7 @@
|
||||
## Decision
|
||||
|
||||
The skill curator's v1 scope is **mechanical validation and safe
|
||||
normalization only** -- it never rewrites skill prose, never deletes a
|
||||
normalisation only** -- it never rewrites skill prose, never deletes a
|
||||
skill, and never calls the model. Each pass:
|
||||
|
||||
1. Lists every skill under one configured root.
|
||||
@@ -16,13 +16,13 @@ skill, and never calls the model. Each pass:
|
||||
(`internal/skill.Parse`).
|
||||
3. Records an `Action` for any structural problem: a parse failure, or a
|
||||
missing `name`/`description` in the frontmatter that parsed.
|
||||
4. Normalizes trivial whitespace (trailing whitespace per line, exactly
|
||||
one trailing newline) and writes back **only** when normalization
|
||||
4. Normalises trivial whitespace (trailing whitespace per line, exactly
|
||||
one trailing newline) and writes back **only** when normalisation
|
||||
actually changes the bytes, recording an `Action` for that write.
|
||||
|
||||
Nothing here needs judgment. "Review, prune, and improve" -- the epic's
|
||||
Nothing here needs judgement. "Review, prune, and improve" -- the epic's
|
||||
framing -- is real for v1 but deliberately narrow: review is structural
|
||||
validation, improve is whitespace normalization, and prune is *reporting*
|
||||
validation, improve is whitespace normalisation, and prune is _reporting_
|
||||
a problem, never removing a skill. `Manifest.Skills = true` still marks
|
||||
this curator agentic (existing `agentic()` rule), so it receives model
|
||||
access from the registrar -- unused but nothing about the contract
|
||||
@@ -39,7 +39,7 @@ contract holds for a second, structurally different consumer than the
|
||||
session-memory curator (files-as-skills vs. observations-as-memory), not
|
||||
solving "what makes a skill good." Mechanical validation is real,
|
||||
useful, safe to run unattended, and fully exercises
|
||||
List/Read/Write -- every method `curator.SkillStore` declares except
|
||||
List/Read/Write -- every method `curator.SkillStore` declares except
|
||||
`Delete`, which this curator's Pass never has a safe reason to call in
|
||||
v1 (kept implemented on the store adapter regardless, since the
|
||||
interface requires it and a future consumer may).
|
||||
@@ -48,7 +48,7 @@ interface requires it and a future consumer may).
|
||||
|
||||
`internal/skill.Discover` parses every `SKILL.md` under a root and
|
||||
returns an error for the **whole** call if any one of them fails to
|
||||
parse -- the read side was built for "load the catalog to start the
|
||||
parse -- the read side was built for "load the catalogue to start the
|
||||
daemon," where one bad skill failing the whole boot is arguably correct,
|
||||
not for "review each skill and report what's wrong with it
|
||||
individually." A per-skill parse failure must become one `Action`, not
|
||||
@@ -66,7 +66,7 @@ every root `skill.CatalogRoots`/`DefaultRoots` would read for a model
|
||||
(which layers a shared dir over the per-profile one). Write and Delete
|
||||
need one unambiguous target; a curator that could write into a shared,
|
||||
multi-tenant skills directory is a bigger decision than this issue
|
||||
covers. The model still sees the full multi-root catalog through the
|
||||
covers. The model still sees the full multi-root catalogue through the
|
||||
existing read path -- this curator only maintains the local one.
|
||||
|
||||
## Shape
|
||||
@@ -118,7 +118,7 @@ func (c *Curator) Pass(ctx context.Context, in curator.PassInput) (curator.PassR
|
||||
|
||||
- **parse failure** -- `Action{Type: "skill.invalid", Reason: "frontmatter failed to parse"}`
|
||||
- **missing required field** -- `Action{Type: "skill.incomplete", Reason: "name" | "description"}`
|
||||
- **normalized** -- content changed by whitespace cleanup, written back,
|
||||
- **normalised** -- content changed by whitespace cleanup, written back,
|
||||
`Action{Type: "skill.normalized", Detail: "<name>: trimmed trailing whitespace"}`
|
||||
- **clean** -- no action recorded (a pass with nothing to report is not
|
||||
an error, and not every skill needs an entry every time)
|
||||
@@ -140,11 +140,11 @@ file reads).
|
||||
`metadata.archie.tools` naming a tool that no longer exists). The
|
||||
mechanism to check "does this tool exist" belongs to a tool registry
|
||||
this curator has no access to and shouldn't be given for this --
|
||||
`curator.ToolBuilder.Build` resolves the curator's *own* declared
|
||||
`curator.ToolBuilder.Build` resolves the curator's _own_ declared
|
||||
tools, not an arbitrary existence check against skill-referenced
|
||||
names. A real fix here is a separate, better-scoped issue.
|
||||
- **No multi-root awareness.** One configured root, matching
|
||||
`loadWorkflows`'s existing resolution, not the full layered catalog a
|
||||
`loadWorkflows`'s existing resolution, not the full layered catalogue a
|
||||
chat turn sees.
|
||||
- **No new curator-specific webui or chat surface.** Activity is visible
|
||||
through the existing curator observability surface
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
**Revision:** 2e
|
||||
**Date:** 2026-09-06
|
||||
|
||||
This is the pre-implementation design document that Phase 2 subtasks `.4.2` (generalize
|
||||
This is the pre-implementation design document that Phase 2 subtasks `.4.2` (generalise
|
||||
`storerpc` as the State Store gRPC contract) and `.4.3` (stand up `archie-state-store`)
|
||||
implement against.
|
||||
**Beads milestone:** archie-core-8cda.4.1
|
||||
@@ -26,15 +26,15 @@ limits, mode/config shape, local-adapter compatibility, and cutover/deletion rul
|
||||
> semantics and cutover rules stand.
|
||||
|
||||
> **Current state — read before `.4.2` starts.** The §12 step 2 relocation (`archie-core-8cda.
|
||||
> 4.8`) has landed: `Task`/`Status*`/`Source*` and the 3-method `workflow.Store` now live in
|
||||
4.8`) has landed: `Task`/`Status*`/`Source*` and the 3-method `workflow.Store` now live in
|
||||
> `internal/domain/workflow`, the six production workflow files import no `internal/store`
|
||||
> symbol, and `storerpc`/the NATS transport assert against `workflow.Store` instead of
|
||||
> `store.WorkflowStore`. The broader Phase 2 acceptance criterion (State Store as its own
|
||||
> service behind gRPC) is still open — that is what `.4.2`/`.4.3` build next.
|
||||
|
||||
> **Relationship to migration-decisions §4 — not replaced.** `docs/architecture/
|
||||
> migration-decisions.md` §4 (`store.Task → WorkflowExecution`, `mutable Stage →
|
||||
> StepExecution history`, `RetryCount/Attempt → Attempt records`, versioned Workflow defs)
|
||||
migration-decisions.md` §4 (`store.Task → WorkflowExecution`, `mutable Stage →
|
||||
StepExecution history`, `RetryCount/Attempt → Attempt records`, versioned Workflow defs)
|
||||
> **remains the authoritative, open document for the long-term Workflow migration.** This PRD
|
||||
> does **not** replace it. It only pulls the minimal `Task`/`Status`/`Source` type + interface
|
||||
> relocation forward as a Phase 2 prerequisite (because the acceptance criterion requires it);
|
||||
@@ -61,7 +61,7 @@ extracted), which is the PRD §3 posture; it differs from the gateway's remote-d
|
||||
because the gateway is already a separate deployment and the State Store is not.
|
||||
|
||||
> **Contract-ownership fork, decided (rev. 2c — resolves the domain contradiction).**
|
||||
> Ownership splits by the consumer's *layer*, per the dependency contract's rule #2
|
||||
> Ownership splits by the consumer's _layer_, per the dependency contract's rule #2
|
||||
> ("a domain defines the smallest interfaces required to perform its work") and rule #7
|
||||
> ("database rows … MUST NOT leak into domain models"):
|
||||
>
|
||||
@@ -117,23 +117,23 @@ remains the only composite; every other interface is flat. Narrow slices are spl
|
||||
consumer-capability lines so no consumer acquires a surface it does not need
|
||||
(`interfacebloat` cap = 8).
|
||||
|
||||
| Interface (owner) | Embeds | Methods | Local impl | Remote impl |
|
||||
|---|---|---|---|---|
|
||||
| `TaskStore` (store) | `TaskLifecycle`, `TaskEvents`, `TaskQueries`, `TaskArchiver`, `TaskRetryer` | 24 (union) | `*Store` | `*staterpc.Client` |
|
||||
| `TaskLifecycle` (store) | — | 8 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskEvents` (store) | — | 7 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskQueries` (store) | — | 7 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskArchiver` (store) | — | 1 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskRetryer` (store) | — | 1 | `*Store` | `*staterpc.Client` |
|
||||
| `workflow.Store` (workflow domain) | — | 3 | `*Store` | `*staterpc.Client` |
|
||||
| `CaptureStore` (store) | — | 2 | `*Store` | `*staterpc.Client` |
|
||||
| `MappingStore` (store) | — | 5 | `*Store` | `*staterpc.Client` |
|
||||
| `BindingStore` (store) | — | 6 | `*Store` | `*staterpc.Client` |
|
||||
| `BindingDispatcher` (store) | — | 3 | `*Store` | `*staterpc.Client` |
|
||||
| `BindingTaskCreator` (store) | — | 1 | `*Store` | `*staterpc.Client` |
|
||||
| `PlaybookDispatcher` (store) | — | 2 | `*Store` | `*staterpc.Client` |
|
||||
| Interface (owner) | Embeds | Methods | Local impl | Remote impl |
|
||||
| ---------------------------------- | --------------------------------------------------------------------------- | ---------- | ---------- | ------------------ |
|
||||
| `TaskStore` (store) | `TaskLifecycle`, `TaskEvents`, `TaskQueries`, `TaskArchiver`, `TaskRetryer` | 24 (union) | `*Store` | `*staterpc.Client` |
|
||||
| `TaskLifecycle` (store) | — | 8 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskEvents` (store) | — | 7 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskQueries` (store) | — | 7 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskArchiver` (store) | — | 1 | `*Store` | `*staterpc.Client` |
|
||||
| `TaskRetryer` (store) | — | 1 | `*Store` | `*staterpc.Client` |
|
||||
| `workflow.Store` (workflow domain) | — | 3 | `*Store` | `*staterpc.Client` |
|
||||
| `CaptureStore` (store) | — | 2 | `*Store` | `*staterpc.Client` |
|
||||
| `MappingStore` (store) | — | 5 | `*Store` | `*staterpc.Client` |
|
||||
| `BindingStore` (store) | — | 6 | `*Store` | `*staterpc.Client` |
|
||||
| `BindingDispatcher` (store) | — | 3 | `*Store` | `*staterpc.Client` |
|
||||
| `BindingTaskCreator` (store) | — | 1 | `*Store` | `*staterpc.Client` |
|
||||
| `PlaybookDispatcher` (store) | — | 2 | `*Store` | `*staterpc.Client` |
|
||||
|
||||
**Key property of the remote client:** `*staterpc.Client` is a *single* adapter that wraps one
|
||||
**Key property of the remote client:** `*staterpc.Client` is a _single_ adapter that wraps one
|
||||
`StateStoreClient` and is asserted against **whichever narrow Go interfaces its caller needs**
|
||||
(exactly as `gatewayrpc.Client` asserts both `gateway.ChatContract` and
|
||||
`gateway.SessionStore`). The Go contracts stay narrow (≤8, the `interfacebloat` cap); the wire
|
||||
@@ -153,20 +153,20 @@ Process legend: **DAEMON** = `archied` (incl. in-process webui + gateway runtime
|
||||
`storerpc.Server`); **AGENT** = `archie-agent` worker (no DB connection); **GATEWAY** = store
|
||||
access through daemon-side narrow adapter interfaces.
|
||||
|
||||
| Contract | Primary consumers (process) | Remote on the wire? |
|
||||
|---|---|---|
|
||||
| `TaskLifecycle` (8) | DAEMON (dispatch, claim, action) + **AGENT** (`Transition`, `Update` via storerpc) | `Transition`/`Update` = **YES** (agent); rest DAEMON |
|
||||
| `TaskArchiver` (1) | DAEMON (`taskactions` archive) | not yet |
|
||||
| `TaskRetryer` (1) | DAEMON (`taskactions` retry) | not yet |
|
||||
| `TaskQueries` (7) | DAEMON + GATEWAY (status/list adapters) | not yet (`OpenPRs`/`Tasks`/`StatusCounts` cross to gateway adapters in-process) |
|
||||
| `TaskEvents` (7) | DAEMON + **AGENT** (`InsertEvent` via storerpc) | `InsertEvent` = **YES** (agent); rest DAEMON |
|
||||
| `workflow.Store` (3) | **AGENT** only | **YES** (the sole genuinely remote consumer) |
|
||||
| `CaptureStore` (2) | DAEMON (webhook intake + mapping editor) | not yet |
|
||||
| `MappingStore` (5) | DAEMON (dashboard editor + dispatch loop) | not yet |
|
||||
| `BindingStore` (6) | DAEMON (dashboard editor + dispatch loop) | not yet |
|
||||
| `BindingDispatcher` (3) | DAEMON (dispatch loop) | not yet |
|
||||
| `BindingTaskCreator` (1) | DAEMON (dispatch loop) | not yet |
|
||||
| `PlaybookDispatcher` (2) | DAEMON (EDA playbook dispatch loop) | **YES** (side-effecting-action idempotency ledger over gRPC) |
|
||||
| Contract | Primary consumers (process) | Remote on the wire? |
|
||||
| ------------------------ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
||||
| `TaskLifecycle` (8) | DAEMON (dispatch, claim, action) + **AGENT** (`Transition`, `Update` via storerpc) | `Transition`/`Update` = **YES** (agent); rest DAEMON |
|
||||
| `TaskArchiver` (1) | DAEMON (`taskactions` archive) | not yet |
|
||||
| `TaskRetryer` (1) | DAEMON (`taskactions` retry) | not yet |
|
||||
| `TaskQueries` (7) | DAEMON + GATEWAY (status/list adapters) | not yet (`OpenPRs`/`Tasks`/`StatusCounts` cross to gateway adapters in-process) |
|
||||
| `TaskEvents` (7) | DAEMON + **AGENT** (`InsertEvent` via storerpc) | `InsertEvent` = **YES** (agent); rest DAEMON |
|
||||
| `workflow.Store` (3) | **AGENT** only | **YES** (the sole genuinely remote consumer) |
|
||||
| `CaptureStore` (2) | DAEMON (webhook intake + mapping editor) | not yet |
|
||||
| `MappingStore` (5) | DAEMON (dashboard editor + dispatch loop) | not yet |
|
||||
| `BindingStore` (6) | DAEMON (dashboard editor + dispatch loop) | not yet |
|
||||
| `BindingDispatcher` (3) | DAEMON (dispatch loop) | not yet |
|
||||
| `BindingTaskCreator` (1) | DAEMON (dispatch loop) | not yet |
|
||||
| `PlaybookDispatcher` (2) | DAEMON (EDA playbook dispatch loop) | **YES** (side-effecting-action idempotency ledger over gRPC) |
|
||||
|
||||
**Consequence for migration order:** the **agent's `workflow.Store` is already cross-process
|
||||
already** (via the NATS `storerpc` surrogate), so it is the first contract to move to gRPC. The
|
||||
@@ -190,12 +190,12 @@ The Phase 2 acceptance criterion ("`internal/domain/workflow` … no longer impo
|
||||
|
||||
**The relocation (a prerequisite that must land before or with `.4.2`):**
|
||||
|
||||
| Current symbol (`internal/store`) | Moves to | Notes |
|
||||
|---|---|---|
|
||||
| `Task` type | `internal/domain/workflow.Task` | The task-execution record the workflow domain operates on. `internal/store` persists this type (persistence → domain). |
|
||||
| `Status` + `Status*` constants | `internal/domain/workflow` | e.g. `StatusClosedWontDo`, `StatusMerged`, `StatusPROpen`, `StatusWaitingHuman`, `StatusRunning` — task-lifecycle vocabulary. |
|
||||
| `Source` + `Source*` constants | `internal/domain/workflow` | e.g. `SourceChat` — provenance vocabulary, follows `Task`. |
|
||||
| `WorkflowStore` interface (3 methods) | `internal/domain/workflow.Store` | **Consumer-owned** (dependency rule #2). Supersedes `store.WorkflowStore`. |
|
||||
| Current symbol (`internal/store`) | Moves to | Notes |
|
||||
| ------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Task` type | `internal/domain/workflow.Task` | The task-execution record the workflow domain operates on. `internal/store` persists this type (persistence → domain). |
|
||||
| `Status` + `Status*` constants | `internal/domain/workflow` | e.g. `StatusClosedWontDo`, `StatusMerged`, `StatusPROpen`, `StatusWaitingHuman`, `StatusRunning` — task-lifecycle vocabulary. |
|
||||
| `Source` + `Source*` constants | `internal/domain/workflow` | e.g. `SourceChat` — provenance vocabulary, follows `Task`. |
|
||||
| `WorkflowStore` interface (3 methods) | `internal/domain/workflow.Store` | **Consumer-owned** (dependency rule #2). Supersedes `store.WorkflowStore`. |
|
||||
|
||||
**Resulting dependency direction (correct per the architecture):**
|
||||
|
||||
@@ -251,25 +251,25 @@ level.
|
||||
### The `StateStore` RPC set (union of the contracts, grouped)
|
||||
|
||||
Methods are named after the store methods so the mapping is unambiguous. `workflow.Store` is a
|
||||
*view*, not new RPCs — `Update`/`Transition`/`InsertEvent` are shared with
|
||||
_view_, not new RPCs — `Update`/`Transition`/`InsertEvent` are shared with
|
||||
`TaskLifecycle`/`TaskEvents` and appear once.
|
||||
|
||||
| Group | RPCs |
|
||||
|---|---|
|
||||
| Lifecycle | `EnqueueIssue`, `EnqueueChatTask`, `ClaimNext`, `ClaimByIssue`, `Transition`, `Update`, `Requeue`, `RecoverStale` |
|
||||
| Archive / Retry | `ArchiveTask`, `RetryTask` |
|
||||
| Queries | `TaskByIssue`, `OpenTaskByPR`, `TaskByID`, `OpenPRs`, `ClearTerminalTasks`, `Tasks`, `StatusCounts`, `IncrementRetryCount` |
|
||||
| Events | `InsertEvent`, `EventsSince`, `TaskEvents`, `WorkflowStats`, `StageStats`, `TokensByDay` |
|
||||
| Capture | `InsertCapture`, `ListCaptures` |
|
||||
| Mapping | `InsertMapping`, `GetMapping`, `ListMappings`, `UpdateMapping`, `DeleteMapping` |
|
||||
| Binding | `InsertBinding`, `GetBinding`, `ListBindings`, `UpdateBinding`, `DeleteBinding`, `ApproveBinding` |
|
||||
| Dispatch | `ArmedBindingsForSource`, `RecordDispatch`, `ListUndispatchedCaptures` |
|
||||
| Playbook | `RecordPlaybookDispatch`, `DeletePlaybookDispatches` |
|
||||
| BindingTaskCreator | `EnqueueBindingTask` |
|
||||
| Config snapshot | `PutConfigSnapshot`, `GetConfigSnapshot` |
|
||||
| Apply status | `PutApplyStatus`, `ListApplyStatus` |
|
||||
| Channel status | `PutChannelStatus`, `ListChannelStatus` |
|
||||
| Task log | `ReadTaskLog`, `StreamTaskLogContent` |
|
||||
| Group | RPCs |
|
||||
| ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Lifecycle | `EnqueueIssue`, `EnqueueChatTask`, `ClaimNext`, `ClaimByIssue`, `Transition`, `Update`, `Requeue`, `RecoverStale` |
|
||||
| Archive / Retry | `ArchiveTask`, `RetryTask` |
|
||||
| Queries | `TaskByIssue`, `OpenTaskByPR`, `TaskByID`, `OpenPRs`, `ClearTerminalTasks`, `Tasks`, `StatusCounts`, `IncrementRetryCount` |
|
||||
| Events | `InsertEvent`, `EventsSince`, `TaskEvents`, `WorkflowStats`, `StageStats`, `TokensByDay` |
|
||||
| Capture | `InsertCapture`, `ListCaptures` |
|
||||
| Mapping | `InsertMapping`, `GetMapping`, `ListMappings`, `UpdateMapping`, `DeleteMapping` |
|
||||
| Binding | `InsertBinding`, `GetBinding`, `ListBindings`, `UpdateBinding`, `DeleteBinding`, `ApproveBinding` |
|
||||
| Dispatch | `ArmedBindingsForSource`, `RecordDispatch`, `ListUndispatchedCaptures` |
|
||||
| Playbook | `RecordPlaybookDispatch`, `DeletePlaybookDispatches` |
|
||||
| BindingTaskCreator | `EnqueueBindingTask` |
|
||||
| Config snapshot | `PutConfigSnapshot`, `GetConfigSnapshot` |
|
||||
| Apply status | `PutApplyStatus`, `ListApplyStatus` |
|
||||
| Channel status | `PutChannelStatus`, `ListChannelStatus` |
|
||||
| Task log | `ReadTaskLog`, `StreamTaskLogContent` |
|
||||
|
||||
That is **51 unique contract RPCs** across one service (the `TaskEvents.Close` method is dropped).
|
||||
`Close()` is **excluded** from the wire (it is server lifecycle, not a client call) — see §11.
|
||||
@@ -326,17 +326,17 @@ alongside the rest.
|
||||
`workflow.Task` (§4); the daemon/webui store surfaces return the same `workflow.Task` (the store
|
||||
persists the domain type).
|
||||
|
||||
| Domain type | Package | Notes for `values.go` |
|
||||
|---|---|---|
|
||||
| `workflow.Task` | `internal/domain/workflow` | time fields stored as layout strings; convert to/from `google.protobuf.Timestamp` |
|
||||
| `events.Event` | `internal/events` | `Timestamp` → `google.protobuf.Timestamp` |
|
||||
| `store.CapturedEvent` | `internal/store` | headers/body/remote_addr; body capped 256 KiB |
|
||||
| `mapping.Mapping` | `internal/domain/mapping` | JSON-path field bindings |
|
||||
| `binding.Binding` | `internal/domain/binding` | secret is **already decrypted** before returning; keep decrypted form out of any durable/logged representation |
|
||||
| `workflow.Status` / `workflow.Source` | `internal/domain/workflow` | enum-like; map to proto enum or string, keeping the names stable for compatibility |
|
||||
| `store.WorkflowStat` | `internal/store` | aggregate row |
|
||||
| `store.StageStat` | `internal/store` | aggregate row |
|
||||
| `store.DayTokens` | `internal/store` | aggregate row |
|
||||
| Domain type | Package | Notes for `values.go` |
|
||||
| ------------------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `workflow.Task` | `internal/domain/workflow` | time fields stored as layout strings; convert to/from `google.protobuf.Timestamp` |
|
||||
| `events.Event` | `internal/events` | `Timestamp` → `google.protobuf.Timestamp` |
|
||||
| `store.CapturedEvent` | `internal/store` | headers/body/remote_addr; body capped 256 KiB |
|
||||
| `mapping.Mapping` | `internal/domain/mapping` | JSON-path field bindings |
|
||||
| `binding.Binding` | `internal/domain/binding` | secret is **already decrypted** before returning; keep decrypted form out of any durable/logged representation |
|
||||
| `workflow.Status` / `workflow.Source` | `internal/domain/workflow` | enum-like; map to proto enum or string, keeping the names stable for compatibility |
|
||||
| `store.WorkflowStat` | `internal/store` | aggregate row |
|
||||
| `store.StageStat` | `internal/store` | aggregate row |
|
||||
| `store.DayTokens` | `internal/store` | aggregate row |
|
||||
|
||||
### Wire-contract blocker fixed here: `RecordDispatch`
|
||||
|
||||
@@ -369,17 +369,17 @@ same seam.
|
||||
|
||||
**Boot handoff contract (additive, not replacing the NATS settings):**
|
||||
|
||||
| Field | Where | Source | Notes |
|
||||
|---|---|---|---|
|
||||
| Field | Where | Source | Notes |
|
||||
| ------------------ | ---------------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `StateStoreTarget` | `agentworker.Settings` | env `STATE_STORE_URL` (or `-state-store-url` flag), set by the daemon in the container env | `host:port` of the State Store gRPC server. Loopback/Docker-bridge address — the agent reaches it the same way it reaches the daemon's NATS. |
|
||||
| `StateStoreToken` | `agentworker.Settings` | env `STATE_STORE_TOKEN` (or `-state-store-token` flag) | Per-task bearer token carried in gRPC metadata by a client interceptor (see §9). |
|
||||
| `StoreTimeout` | `agentworker.Settings` | a bounded per-call timeout | Mirrors `natsrpc.Client.Timeout` / the existing `rpcTimeout`; bounds each State Store call when the caller `ctx` has no deadline. |
|
||||
| `StateStoreToken` | `agentworker.Settings` | env `STATE_STORE_TOKEN` (or `-state-store-token` flag) | Per-task bearer token carried in gRPC metadata by a client interceptor (see §9). |
|
||||
| `StoreTimeout` | `agentworker.Settings` | a bounded per-call timeout | Mirrors `natsrpc.Client.Timeout` / the existing `rpcTimeout`; bounds each State Store call when the caller `ctx` has no deadline. |
|
||||
|
||||
**Wiring change in the transport façade:**
|
||||
|
||||
- `internal/infrastructure/agenttransport/nats.Transport` — `Store(timeout) store.WorkflowStore`
|
||||
returns `&storerpc.Client{Conn: t.conn, Timeout: timeout}`. It becomes
|
||||
`Store(timeout) workflow.Store` and returns a *single long-lived* `staterpc.Client` dialed to
|
||||
`Store(timeout) workflow.Store` and returns a _single long-lived_ `staterpc.Client` dialled to
|
||||
`settings.StateStoreTarget` (with the token interceptor and per-call timeout).
|
||||
- `internal/app/agentworker/worker.go` `Settings` gains the three fields above; `taskServiceTransport`
|
||||
and `taskDependencies` change their `store` type from `store.WorkflowStore` to
|
||||
@@ -432,24 +432,24 @@ across a single agent process, which is either NATS-backed or gRPC-backed, never
|
||||
### Decision — structured mapping so `errors.Is` survives
|
||||
|
||||
The `StateStore` service must map the store's sentinel errors to canonical gRPC codes and
|
||||
rehydrate them to the *same* sentinels on the client, so consumer `errors.Is` checks keep
|
||||
rehydrate them to the _same_ sentinels on the client, so consumer `errors.Is` checks keep
|
||||
working — an improvement over the flattening it replaces, not a regression.
|
||||
|
||||
| Store sentinel / outcome | gRPC code | Client rehydrates to |
|
||||
|---|---|---|
|
||||
| `store.ErrStaleTransition` | `FailedPrecondition` | `store.ErrStaleTransition` |
|
||||
| `store.ErrBindingNotFound` | `NotFound` | `store.ErrBindingNotFound` |
|
||||
| `store.ErrMappingNotFound` | `NotFound` | `store.ErrMappingNotFound` |
|
||||
| `store.ErrBindingOverlap` | `FailedPrecondition` | `store.ErrBindingOverlap` |
|
||||
| `store.ErrBindingTransition` | `FailedPrecondition` | `store.ErrBindingTransition` |
|
||||
| `store.ErrAlreadyDispatched` | `AlreadyExists` | `store.ErrAlreadyDispatched` |
|
||||
| not-found-as-`(nil,nil)` (`TaskByID`, `GetBinding`, `GetMapping`, `ClaimNext`, `ClaimByIssue`, …) | `NotFound` with a `found=false` field (**not** an error) | `(nil, nil)` |
|
||||
| infra / wrapped error | `Internal` (**sanitised** message, see below) | wrapped `fmt.Errorf(...%w)` |
|
||||
| capability absent | `Unavailable` | context/typed error |
|
||||
| Store sentinel / outcome | gRPC code | Client rehydrates to |
|
||||
| ------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ---------------------------- |
|
||||
| `store.ErrStaleTransition` | `FailedPrecondition` | `store.ErrStaleTransition` |
|
||||
| `store.ErrBindingNotFound` | `NotFound` | `store.ErrBindingNotFound` |
|
||||
| `store.ErrMappingNotFound` | `NotFound` | `store.ErrMappingNotFound` |
|
||||
| `store.ErrBindingOverlap` | `FailedPrecondition` | `store.ErrBindingOverlap` |
|
||||
| `store.ErrBindingTransition` | `FailedPrecondition` | `store.ErrBindingTransition` |
|
||||
| `store.ErrAlreadyDispatched` | `AlreadyExists` | `store.ErrAlreadyDispatched` |
|
||||
| not-found-as-`(nil,nil)` (`TaskByID`, `GetBinding`, `GetMapping`, `ClaimNext`, `ClaimByIssue`, …) | `NotFound` with a `found=false` field (**not** an error) | `(nil, nil)` |
|
||||
| infra / wrapped error | `Internal` (**sanitised** message, see below) | wrapped `fmt.Errorf(...%w)` |
|
||||
| capability absent | `Unavailable` | context/typed error |
|
||||
|
||||
The `found=false`-not-error convention matters: the repo deliberately returns `(nil, nil)` for
|
||||
not-found in reads and a sentinel for not-found in writes. The wire must preserve **both**
|
||||
conventions (a `GoogleRPCStatus` with `NotFound` is an *error*, which would wrongly surface to
|
||||
conventions (a `GoogleRPCStatus` with `NotFound` is an _error_, which would wrongly surface to
|
||||
callers that expect `(nil, nil)`). Implement `found` as an explicit boolean field on read
|
||||
responses, and map `(nil,nil)` ⇄ `found=false` + `OK`.
|
||||
|
||||
@@ -476,9 +476,10 @@ which overrides the upstream default of 10. The Go consumer facades must stay
|
||||
is why it is decomposed; proto services bypass the cap (like `ChatContract`).
|
||||
|
||||
**Payload caps:**
|
||||
|
||||
- Capture body: `defaultCaptureMaxBodyBytes = 256 KiB` (may reduce further; the wire message
|
||||
must not exceed gRPC's default 4 MiB receive limit for a single capture). A single capture
|
||||
fits, but a *batch* of them did not: the caller-side cap of up to 100 captures at 256 KiB each
|
||||
fits, but a _batch_ of them did not: the caller-side cap of up to 100 captures at 256 KiB each
|
||||
could exceed 4 MiB in one unary `ListCaptures`/`ListUndispatchedCaptures` response. `.4.7` adds
|
||||
`StreamCaptures`/`StreamUndispatchedCaptures` (server-streaming, one capture per message) as
|
||||
the path both `staterpc.Client` methods actually call; the original unary RPCs stay defined,
|
||||
@@ -486,6 +487,7 @@ is why it is decomposed; proto services bypass the cap (like `ChatContract`).
|
||||
- Task `detail`/`park_reason`/event `Detail`: 4000-char hard cap (`clip(s, 4000)`).
|
||||
|
||||
**Retention (stays server-side in the store; the wire does not carry pruning decisions):**
|
||||
|
||||
- `events` table: **no prune, unbounded growth** — a known risk to revisit, not changed here.
|
||||
- `captured_events`: prune-on-write, default 7 days / 5000 events.
|
||||
|
||||
@@ -508,11 +510,11 @@ stated explicitly rather than left implicit.
|
||||
|
||||
- **Listener topology — single rule (rev. 2c).** One in-process listener; its bind address is
|
||||
chosen by the consumer set, never both at once:
|
||||
- *Agent containers consume it* (the Phase 2 driver during multiplexed serving) → bind to the
|
||||
- _Agent containers consume it_ (the Phase 2 driver during multiplexed serving) → bind to the
|
||||
**host-gateway bridge address** so containers can reach it, and **token auth is mandatory**
|
||||
(a bridge host is reachable by any process on that bridge). A container **cannot reach the
|
||||
host's `127.0.0.1`**, so loopback-only is NOT usable for the agent-consumed path.
|
||||
- *Only the daemon consumes it* (no agent) → bind **loopback-only** (`--listen 127.0.0.1`),
|
||||
- _Only the daemon consumes it_ (no agent) → bind **loopback-only** (`--listen 127.0.0.1`),
|
||||
`insecure` is fine because it is not network-reachable; no token required.
|
||||
- There is **no dual-listener** design. The practical default during `.4.2` (the reason
|
||||
in-process serving exists is to give the agent a gRPC target) is the **bridge address +
|
||||
@@ -550,7 +552,7 @@ stated explicitly rather than left implicit.
|
||||
- **Validation and scope (`.4.7`):** a gRPC interceptor (`staterpc.TaskGrants.UnaryInterceptor`)
|
||||
validates the token against the State Store's own issued-grant set; missing/unknown/expired →
|
||||
`codes.Unauthenticated`. Unlike the daemon's own administrative token (full access to all ~40
|
||||
RPCs), a task-scoped grant additionally authorizes only `Update`/`Transition`/`InsertEvent` on
|
||||
RPCs), a task-scoped grant additionally authorises only `Update`/`Transition`/`InsertEvent` on
|
||||
its own task ID — every other RPC, including the streaming capture surface and
|
||||
`RegisterTaskGrant`/`RevokeTaskGrant` themselves, is `codes.PermissionDenied` for a task-scoped
|
||||
caller. The token is carried in gRPC metadata, never in a URL.
|
||||
@@ -584,7 +586,7 @@ an explicit operator decision.
|
||||
withdrawn when the State Store was extracted (§12 step 7): the standalone `archie-state-store` process
|
||||
exclusively owns `archie.db`, so both `archied` and `archie-gateway` now reject an empty
|
||||
target (`internal/app/archied/bootstrap.go` and `state_store_client.go`: `services.state.target
|
||||
is required`). **Set `Target` → dial gRPC** with `*staterpc.Client`; no client opens the
|
||||
is required`). **Set `Target` → dial gRPC** with `*staterpc.Client`; no client opens the
|
||||
database itself. This differs from the gateway, where `Target` is defaulted to
|
||||
`127.0.0.1:8585` because `archie-gateway` is already a separate process whose client and
|
||||
server share one default.
|
||||
@@ -644,7 +646,7 @@ an explicit operator decision.
|
||||
`internal/domain/workflow` imports no `internal/store`. Update the store tests and the 6
|
||||
workflow production files. **This must land before or with `.4.2`, because `.4.2` cannot move
|
||||
the agent's store contract off `store.WorkflowStore` while the domain still imports it.**
|
||||
3. **`.4.2` — generalize `storerpc` to the gRPC contract.** Move the agent's `workflow.Store`
|
||||
3. **`.4.2` — generalise `storerpc` to the gRPC contract.** Move the agent's `workflow.Store`
|
||||
(`Update`/`Transition`/`InsertEvent`) from NATS JSON `storerpc` to `staterpc.Client` over
|
||||
gRPC, using the §6 handoff. The daemon serves the gRPC `StateStore` server **in-process
|
||||
(multiplexed)** first so the agent has a gRPC target before the standalone binary exists
|
||||
@@ -662,7 +664,7 @@ an explicit operator decision.
|
||||
`archie-state-store`): `Capture → Mapping → Binding → TaskStore`. Each swap is independent —
|
||||
add the remote-client composition path, run the per-contract conformance suite, flip
|
||||
`[services.state].target`, delete the local use. A consumer mixes in-process and remote
|
||||
contracts for a contract-code (no dual-live *window*; each contract is either local or remote
|
||||
contracts for a contract-code (no dual-live _window_; each contract is either local or remote
|
||||
at a time).
|
||||
7. **Final flip / deletion of the in-process serving path:** when the daemon no longer owns the
|
||||
store (i.e. `TaskStore` has moved), delete the in-process task-store /
|
||||
|
||||
@@ -22,7 +22,7 @@ elsewhere (`/model` already lists active provider/model).
|
||||
- `/tasks`: new command, `gateway.ChatTaskSummary` extended with
|
||||
`Stage`/`Attempt`/`ParkReason`/`UpdatedAt` (all already persisted on
|
||||
`store.Task`, zero new instrumentation), sorted actionable-first.
|
||||
- `/status`: itemized per-status task counts replaced with one aggregate
|
||||
- `/status`: itemised per-status task counts replaced with one aggregate
|
||||
`Queue: N in flight (...)` line (running/waiting/parked only -- queued and
|
||||
terminal states excluded as not a health concern). Runtime
|
||||
(provider/model) is temporarily left in place; see "Runtime (provider/model)"
|
||||
@@ -34,7 +34,7 @@ work" but is never wired to a real implementation in any composition-root
|
||||
call site (`bootstrap.go`, `telegram_setup.go`) -- it always answers "Agent
|
||||
listing is not configured." in production. That is a standalone bug
|
||||
(`archie-core-mxls`), not folded into this work: deciding whether to wire
|
||||
it, repurpose it, or delete it in favor of `/tasks` is Sam's call, not
|
||||
it, repurpose it, or delete it in favour of `/tasks` is Sam's call, not
|
||||
something to resolve by implication here.
|
||||
|
||||
## Phase 2 -- health checks, verified against the actual tree
|
||||
@@ -89,7 +89,7 @@ under "Truthful or absent".
|
||||
would include containers this pool does not own. A cap of zero means
|
||||
unlimited, so `/status` renders the count alone rather than "1/0 active".
|
||||
- **Last poll.** `daemon.Daemon.LastPollAt()` reports when the most recent poll
|
||||
pass *began*; both poll paths (`poll` for single-identity `Run`,
|
||||
pass _began_; both poll paths (`poll` for single-identity `Run`,
|
||||
`pollForIdentity` for `runIdentities`) stamp it. A pass that hangs leaves the
|
||||
stamp stale, which is the signal -- stamping completion instead would leave a
|
||||
wedged poller looking healthy.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
## Decision
|
||||
|
||||
`task_logs` becomes a *cursor-paginated, filterable* bounded read, not a
|
||||
`task_logs` becomes a _cursor-paginated, filterable_ bounded read, not a
|
||||
one-shot head-of-file window. The reader in `internal/logging` gains a
|
||||
second entry point (`Page`) that walks the file forward from a byte
|
||||
offset; the tool schema in `internal/gateway/task_tools.go` surfaces
|
||||
@@ -132,7 +132,7 @@ one attempt.
|
||||
pass; neither earns its cost given `Tail` already handles "show me
|
||||
the end."
|
||||
- **No bumping `MaxTailLines` past 2000.** A single response must not be
|
||||
able to exhaust the model's context. Paging makes the cap *reachable*
|
||||
able to exhaust the model's context. Paging makes the cap _reachable_
|
||||
but does not relax it.
|
||||
- **No raising `maxScanBytes`, and no walking rotated generations.** See
|
||||
the ceiling below; lifting it is a separate decision with its own cost.
|
||||
@@ -141,7 +141,7 @@ one attempt.
|
||||
|
||||
`maxScanBytes` (8 MiB) bounds the tail of the file any single call will
|
||||
examine. Paging does **not** lift that bound: every call re-derives the
|
||||
window from the file's *current* size and clamps the incoming cursor up
|
||||
window from the file's _current_ size and clamps the incoming cursor up
|
||||
into it, so a paging loop walks the window exhaustively and then stops.
|
||||
For a log larger than 8 MiB the oldest bytes are unreachable through
|
||||
`task_logs` at any cursor, and rotated generations (`attempt-N.jsonl.1`,
|
||||
@@ -153,7 +153,7 @@ honest contract is:
|
||||
|
||||
- Within the window: paging reaches every matching entry, in order,
|
||||
exactly once.
|
||||
- Beyond it: `Truncated` is true, and that is the *only* correct thing
|
||||
- Beyond it: `Truncated` is true, and that is the _only_ correct thing
|
||||
to report. An agent that pages to `more_available == false` while
|
||||
`truncated` is true has read the window, not the log, and must say so.
|
||||
|
||||
|
||||
@@ -27,19 +27,19 @@ that has since moved on.
|
||||
|
||||
## The requirement set
|
||||
|
||||
| # | Requirement | Mechanism |
|
||||
| --- | --- | --- |
|
||||
| R1 | Per-attempt stage rail: stages with name, start, duration, terminal status and error, ordered within one attempt | `GET /api/tasks/{id}/attempts` reads the task's events and groups them by `attempt` |
|
||||
| R2 | Events carry an attempt, migrated safely and carried on the wire | `events.attempt` column + presence-gated migrator arm; `Event.attempt = 11` |
|
||||
| R3 | Changed files captured at commit/push, persisted per task, exposed, shown with repo/PR links | `changes_captured` durable event written by the commit/push steps; `GET /api/tasks/{id}/changes` |
|
||||
| R4 | The effective configuration an attempt ran under, secrets redacted, shown | `config_captured` durable event written once per attempt; read from the events response the page already holds |
|
||||
| R5 | Log pane filters by attempt, stage and level; absence stays distinct from an unreadable deployment | `logging.Query.Stage` + `ReadTaskLogRequest.stage = 9`; the pane keeps `disabled` and `found=false` apart |
|
||||
| R6 | Retry is reachable from the run view and produces a new attempt shown as a new run | Existing retry action, labelled as a NEW run whose confirm states the previous attempt's commits are discarded |
|
||||
| R7 | Raw JSON of the task record and its events for the selected attempt | `GET /api/tasks/{id}/debug` |
|
||||
| R8 | Deep-linkable, reload-safe per-task detail page that keeps existing URLs working | `/tasks/{id}` route beside the existing `/tasks?task=N` and `/tasks?status=...` |
|
||||
| R9 | Design polish: hierarchy, tokens, both themes, responsive rail, a11y, loading/empty/error states | UI lane; measured at 480px and 700px in both themes |
|
||||
| R10 | Documentation of record | This document plus `docs/architecture/observability.md` |
|
||||
| R11 | Red-first tests for every new behaviour, full gate, `task ui`, forced `go build ./...`, `go test -race` on touched packages | Per lane; the anti-cost-cutting requirement lives here |
|
||||
| # | Requirement | Mechanism |
|
||||
| --- | --------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| R1 | Per-attempt stage rail: stages with name, start, duration, terminal status and error, ordered within one attempt | `GET /api/tasks/{id}/attempts` reads the task's events and groups them by `attempt` |
|
||||
| R2 | Events carry an attempt, migrated safely and carried on the wire | `events.attempt` column + presence-gated migrator arm; `Event.attempt = 11` |
|
||||
| R3 | Changed files captured at commit/push, persisted per task, exposed, shown with repo/PR links | `changes_captured` durable event written by the commit/push steps; `GET /api/tasks/{id}/changes` |
|
||||
| R4 | The effective configuration an attempt ran under, secrets redacted, shown | `config_captured` durable event written once per attempt; read from the events response the page already holds |
|
||||
| R5 | Log pane filters by attempt, stage and level; absence stays distinct from an unreadable deployment | `logging.Query.Stage` + `ReadTaskLogRequest.stage = 9`; the pane keeps `disabled` and `found=false` apart |
|
||||
| R6 | Retry is reachable from the run view and produces a new attempt shown as a new run | Existing retry action, labelled as a NEW run whose confirm states the previous attempt's commits are discarded |
|
||||
| R7 | Raw JSON of the task record and its events for the selected attempt | `GET /api/tasks/{id}/debug` |
|
||||
| R8 | Deep-linkable, reload-safe per-task detail page that keeps existing URLs working | `/tasks/{id}` route beside the existing `/tasks?task=N` and `/tasks?status=...` |
|
||||
| R9 | Design polish: hierarchy, tokens, both themes, responsive rail, a11y, loading/empty/error states | UI lane; measured at 480px and 700px in both themes |
|
||||
| R10 | Documentation of record | This document plus `docs/architecture/observability.md` |
|
||||
| R11 | Red-first tests for every new behaviour, full gate, `task ui`, forced `go build ./...`, `go test -race` on touched packages | Per lane; the anti-cost-cutting requirement lives here |
|
||||
|
||||
## Attempt attribution: a column, not a guess
|
||||
|
||||
@@ -148,7 +148,7 @@ under" in any case.
|
||||
**Payload.** The result of `config.Config.ForTask()` — the non-secret
|
||||
task-runtime subset — plus the schema constant `archie/task-config@1`. Not the
|
||||
dashboard's configuration view: that is a larger projection carrying the full
|
||||
schema catalog, and it is the wrong object for this. Stored shape and the tab's
|
||||
schema catalogue, and it is the wrong object for this. Stored shape and the tab's
|
||||
read rule are in `docs/architecture/observability.md`.
|
||||
|
||||
**Binding conditions.** It is emitted through the durable path, never the
|
||||
@@ -279,7 +279,7 @@ than useless.
|
||||
4. An attempt with a capture shows per-file added/deleted counts, status, repo
|
||||
and PR links; an attempt without one says so and never says "no changes".
|
||||
5. The Config tab shows the attempt's document for the selected attempt only,
|
||||
with no secret value present in the serialized document.
|
||||
with no secret value present in the serialised document.
|
||||
6. Retry from the run view produces a new attempt shown as a new run, with copy
|
||||
stating the previous attempt's commits are discarded.
|
||||
7. The log stage filter narrows to stage-bound lines and the pane states the
|
||||
|
||||
@@ -66,4 +66,4 @@ attempt-scoped; a stage selection never scopes them.
|
||||
7. A stage is selectable and deselectable by keyboard, and the selection
|
||||
mirrors the log pane's stage filter.
|
||||
8. Below 900px the rail stacks above the inspector.
|
||||
9. `task check` passes clean and `ui/dist` matches the sources.
|
||||
9. `task check` passes clean and `ui/dist` matches the sources.
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
This document is the authority for Phase 3 UI Service implementation. It fixes
|
||||
the process boundary, configuration ownership, client contracts, security
|
||||
posture, readiness behavior, and migration evidence required by
|
||||
posture, readiness behaviour, and migration evidence required by
|
||||
`archie-core-8cda.5.2` and later UI extraction work.
|
||||
|
||||
## Decision
|
||||
@@ -35,13 +35,13 @@ change; a dual-live UI authority is not permitted.
|
||||
|
||||
## Boundary and ownership
|
||||
|
||||
| Concern | UI Service owns | UI Service may consume | UI Service must not own or receive |
|
||||
|---|---|---|---|
|
||||
| HTTP and SPA | routes, auth middleware, UI DTOs, assets, HTTP lifecycle | contract results and health snapshots | domain entities or infrastructure handles |
|
||||
| Chat | request validation and response projection | Gateway `ChatContract` | `gateway.Router`, `SessionStore`, turn runner, model/provider runtime |
|
||||
| Task dashboard | query/action DTOs and HTTP status mapping | State Store narrow contracts and explicitly ratified task-action contract | `*store.Store`, SQL connections, workflow registry, daemon pointer |
|
||||
| Configuration page | secret-free view and update request validation | a UI configuration contract owned by the configuration/application boundary | `config.Config`, `config.Holder`, secret registry, reload implementation |
|
||||
| Readiness | UI process liveness and dependency readiness aggregation | bounded health results from Gateway and State Store | direct probing of private databases or providers |
|
||||
| Concern | UI Service owns | UI Service may consume | UI Service must not own or receive |
|
||||
| ------------------ | -------------------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
||||
| HTTP and SPA | routes, auth middleware, UI DTOs, assets, HTTP lifecycle | contract results and health snapshots | domain entities or infrastructure handles |
|
||||
| Chat | request validation and response projection | Gateway `ChatContract` | `gateway.Router`, `SessionStore`, turn runner, model/provider runtime |
|
||||
| Task dashboard | query/action DTOs and HTTP status mapping | State Store narrow contracts and explicitly ratified task-action contract | `*store.Store`, SQL connections, workflow registry, daemon pointer |
|
||||
| Configuration page | secret-free view and update request validation | a UI configuration contract owned by the configuration/application boundary | `config.Config`, `config.Holder`, secret registry, reload implementation |
|
||||
| Readiness | UI process liveness and dependency readiness aggregation | bounded health results from Gateway and State Store | direct probing of private databases or providers |
|
||||
|
||||
Every value crossing the process boundary is a versioned DTO or scalar contract
|
||||
value. `internal/webui` may retain temporary Go-side adapters while the
|
||||
@@ -50,7 +50,7 @@ UI-owned response types at the HTTP edge. A constructor accepting a concrete
|
||||
Gateway, State Store, daemon, or `config.Holder` is not an approved final
|
||||
boundary.
|
||||
|
||||
The existing UI routes remain behaviorally compatible during extraction,
|
||||
The existing UI routes remain behaviourally compatible during extraction,
|
||||
including task actions, SSE event delivery, config views, chat streaming,
|
||||
capture intake, mappings, bindings, update reporting, and health endpoints.
|
||||
Compatibility preserves status codes, authentication requirements, redaction,
|
||||
@@ -61,18 +61,18 @@ The route families have these target owners. This is the required inventory for
|
||||
the implementation children; a route without an owner is not eligible for
|
||||
cutover.
|
||||
|
||||
| Route family | Target owner consumed by UI | Migration status |
|
||||
|---|---|---|
|
||||
| `/api/chat/*` | Gateway `ChatContract` and its versioned client | contract seam exists; DTO and stream parity remain |
|
||||
| `/api/tasks/*`, `/api/workflows`, `/api/setup` | State Store read/action contracts plus an explicit execution/admin action contract | State Store adapter exists; UI-facing narrow surface remains |
|
||||
| `/events` | State Store `EventsSince`, polled by one UI-process pump feeding `Server.Broadcast` | RESOLVED (`archie-core-za9f`): see migration-decisions, "Dashboard live event delivery". No new RPC; replay cursor and drop-recovery are the existing `since` watermark in `sse.go` |
|
||||
| `/api/logs`, `/api/logs/stream` | daemon diagnostic feed, host-local | unresolved: `logging.Feed` is in-process on the daemon host and has no contract. The per-task log routes moved off this row: see `/api/tasks/*` above |
|
||||
| `/api/tasks/{id}/logs`, `/api/tasks/{id}/logs/download` | State Store task-log read contract (`TaskLogStore`: `ReadTaskLog` + `StreamTaskLogContent`), read by the UI process from the service that owns the state directory | RESOLVED (`archie-core-iaqx`): the UI process composes `TaskLogStore` from its own State Store client and serves the attempt log as JSON (`found` distinguishes "no log for this attempt" from "this process cannot read logs") and as a `Content-Disposition` attachment named `task-<id>-attempt-<n>.log`. The daemon's in-process registry is wired as the server-side reader in `internal/app/archied/state_store.go` only (`staterpc.Deps.TaskLogs`), so no process opens another process's log files |
|
||||
| `/api/captures`, `/api/mappings`, `/api/bindings` | State Store contracts, with webhook verification owned by Work Intake/Messaging | RESOLVED (cutover, `archie-core-8cda.5.4`): the UI process composes CaptureStore/MappingStore/BindingStore and mounts the `captureintake.Receiver` from its own State Store client; the daemon's binding-dispatch loop keeps consuming captures from the same store |
|
||||
| `/api/config` (read) | daemon-published `ConfigView` snapshot, read over the State Store contract | RESOLVED (`archie-core-ymut`): see migration-decisions, "Dashboard configuration page" |
|
||||
| `/api/config` (write), `/api/config/reset`, `/api/config/repos/*` | a configuration write contract; the daemon stays the policy owner | DESCOPED for Phase 3 (`archie-core-ymut`), NOT abandoned: 503 in the UI process, SPA hides the controls, editing is config.toml plus reload. Dashboard editing is a tracked feature (`archie-core-1786637498420-327`) and its transport is `archie-core-j28m`; the handlers and their func-field seams on `webui.Server` are kept for it |
|
||||
| `/api/channels`, reload, curators, memory, skills, version/update | owning capability contract or an explicitly removed route | owner and failure semantics remain to define |
|
||||
| `/`, `/healthz`, `/health`, `/health/detailed` | UI HTTP process; readiness consumes per-service health contracts | current HTTP behavior is the compatibility baseline |
|
||||
| Route family | Target owner consumed by UI | Migration status |
|
||||
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `/api/chat/*` | Gateway `ChatContract` and its versioned client | contract seam exists; DTO and stream parity remain |
|
||||
| `/api/tasks/*`, `/api/workflows`, `/api/setup` | State Store read/action contracts plus an explicit execution/admin action contract | State Store adapter exists; UI-facing narrow surface remains |
|
||||
| `/events` | State Store `EventsSince`, polled by one UI-process pump feeding `Server.Broadcast` | RESOLVED (`archie-core-za9f`): see migration-decisions, "Dashboard live event delivery". No new RPC; replay cursor and drop-recovery are the existing `since` watermark in `sse.go` |
|
||||
| `/api/logs`, `/api/logs/stream` | daemon diagnostic feed, host-local | unresolved: `logging.Feed` is in-process on the daemon host and has no contract. The per-task log routes moved off this row: see `/api/tasks/*` above |
|
||||
| `/api/tasks/{id}/logs`, `/api/tasks/{id}/logs/download` | State Store task-log read contract (`TaskLogStore`: `ReadTaskLog` + `StreamTaskLogContent`), read by the UI process from the service that owns the state directory | RESOLVED (`archie-core-iaqx`): the UI process composes `TaskLogStore` from its own State Store client and serves the attempt log as JSON (`found` distinguishes "no log for this attempt" from "this process cannot read logs") and as a `Content-Disposition` attachment named `task-<id>-attempt-<n>.log`. The daemon's in-process registry is wired as the server-side reader in `internal/app/archied/state_store.go` only (`staterpc.Deps.TaskLogs`), so no process opens another process's log files |
|
||||
| `/api/captures`, `/api/mappings`, `/api/bindings` | State Store contracts, with webhook verification owned by Work Intake/Messaging | RESOLVED (cutover, `archie-core-8cda.5.4`): the UI process composes CaptureStore/MappingStore/BindingStore and mounts the `captureintake.Receiver` from its own State Store client; the daemon's binding-dispatch loop keeps consuming captures from the same store |
|
||||
| `/api/config` (read) | daemon-published `ConfigView` snapshot, read over the State Store contract | RESOLVED (`archie-core-ymut`): see migration-decisions, "Dashboard configuration page" |
|
||||
| `/api/config` (write), `/api/config/reset`, `/api/config/repos/*` | a configuration write contract; the daemon stays the policy owner | DESCOPED for Phase 3 (`archie-core-ymut`), NOT abandoned: 503 in the UI process, SPA hides the controls, editing is config.toml plus reload. Dashboard editing is a tracked feature (`archie-core-1786637498420-327`) and its transport is `archie-core-j28m`; the handlers and their func-field seams on `webui.Server` are kept for it |
|
||||
| `/api/channels`, reload, curators, memory, skills, version/update | owning capability contract or an explicitly removed route | owner and failure semantics remain to define |
|
||||
| `/`, `/healthz`, `/health`, `/health/detailed` | UI HTTP process; readiness consumes per-service health contracts | current HTTP behaviour is the compatibility baseline |
|
||||
|
||||
## Configuration ownership
|
||||
|
||||
@@ -89,7 +89,7 @@ These settings are decoded into a UI-owned input DTO by the UI composition root.
|
||||
The DTO contains endpoint references and secret references, never resolved
|
||||
secret values or complete daemon configuration. The UI process resolves its
|
||||
own credentials and builds its own clients. It does not read or mutate the
|
||||
daemon's configuration file, runtime overlay, forge credentials, model catalog,
|
||||
daemon's configuration file, runtime overlay, forge credentials, model catalogue,
|
||||
workflow routing, NATS settings, filesystem jail, or agent/container settings.
|
||||
|
||||
The dashboard configuration API is a separate capability. Its secret-free,
|
||||
@@ -107,7 +107,7 @@ For Phase 3, configuration ownership is split deliberately. The UI process
|
||||
owns its listener, browser-auth, asset, dependency-target, and readiness
|
||||
settings. The daemon/application configuration owner remains authoritative for
|
||||
the dashboard's `/api/config` read, validation, persistence, overlay, reload,
|
||||
and audit behavior. The UI does not become the writer merely because it
|
||||
and audit behaviour. The UI does not become the writer merely because it
|
||||
renders the configuration page.
|
||||
|
||||
Amended 2026-09-11 by `archie-core-ml30`: the daemon's `config.Holder` sharing
|
||||
@@ -142,7 +142,7 @@ contract has passed its bounded readiness check. Each dependency must expose a
|
||||
versioned health result or health endpoint that the UI can consume; the UI must
|
||||
not inspect another service's concrete manager, registry, or database. Optional
|
||||
dashboard sections may remain degraded with the current explicit
|
||||
`503`/unavailable behavior. A successful liveness response must never imply
|
||||
`503`/unavailable behaviour. A successful liveness response must never imply
|
||||
dependency readiness.
|
||||
|
||||
## Migration sequence and evidence
|
||||
@@ -154,7 +154,7 @@ The implementation must complete these gates in order:
|
||||
tests. No handler may depend on a concrete remote implementation.
|
||||
2. Make the current in-process web UI consume the same narrow adapters and
|
||||
preserve the current route, auth, redaction, stream, SSE, and degradation
|
||||
behavior. Add a composition test proving the selected adapter is the one
|
||||
behaviour. Add a composition test proving the selected adapter is the one
|
||||
used by production wiring.
|
||||
3. Remove direct `internal/gateway` session/router/runtime access from web UI
|
||||
handlers. Remove direct store implementation access, SQL access,
|
||||
@@ -214,12 +214,12 @@ implementation child must prove each migration gate before claiming Phase 3.
|
||||
|
||||
Every gate below is proven by test, not by inspection:
|
||||
|
||||
| Gate | Evidence |
|
||||
| --- | --- |
|
||||
| Deletion | `cmd/archie-ui/architecture_test.go` re-runs `go list -deps` on every `task check` and fails on any banned package, checked in both directions against its two exceptions |
|
||||
| Composition | `internal/app/archieui/TestComposeUIServerHoldsNoDaemonState` fails on a concrete `*store.Store` or a Gateway that is not the gRPC client. The holder clause it also carried is enforced by the type: `webui.Server` has no `config.Holder` field (`archie-core-ml30`) |
|
||||
| End-to-end | `cmd/archie-ui/main_test.go` builds the binary and drives it over HTTP against a live Gateway and State Store |
|
||||
| No dual authority | The dashboard HTTP listener is `internal/app/archieui/run.go` only; the daemon's two `http.Server`s are its own health endpoint and the forge webhook receiver |
|
||||
| Gate | Evidence |
|
||||
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Deletion | `cmd/archie-ui/architecture_test.go` re-runs `go list -deps` on every `task check` and fails on any banned package, checked in both directions against its two exceptions |
|
||||
| Composition | `internal/app/archieui/TestComposeUIServerHoldsNoDaemonState` fails on a concrete `*store.Store` or a Gateway that is not the gRPC client. The holder clause it also carried is enforced by the type: `webui.Server` has no `config.Holder` field (`archie-core-ml30`) |
|
||||
| End-to-end | `cmd/archie-ui/main_test.go` builds the binary and drives it over HTTP against a live Gateway and State Store |
|
||||
| No dual authority | The dashboard HTTP listener is `internal/app/archieui/run.go` only; the daemon's two `http.Server`s are its own health endpoint and the forge webhook receiver |
|
||||
|
||||
Acceptance criterion 1 was amended at the close of Phase 3 to name the UI
|
||||
process rather than the `internal/webui` package, because the daemon still held
|
||||
@@ -331,7 +331,7 @@ row's issue link is built from the forge that owns it.
|
||||
|
||||
This ratification does not define a new domain model, move the dashboard's
|
||||
allowlisted configuration schema, redesign Gateway or State Store RPCs, choose
|
||||
Kubernetes versus local discovery, or authorize unrelated package migration.
|
||||
Kubernetes versus local discovery, or authorise unrelated package migration.
|
||||
Those decisions remain in their existing authority documents. Any new UI
|
||||
capability that requires a wider Gateway or State Store surface must amend that
|
||||
service's contract before implementation.
|
||||
@@ -118,15 +118,15 @@ does not show up as a broken page.
|
||||
|
||||
## Phase 2 — Shared primitives
|
||||
|
||||
| Was | Is |
|
||||
|---|---|
|
||||
| `base/pill.jsx` | `Badge`, with five status variants (`ok`, `warn`, `danger`, `info`, `idle`) over the palette's status tokens |
|
||||
| `base/statTile.jsx` | `base/StatTile.vue`: full `Card` composition (`CardHeader`, `CardTitle`, `CardDescription`, `CardAction`, `CardContent`), `base/Sparkline.vue`, and the `goodDirection` trend logic |
|
||||
| `base/icons.jsx` | **Not ported as a module.** Its string-keyed lookup is the pattern shadcn-vue's rules name as wrong, so icons come from `@lucide/vue` at the call site |
|
||||
| `base/gauge.jsx` | `base/Gauge.vue` and `base/SegmentBar.vue`, both ported. The gauge's `aria-label` announces the rounded percentage, which closes `86au` |
|
||||
| `base/log-row.jsx` | `base/LogRow.vue` over `lib/log.ts` (`LOG_LEVELS`, `levelKind`, `shortTime`, `fmtValue`) |
|
||||
| `base/format.jsx` | `lib/format.ts` (`ago`, `compact`) |
|
||||
| `base/task-meta.jsx` | `lib/task-meta.ts`; Vue's reactivity replaces the manual boot-time re-render the Preact module needed |
|
||||
| Was | Is |
|
||||
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `base/pill.jsx` | `Badge`, with five status variants (`ok`, `warn`, `danger`, `info`, `idle`) over the palette's status tokens |
|
||||
| `base/statTile.jsx` | `base/StatTile.vue`: full `Card` composition (`CardHeader`, `CardTitle`, `CardDescription`, `CardAction`, `CardContent`), `base/Sparkline.vue`, and the `goodDirection` trend logic |
|
||||
| `base/icons.jsx` | **Not ported as a module.** Its string-keyed lookup is the pattern shadcn-vue's rules name as wrong, so icons come from `@lucide/vue` at the call site |
|
||||
| `base/gauge.jsx` | `base/Gauge.vue` and `base/SegmentBar.vue`, both ported. The gauge's `aria-label` announces the rounded percentage, which closes `86au` |
|
||||
| `base/log-row.jsx` | `base/LogRow.vue` over `lib/log.ts` (`LOG_LEVELS`, `levelKind`, `shortTime`, `fmtValue`) |
|
||||
| `base/format.jsx` | `lib/format.ts` (`ago`, `compact`) |
|
||||
| `base/task-meta.jsx` | `lib/task-meta.ts`; Vue's reactivity replaces the manual boot-time re-render the Preact module needed |
|
||||
|
||||
Two decisions worth not re-litigating:
|
||||
|
||||
|
||||
@@ -83,14 +83,14 @@ the request-rate level.
|
||||
key-name heuristic `internal/gateway/stream.go`'s `sensitiveParameterKey`
|
||||
already uses for tool-call parameters (matches `token`, `secret`, `password`,
|
||||
`passwd`, `api_key`, `apikey`, `authorization`, `credential`, `cookie`,
|
||||
`private_key` against normalized JSON keys) and replace matching values with
|
||||
`private_key` against normalised JSON keys) and replace matching values with
|
||||
the same `[redacted]` marker. This is best-effort, not a guarantee -- a
|
||||
sender that names a secret field something the heuristic misses will still
|
||||
have it captured. Document that limitation where captured payloads are
|
||||
displayed, rather than implying the redaction is complete.
|
||||
|
||||
**Visibility:** captured payloads, redacted or not, are visible only to an
|
||||
authenticated dashboard operator -- the same authorization boundary as every
|
||||
authenticated dashboard operator -- the same authorisation boundary as every
|
||||
other webui surface, not a separate or lower bar.
|
||||
|
||||
## What this does not decide
|
||||
|
||||
Reference in new issue
Block a user