First slice of docs/prds/eda-playbook-engine.md: which registered
workflow an intake Kind (bug/feature/bootstrap) prefers is now data,
loaded from an optional WorkflowRoutingFile, instead of a Go literal.
labelKinds and the NATS-subject-per-kind set are unchanged -- expanding
the label vocabulary itself is a separate, larger decision (subject
allocation) deferred per the design doc's open questions.
An unrecognised kind in the file is a reported load failure (schema
defines what's accepted, per the design doc's collision-handling rule),
not a silently-dropped binding. No file configured falls back to
today's hardcoded defaults unchanged.
Records the design for drop-in, data-driven workflows/labels/actions:
YAML playbooks as pure orchestration data over four typed logic
positions (Workflow/Module/Channel/Forge), go:generate-driven schemas,
and load-time collision handling (detect+log+report, no auto-arbitration).
Flags execution-time idempotency and mid-run failure handling as
unresolved gaps to close before Channel/Forge or multi-action playbooks
ship.
Use @testing-library/preact rendered under jsdom (registered via
test/register.js) so the Post-Preact .jsx components and pages are
exercised through the real automatic-runtime render path instead of the
legacy el() DOM-helper API the tests were written against.
- Add jsdom + @testing-library/preact dev deps and a jsdom globals setup
in ui/test/register.js (window/document/navigator/getComputedStyle/...).
- Switch the .jsx loader hook to the automatic JSX runtime to match
@preact/preset-vite, so source files that shadow h (mapping-editor) and
Fragment/children arrays work exactly as in the Vite build.
- Migrate captures, config-row, mappings, settings-update-status,
task-logs, settings-lifecycle, settings-schema, tasks-actions and the
chat-app tests to render the Preact components and query the DOM via
testing-library.
- Fix a real render bug in tasks.jsx: <h.Fragment> is not rendered by the
automatic runtime (rows came out as [object Object]); use the imported
<Fragment> instead, matching the other migrated modules.
append(nonce, sealed...) appends to a slice initialized with a non-zero
length, which makezero flags. Build the nonce||ciphertext||tag payload with
an explicit buffer sized upfront instead.
Found by golangci-lint.
RedactPayload only redacted values under a fixed set of sensitive key
names, so a sender that names a secret field something else leaked it into
captured_events.body. Harden the heuristic:
- broaden the key-name markers (compound names like access_token,
client_secret, signing_key, x_api_key, webhook_secret, refresh_token)
and keep gateway.sensitiveParameterKey identical to preserve the
documented agreement between the two redaction paths.
- add value-shape detection: a compact JWT or a PEM private-key block is
redacted under any key, catching the 'sender named the field something
the heuristic misses' gap.
- keep it conservative so schema-by-example field mapping still works:
only unambiguous shapes (eyJ-prefixed JWTs, PEM key blocks) are
redacted by value, never ordinary content.
Best-effort per docs/prds/webhook-intake-security.md point 5.
Refs archie-core-t2db (captured_events.body redaction)
binding.Binding.Secret was persisted as plaintext in the bindings.secret
column, so anyone with the SQLite file saw sender-side HMAC secrets. Seal
it with AES-256-GCM transparently inside the store: encrypt-on-write,
decrypt-on-read.
- cipher: AES-256-GCM, 12-byte random nonce, SHA-256-normalised 32-byte
key resolved through the secret registry ([bindings].encryption_key).
- envelope 'arcie-binding:v1:<fingerprint>:<b64(nonce||ct||tag)>' so a
future cipher/KDF change is a version bump and old rows stay readable.
- rotation via previous_encryption_keys; key identity is the material's
SHA-256 fingerprint embedded in each row.
- legacy plaintext rows written before a key was configured stay readable;
encryption is not retroactive.
- nil cipher (no key configured) preserves the pre-t2db.7 plaintext path.
Deferred: captured_events.body redaction upgrade (separate concern, see
docs/prds/binding-secret-encryption.md).
Refs archie-core-t2db.7
Implements archie-core-t2db.4: the runtime-editable binding entity that
turns a captured webhook into an archie task, plus the per-source HMAC
verification at handleCapture that makes t2db.5's 'unauthenticated event
cannot trigger a binding' invariant structurally enforceable.
Captures, mappings and bindings are now separate concerns on the same
single *store.Store; the new BindingStore / BindingDispatcher /
BindingTaskCreator split keeps each interface under the interfacebloat
limit (8 methods).
State machine: draft -> pending_approval -> armed; any edit on an armed
binding drops it back to pending_approval, enforced in SQL via
status='pending_approval' on UPDATE so the rule cannot be bypassed by a
direct status field in the request body. Approve is the only sanctioned
transition into armed (WHERE status='pending_approval' guard).
Overlap: two bindings may not share a source in any status; enforced at
InsertBinding and UpdateBinding (transaction-local SELECT). Approve has
a separate TOCTOU guard so a race between Insert and Approve cannot
// bypass the check.
HMAC at handleCapture: reads X-Hub-Signature-256 (then X-Signature-256)
// fallback, verifies via webhookguard.VerifyHMAC against the binding's
// per-source secret, marks CapturedEvent.Authenticated=true on match.
// Captures with no armed binding, missing signature, or wrong signature
all persist as authenticated=false -- the dispatch loop's
binding.Matcher.Matches gate (requires authenticated) is what stops
them from spawning a task. Two armed bindings for one source returns
409 at capture time as a belt-and-braces TOCTOU guard.
Dispatch loop: added Daemon.dispatchBindings, called from both Cycle
and maintainAndDrain between poll and drain. Walks
captured_events where authenticated=1 AND source IN armed bindings
AND id NOT IN binding_dispatches, runs the binding's matcher, resolves
the mapping, enqueues a chat-style task with binding_id /
// binding_version provenance stamped in the same transaction as the
// row insert. The binding_dispatches ledger (composite PK on
(binding_id, capture_id)) is the at-most-once guarantee across cycles
// and daemon restarts.
Tasks schema migration: binding_id INTEGER NOT NULL DEFAULT 0 +
binding_version INTEGER NOT NULL DEFAULT 0 (taskSchemaVersion bumped
1 -> 2). Existing tasks keep 0 / 0.
Out of scope (documented follow-ups):
- secret encryption at rest (plaintext today)
- full dashboard HTML for the binding editor (CRUD API only this bead)
- per-binding rate limits (existing per-remote-address limit applies)
- binding.Owner / binding.Repo fields (dispatch falls back to the
single configured repo; multi-repo deployments log and skip)
Adds PATCH /api/config/repos/{owner}/{name}, a dedicated seam distinct
from the generic dotted-key PATCH /api/config path: a repository is
one element of []config.Repo, not a flat key. Traced the mechanism
before adding any new plumbing -- overlay.Nest/ApplyOverlayValues
already handle "repos" as a single whole-slice key with no dot, so
the fix is a webui handler plus a bootstrap seam that reads the
daemon's live, untrimmed Repos (never webui.RepoView, which omits
Preflight/TestGlob), mutates the one matched field via the pure
applyRepoFieldUpdate helper, and republishes through the existing
UpdateConfig(ctx, {"repos": repos}) path unchanged.
config-row.js's row() gains an opts.save override so an edit can be
redirected to a different persistence call. The repositories table
renders an autosaving checkbox for the two booleans and a
save-on-blur/Enter input for max_retries, via api.configRepoUpdate.
Closes archie-core-b6ew.6, and with it archie-core-b6ew.
TestConfigFieldDescriptorsRestartRequiredIsDeliberate pins the exact
RestartRequired value per field against the reload.go evidence
already documented in configFieldDescriptors' own comment, so a field
reclassified without re-checking reload.go fails loudly instead of
silently defaulting to "takes effect immediately."
ui/test/settings-schema.test.js renders settingsPage against a schema
fixture containing a field settings.js was never written to know
about, proving the renderer needs no field-specific branch to show it
correctly, and asserts by reading settings.js's own source that none
of the generically-rendered fields' keys appear literally in it --
the direct regression test for archie-core-b6ew.3.
The rest of this issue's scope (metadata completeness, structured/
locked non-editability, schema secret-leak guard) was already covered
incrementally while implementing archie-core-b6ew.1 through .4.
Closes archie-core-b6ew.5
RepoView.ReviewEnabled was previously absent from GET /api/config
entirely, not just unrendered; add it alongside AllowConcurrent and
MaxRetries. The repositories table gains Concurrent/Max retries/
Self-review columns as read-only pills -- this is the concrete
discoverability fix for "why isn't a second agent running": that
config was already reachable from the API, just never shown.
config.example.toml documents review_enabled, which had no example
entry before this.
Full inline editing of per-repo fields is out of scope here: the
dashboard's PATCH /api/config path has no array-index support for
updating one element of the Repos slice, which is separate,
real scope -- filed as archie-core-b6ew.6.
Closes archie-core-b6ew.4
settings.js drops identityCard/budgetsCard/storageCard/webCard/
pullPolicyLabel in favour of one schemaCards() that walks cfg.schema
and builds a card per section, a row per non-structured field --
label, type, description, editability and enum options all come from
the backend descriptor instead of a hardcoded row(...) call per key.
config-row.js gains: enum fields edit as a <select> from opts.options;
opts.editable === false renders read-only distinct from a locked row
(no reason to show, just no edit affordance); opts.hint carries a
field's description as the label's tooltip, so "0 means unlimited."
travels with the field instead of being baked into a display-value
string per key.
ConfigSection also gains Description, filled in per section to match
each card's existing sub-text, since the card's own explanation is
schema metadata too.
Structured sections (repositories, models & providers) are untouched
-- still the existing bespoke renderers, reserved for archie-core-b6ew.4.
Closes archie-core-b6ew.3
ConfigView.Schema carries the archie-core-b6ew.1 descriptor catalog
with each request's own values, locked reasons, and overridden
markers attached (buildConfigSchema), additive alongside the existing
flat fields so nothing that reads ConfigView today breaks.
Tests confirm schema values match their flat-field source of truth,
locked reasons propagate to the schema entry, structured fields stay
non-editable, and secrets never reach the schema block.
Closes archie-core-b6ew.2
Introduces ConfigField/ConfigSection and configFieldDescriptors(),
attaching key/label/type/editable/restart-required to every field
GET /api/config already exposes -- the data-independent half of the
schema contract from docs/prds/config-schema.md. RestartRequired is
sourced from reload.go's reloadableFields/reloadableSubFields
allowlist rather than guessed.
Not wired into the API response yet (archie-core-b6ew.2); this issue
is the catalog and its contract tests only.
Closes archie-core-b6ew.1
Field metadata (label, section, type, editability, restart-required)
currently lives only in settings.js/config-row.js, disjoint from the
backend's ConfigView allowlist -- adding or changing a runtime-tunable
setting means editing Go and JS by hand in two places with nothing to
catch drift. Repo.ReviewEnabled never reaches the API at all, and
AllowConcurrent/MaxRetries reach it but the repositories card never
renders them.
Decision: keep the existing secret-free ConfigView allowlist as the
safety boundary (no reflection over config.Config, which is already
scheduled for dissolution), and hand-author a descriptor per allowed
field so the frontend renders sections/fields generically instead of
hardcoding rows.
Filed as archie-core-b6ew (epic) with five dependency-ordered children.
session-memory's extracted actions never set Action.At, so the wire
carried time.Time's zero value ("0001-01-01") and the Curators
dashboard rendered it as "105694 wks ago". Stamp the action with the
curator's clock at the producer, and backfill any zero Action.At in
activityTracker.record from the pass's own timestamp so an engine
with no clock (skillcurator) can't hit the same bug.
Closes archie-core-z6wy
Persona/SOUL text was interpolated raw at the top of archie.md.tpl,
so a hostile SOUL could inject its own <core_rules> or
<instruction_precedence> tags ahead of the real ones. Render it
through the existing xml-escaping helper into a labeled
trust="data" <soul> block, and tell instruction_precedence
explicitly that the block is reference data, not an authority.
Closes archie-core-1786637490097-12-bf415ffb
Sticking with red-green TDD plus task check as the gate for now,
rather than a fresh-context reviewer pass on every change by default.
Adversarial review stays available, just opt-in per request.
Route() had no content-aware fallback: any task with no explicit
workflow and no label match ran the full "implement" pipeline
regardless of content. Confirmed in production (task 6): a
chat-spawned task whose entire content was "this is just a test,
close it when you receive it" burned 669,421 tokens finding that out
the expensive way -- baseline, plan, and build all ran before the
plan stage's own conclusion (nothing needed to change) arrived too
late to save anything.
Adds a "triage" workflow: one cheap, read-only classification turn
(mirrors feasibility.go's decide-tool pattern) that either closes a
task needing no code change immediately, or sets Task.Workflow and
requeues under whichever workflow fits. Route()'s fallback now
prefers a registered "triage" over "implement", unchanged when
triage isn't registered. Labeled tasks are untouched -- a label is
already a free, reliable signal, so triage never fires there.
See docs/prds/dynamic-workflow-triage.md for the full design.
Confirmed in production (task 6, 2026-09-02): dashboard/PR summaries
showed raw prompt-token sums with no cache accounting -- 360,018 of a
reported 400,021 "prompt tokens" were cache hits billed at a steep
discount, not full price. Real fresh spend was ~40,003 tokens, roughly
10x less than the headline number implied. Nothing was double-counted;
the totals were internally consistent, just presented misleadingly.
Adds TaskContext.RunUsage (in-memory, presentation-only) and
formatTokenUsage, rendering "N tokens (F fresh + C cached)" in PR
bodies and the dashboard timeline instead of a raw sum, falling back
to the plain total when no breakdown is available.
Also trims StageBaselineGate's retry-mission prompt to failing-only
go test output via extractFailingGateOutput -- the full passing-
package listing was a direct, mechanical contributor to the growing
per-iteration prompt sizes on every gate-repair retry, not just a
display problem. Degrades to unchanged output for non-Go gates or
unrecognized shapes.
GET /api/tasks/{id}/logs was fully working -- internal/logging's
decode() already captures every JSON field generically (stage,
tokens, iterations, model, everything) -- but nothing in the
dashboard ever called it. The only Logs page hit the daemon-wide
feed, which never carries this per-stage/per-agent-run detail in the
first place. An operator could never see why a task took as long as
it did or its token spend breakdown, even though the daemon already
recorded and could already serve it.
Adds a collapsible attempt-log section to each task's existing
timeline drill-down, reusing the daemon-wide page's row rendering
(extracted to ui/src/base/log-row.js as the shared second consumer).
Confirmed in production (carina, 2026-09-02, task 6): StageBaselineGate
spent 405,004 tokens genuinely fixing two broken pre-existing tests and
committed the fix locally, then the plan/build stages correctly found
nothing further to do for a content-free task. StageCommitPush decided
"no changes required" purely from the build stage's own empty diff,
with zero awareness that StageBaselineGate had already committed a
real, gate-verified change two stages earlier -- so it never pushed,
never opened a PR, and the whole worktree (including the real fix) was
discarded. 669,421 tokens burned to fix a real bug that then evaporated,
and it recurs: any task that hits the same red baseline pays the
identical tax again since the fix never lands.
Adds TaskContext.BaselineFixed, set when StageBaselineGate's own
CommitAll reports a real commit. The build stage's no-changes
determination now respects it, and StageCommitPush pushes whenever
either a fresh commit was made or a baseline fix already landed,
instead of erroring on an empty tree.
channels.Manager.MarkRunning was never called for telegram, email, or
webhook -- every start path only called MarkStarting then MarkFailed
on error, so the dashboard showed a working channel stuck on
"Starting" forever (confirmed live: Telegram polling and delivering
messages while /api/channels still reported "starting").
Adds gateway.Lifecycle{Starting, Running func()}, threaded through
Gateway.Start(ctx, router, lifecycle). Email and webhook report
Running once their listener actually binds -- webhook moves off
http.Server.ListenAndServe's internal bind to an explicit
net.ListenConfig.Listen so binding is observable before Serve.
Telegram reports Running after StartWebhook launches in webhook mode,
or after the first successful getUpdates response in long-poll mode,
observed via a pollReadinessClient http.Client wrapper since the
go-telegram/bot library keeps polling errors inside its own worker
goroutine. Restart re-reports Starting/Running each cycle.
ai-sdk (already a dependency) has a provider-agnostic image.Provider,
core.GenerateImage, and registry.RegisterImage -- three backends
(azure/togetherai/xai) implement it, OpenAI doesn't yet. The next
bead should adapt that instead of a raw HTTP client, mirroring how
curatorLLMRunner adapts runtime.Runtime for chat. Noted the one real
gap (no edit/mask support in ai-sdk's request type) for that bead to
resolve at its own design step.
Adds internal/domain/image (Provider/Registry per the plugin engine
family shape, but no Lifecycle -- a provider is call-scoped, not
long-running) and config.ImageConfig with the same explicit
enabled=true cost gate MinimaxConfig already uses, since a hosted
provider spends real API credits and a local one can saturate the
host GPU. Design doc at docs/prds/image-capability-contract.md per
CLAUDE.md's rule for undesigned capabilities.
No provider implementation lands here -- that's the epic's next
child bead. Also re-links all 7 epic children that were unlinked
from archie-core-1786748942120-1-6636e629 (same orphaning pattern
found in the curator/memory epics earlier this session).
FeedHandler.WithAttrs/WithGroup only tracked bound attrs for the live
feed copy; Handle forwarded the bare record to the wrapped handler, so
component (and any other With-bound attr) never reached stderr/file
JSON sinks or survived restart for historical log filtering. Now
WithAttrs/WithGroup also derive the wrapped handler via its own
With*, matching agentexec.SystemLogHandler's existing pattern.
Closes archie-core-1786637499114 (persistent session-memory curator),
the last open item in the curator engine epic.
docs/prds/session-memory-curator.md records the decisions this needed
before coding, most notably: Observation.Identity is the session ID,
not a user or cross-session identity. migration-decisions.md#5's
memory-scope mapping (global/agent-wide/user-wide/agent-user
relationship) is still explicitly open, and this issue has no business
deciding it unilaterally -- session-as-identity is the narrowest
unambiguous scope available today and is forward-compatible with a
later, properly-decided identity resolution.
curator gains ConversationSource (RecentSessions/Messages), gated in
Registry.validateDeclared/filter exactly like Skills/MemoryEngines, plus
Manifest.Conversations. internal/infrastructure/sessioncurator/adapter.go
adapts gateway.SessionStore's full CRUD/branch/search surface down to
those two read-only methods -- curator must not import gateway.Message,
so role derivation (message.From == botUser -> assistant) is copied from
gateway.compressTurnHistory's existing logic, not shared.
sessioncurator.go: Check is a cheap RecentSessions bool. Pass takes each
session's last 40 messages, asks the model for a JSON array of durable
facts (capped at 5/session), and writes each through
Registrar.MemoryEngines.Get(name) -- resolved by name at call time, the
same trust model every other curator capability already uses. A
response that fails to parse degrades to "nothing extracted" for that
session (not a Pass error); a real model-call failure propagates as one
(these were originally conflated into the same swallowed-error path --
caught by TestPassPropagatesALLMFailure, fixed by splitting the model
call from the parse step). PassInput.Since zero resolves to a 24h
lookback, not the beginning of time, so a cold-start first pass can't
read a session's entire history.
Manifest.OnInput = true wakes it via the existing WakeOnPrimaryInput
wiring (events.KindTurnCompleted), which already excludes every
curator-derived event kind from the forwarded set -- the trigger-
accounting invariant (archie-core-1786637489768) needed no new code to
hold here.
Wired into bootstrap.go:setupCurators via a new curatorLLMRunner adapter
(main.go) over the shared ai-sdk runtime, and sessioncurator.NewAdapter
over b.chatSessionStore/b.cfg.BotUser. Model resolves from
b.chatModels.ActiveModel() -- not b.defaultChatIdentity, which names a
task-routing identity, not a model reference (the same source
telegram_setup.go's sendChatTurn already uses for a real chat turn).
task check is green (full Go suite + dashboard tests).