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).
Part of archie-core-1786637499206 (skill curator reference
implementation), under the curator engine epic.
docs/prds/skill-curator.md records the design decision this needed
before coding (no settled design existed for what "review, prune, and
improve skill definitions" means as concrete Pass() behavior): v1 is
mechanical validation and safe whitespace normalization only. No
LLM-authored rewrites of skill content, no automatic deletion -- an
autonomous process editing or deleting a user's skill has no undo path
today, and the epic's actual purpose for this issue is proving the
curator contract holds for a second, structurally different consumer
(files-as-skills vs. observations-as-memory), not solving "what makes a
skill good."
internal/infrastructure/skillcurator/store.go: a curator.SkillStore
implementation over one root's .agents/skills/*/SKILL.md files. Not
internal/skill.Discover directly -- Discover parses every skill up front
and fails the WHOLE call if any one of them doesn't parse (correct for
"load the catalog to boot the daemon", wrong for "review each skill and
report what's wrong with it individually"). This store lists/reads raw
bytes per skill; the curator itself parses each one so one bad skill's
parse failure becomes one Action, not an aborted pass.
internal/infrastructure/skillcurator/skillcurator.go: the CuratorEngine.
Check is a cheap directory-listing bool. Pass classifies each skill into
exactly one of: skill.invalid (frontmatter parse failure, left
untouched), skill.incomplete (missing required name/description,
untouched), skill.normalized (trailing whitespace / missing final
newline, written back), or nothing (already clean). Manifest declares
only Skills -- no Tools, no MemoryEngine -- since nothing here needs
either.
Wired into internal/app/archied/bootstrap.go:setupCurators, rooted the
same way loadWorkflows already resolves skillsBase (cfg.SkillsDir falling
back to cfg.WorkDir) -- one local root, not the full multi-root catalog a
chat turn reads. Skills is now a shared registrar-level service
(alongside Events/MemoryEngines), narrowed out of a curator's view by
registry.filter when undeclared, same as every other capability.
task check is green (full Go suite + dashboard tests); go test ./...
is green.
Closes archie-core-1786637499161-356-e424e40d.1.
setupMemory's own doc comment claimed external providers are added via
RegisterExternal when cfg.Memory.Provider is set -- no such call
existed. Investigated wiring it for real: there is no external
MemoryProvider implementation anywhere in the repo to construct and
register (only internal/memory/builtin.Provider exists), so there is
nothing to route memory.provider's value to yet. Wiring the call would
be dead plumbing to nothing, not a fix.
The actual defect is that setting memory.provider has always silently
done nothing -- an operator who set it reasonably believed they
configured something. validateMemory now rejects it outright with a
clear reason, turning a silent no-op into a loud one at config load,
same failure-loudly posture as every other unimplemented-value check in
this file. Drop the rejection once a real external provider (or the new
domain/memory engine family's Honcho proof, archie-core-1786637492031)
gives the field an effect again.
Updated setupMemory's doc comment and config.example.toml to match --
the provider_config example is removed too, since it has nothing left
to configure.
Closes archie-core-1786637499636 (bind curators to memory engines).
curator.Registrar gets MemoryEngines, a MemoryEngineSource
(Get(name) (domainmemory.MemoryEngine, bool)) mirroring
domain/memory.Registry.Get's exact signature so the real registry
satisfies it with no adapter. Registration enforces presence the same
way Tools/Skills already do: a curator declaring Manifest.MemoryEngine
with no MemoryEngineSource on the host is rejected at Register, and
filter() clears MemoryEngines from a curator's view when it declared no
engine. A curator with a declared name that turns out not to exist in
the registry is not this layer's problem -- Get(name) at call time
returns false, same as ToolBuilder.Build with an undeclared tool.
Resolution is by name at call time, not a value pre-fetched at Bind: a
curator calls MemoryEngines.Get(its own Manifest().MemoryEngine) itself,
the identical trust model ToolBuilder.Build(ctx, declared) already
uses -- the curator is trusted to pass its own declared identifier, not
handed something pre-scoped to it. Swapping the configured engine (a
different name resolving through the same registry) changes where a
curator's memories land with no change to the curator itself, since
nothing about the curator's own code names a concrete engine.
setupCurators wires b.memEngines (*domainmemory.Registry, set by
setupMemoryAll which Run() calls first) straight in -- it already
satisfies MemoryEngineSource.
A curator declaring no memory engine remains valid (existing behavior,
now also covered by the "nothing declared" and "no source" table
cases) and is only ever affected by a memory operation it never has the
means to attempt, since MemoryEngines is nil in its view.
Completes archie-core-1786637499480 (ship the file-writing store as
the default memory engine): cfg.Memory.Engine now actually selects and
starts an engine, closing the gap the previous commit's message called
out as remaining.
setupMemoryEngine builds a domain/memory.Registry, registers
infraMemory.BuiltinEngine for "builtin" (and the empty/unconfigured
case, matching applyMemoryDefaults' resolution) rooted at
workDir/memory-engine -- separate from the legacy provider's
workDir/memory, so the two can never collide on the same files while
both exist -- starts the registry, and stops it on daemon shutdown.
cfg.Memory.Engine is already validated against the same set at config
load (configuration.validateMemory), so the switch's default case only
guards the two lists drifting apart, not live operator input.
setupMemory and setupMemoryEngine are both called through a new
setupMemoryAll from Run(), which was already at its cyclomatic
complexity budget -- a genuine grouping (both are memory-subsystem
startup), not two unrelated steps merged just to hit a number.
setupMemoryEngine deliberately does not thread Run()'s ctx through to
registry.Start, matching setupMemory's own existing choice for the same
reason (Start is a synchronous startup step, not a subscription that
needs the daemon's lifetime the way setupCurators' WakeOnPrimaryInput
does) -- also what avoids a contextcheck trip that threading ctx through
setupMemoryAll produced during development.
Not yet done: internal/memory.Manager (the live system-prompt/tool-call
path) does not read through this registry -- the two memory systems run
in parallel, per archie-core-1786637490069-11-e245c170's explicit "do
not extend the legacy system in place" scoping. That convergence is
future work, not part of this issue.
Part of archie-core-1786637490043 (config surface for memory engine
selection and settings).
config.MemoryConfig gets an Engine field selecting among the
domain/memory engine family, plus toml tags on every field -- Provider,
ProviderConfig, and SessionTTL had none before, yaml/json only, which
didn't match repo convention.
Engine and Provider are kept as two separate fields rather than one:
they select between two different mechanisms (the new engine family vs.
the legacy external-provider path, archie-core-1786637499161-356-e424e40d.1),
and conflating them would mean a value meant for one silently getting
read by the other once both are wired.
applyMemoryDefaults resolves an absent engine to "builtin" so
unconfigured and explicitly-builtin are the same state everywhere after
defaulting. validateMemory rejects an unrecognised engine name in the
same style as forge.type's existing validation -- named constant list,
"%w: field %q (want %s)" shape, wired into the same validate() chain.
config.example.toml documents the new field.
Not yet wired to anything: nothing reads cfg.Memory.Engine at daemon
boot yet to actually select and start an engine through
domain/memory.Registry. That's bootstrap wiring, tracked as the
remaining half of archie-core-1786637499480 (ship the builtin store as
the default engine).
Part of archie-core-1786637499480 (ship the file-writing store as the
default memory engine).
Records the missing design decision first (migration-decisions.md#5,
"authoritative memory record and revision model" was explicitly open):
internal/memory/builtin.Store addresses blocks by content substring with
no stable per-block ID, which the new Record{ID}/Forget(id) contract
needs. Decided and implemented: an ID assigned once at Write via a
leading `<!--mem:<uuid>-->` marker line, stripped back out of
Record.Content on read, located by that marker (not content) for
Forget -- so an unrelated edit can never orphan a Forget. Identity maps
to a directory named hex(sha256(identity)), not the identity string, so
an arbitrary identity can never traverse outside the configured root.
Kind maps to a builtin section name via the store's own
ValidateSectionName, so an invalid Kind fails the same way an invalid
section already does.
internal/infrastructure/memory.BuiltinEngine wraps one builtin.Store per
identity and implements domain/memory.MemoryEngine end to end
(Write/Query/List/Forget, Lifecycle, Manifest). Lives under
internal/infrastructure per organisation.md ("infrastructure implements
domain contracts"), not internal/domain/memory, which stays
contract-only.
internal/memory/builtin is untouched -- confirmed via git status and its
own test suite passing unmodified, per this issue's acceptance
criterion. This engine is not yet wired into daemon bootstrap or the
config surface (archie-core-1786637490043); it proves the contract
holds for the builtin store the same way curator's reference
implementations prove the curator contract, and registers/runs cleanly
through domain/memory.Registry (TestBuiltinEngineRegistersAndRuns
ThroughTheRegistry).
Part of archie-core-1786637490069-11-e245c170 (memory engine contract
and owning registry), under epic archie-core-1786637499161 (pluggable
memory engine).
Stands up internal/domain/memory as a conforming engine family per the
strict plugin engine rule, mirroring internal/domain/curator's split
exactly as that issue's notes specify:
- contract.go: MemoryEngine (Lifecycle + Store + identity + Bind), with
Store carrying the real domain operations the epic requires --
Write/Query/List/Forget -- not just Name/Version. Store is split out
from MemoryEngine so the interface stays under golangci-lint's
interfacebloat threshold the same way curator's embedded Lifecycle
does: an embedded interface counts as one slot, not its expanded
method count.
- registrar.go: narrow typed host access (EventSink, Clock). No
capability-gated fields yet -- unlike curator's Tools/Skills, no
memory-specific host service exists to gate on today, so Registry.Bind
passes the host straight through rather than filtering.
- registry.go: Register/Get/Names/Start/Health/Stop with the same
duplicate/nil/panic/failure-isolation guarantees as curator's registry,
ctx-bounded Stop, reverse-order shutdown.
This is the contract only -- no engine implements it yet, and
internal/memory's existing ad-hoc MemoryProvider/Manager (pre-migration)
is untouched, per the issue's explicit "do not extend in place" note.
Closes archie-core-atv2.
Media delivery is fire-and-forget with a 30s budget, far longer than
the turn's text usually finishes -- so a large upload failing (or
timing out) after doFinalize has already retired the renderer goroutine
is the normal case, not an edge one. appendFallbackLine was still
writing into toolLines and calling requestRender, a non-blocking send
into a channel nothing reads any more once stopRendering has returned:
the line was silently dropped and the finalized message stood
unchanged, with nothing telling the user or the agent the file never
arrived.
stopRendering is the single point every finalize/abandon path funnels
through to retire the renderer, so it's the right place to mark the
reply finalized. appendFallbackLine now checks that flag and, once
set, sends the fallback as its own follow-up message instead of
appending to a buffer nothing will render again.
Two bugs behind the "System statusEverything is operating normally."
render:
1. Consecutive plain lines with no blank line between them were joined
into one paragraph's text with an embedded "\n". Telegram's
rich-block paragraph does not render an interior "\n" as a break --
it renders nothing, so the words ran together with zero separator.
Join with a space instead: the correct rendering of a CommonMark
soft line break anyway, and it survives regardless of how the
client treats a literal "\n".
2. Telegram's renderer adds no vertical gap between adjacent blocks on
its own -- only a heading carries its own margin -- so a label line
immediately followed by a list (or any two non-heading blocks back
to back) rendered touching, with the list's first item glued to the
preceding text and no visible line break at all. appendBlock now
inserts an empty spacer paragraph before any block that doesn't
follow a heading, making the gap explicit instead of depending on
client-side spacing that isn't there.
Reproduced directly against markdownToBlocks with the reported input
and confirmed the fix before writing this up.
"Treat this as UNCONFIRMED, not complete" is developer-speak in a
message an operator with no codebase context has to act on. Reword to
plain instruction: say what's known, then what to do about it.