Two halves of one boundary: a credential resolves to an identity, and an action
records which identity acted and whose authority it used.
resource server. internal/infrastructure/oidc verifies a provider-issued bearer
token against the provider's published keys, using an OSS OIDC library: archie
compares no signature, validates no claim and rotates no key itself, holds no
client secret and issues no session, so a compromised archie cannot mint an
identity. Audience is required rather than optional -- a token minted for another
service must not authenticate here -- and discovery happens at construction, so an
unreachable provider is a startup failure rather than a request-time surprise.
identity.Authenticate is the single place a credential becomes an identity, and it
refuses in four distinguishable ways: no credential presented, a credential that
did not verify (wrong key, expired, wrong issuer, wrong audience, malformed), a
verified subject with no identity bound to it, and an identity that may not act.
The order is deliberate: verification happens before any field of the token is
used, so nothing an unverified token carries can select an identity. A suspended
identity is refused even though its credential verified, because suspension is
archie's decision and must not depend on the provider withdrawing a token.
The binding is the second bridge beside the legacy-name alias: identity_subjects
keys (issuer, subject) so the same subject string from another issuer is a
different caller, and rebinding moves a subject so two identities can never claim
one provider subject. The contract Authenticate needs is SubjectResolver, narrower
than Repository, so a consumer that only authenticates does not take the whole
identity CRUD surface -- and staterpc.Client, which asserts Repository, does not
need a new RPC to satisfy it.
attribution. taskactions now records two identities per action: the acting
identity and the authorising principal, both on the event row as new columns added
through the existing migration table. The rule that the bug turned on is enforced
by the event kind describing the actor: a person's approval is human_approved, an
agent's is agent_approved, and an action with no verified actor is task_approved,
a task-level event that credits nobody. An agent acting under a person's standing
approval records itself as the actor and that person as the principal, so
"approved by came from me" is answerable from the record rather than asserted.
Scope and actor are separated: scope decides which task a caller may touch and is
never promoted into an actor, because the dashboard's credential is a shared token
and possession of it is not evidence that a person was at the keyboard.
That last point is a deliberate fidelity trade, and the reason the transport is
not wired: the dashboard action path passes no actor yet, so dashboard approvals
are now recorded as task_approved rather than claimed as a human's. Recording
nothing false is the requirement; naming the human verifiably needs the dashboard
to authenticate a token and resolve it, which needs two new state-store RPCs
(ResolveIdentitySubject, BindIdentitySubject) -- the next piece, not a rewrite:
the verifier is a one-method interface, so introspection would be a second
implementation of it.
Verified: task check exit 0; focused runs recorded in the handoff. Opaque
authelia_at_ tokens were inspected rather than assumed and cannot be verified
against public keys; infra is configuring access_token_signed_response_alg RS256
on the archie client, with audience https://archie.catlow.cloud and issuer
https://auth.catlow.cloud.
* feat(workflow): post line-anchored review comments with suggested fixes
Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached
the operator only as a flat list in the PR body, so the author had to map every
finding back to its line by hand and apply mechanical fixes by hand. Now the
line-anchored findings are also posted as inline review comments, carrying a
one-click suggestion when the reviewer could state the fix.
Domain (internal/domain/workflow):
- ReviewFinding gains Suggestion; Validate rejects one on anything but a
confirmed finding, so the agent's record_finding call is refused with
something it can act on. Validate splits into validateAnchor /
validateClassification / validateDisposition, which also brings it back under
the cyclop limit the gate enforces.
- StagePostReviewComments runs after StageOpenPR in the implement workflow. It
posts only line-anchored findings (Line > 0); a whole-file finding has no line
to attach to and stays in the body list, which remains the complete record.
It is best-effort: the PR is open and the body already lists every finding, so
a failed comment is logged, never a park -- the same reasoning as OpenPR's
existing best-effort LinkBranch call.
- The suggestion fence is gated on Verdict == confirmed where the fence is
written, because it is a one-click apply: a wrong suggestion breaks the code
and the author has to notice.
Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations,
type-asserted like PullRequestReader so a forge that cannot is skipped rather
than faked (NoopForge is pinned as not satisfying it). GitHub loops one
CreateComment per comment and joins the failures, so one refused anchor cannot
drop the rest; Gitea carries them on a single COMMENT-state review.
Two deliberate departures from the PRD's sketch, both recorded in it:
- The interface is batch (CreateReviewComments), not one call per comment:
Gitea's only inline shape is one submitted review, and the set then crosses
NATS once instead of once per finding.
- The head SHA is resolved inside each forge implementation rather than by the
caller. The stage runs in archie-agent, which holds no forge credentials and
has no PullRequestReader; the daemon-side forgerpc handler is the only place
that does.
Transport (internal/forgerpc): workflow.Forger gains the method, so the agent
reaches the daemon over the new create_review_comments subject; the server
type-asserts the writer and answers an incapable forge with an error the stage
logs. This is the one proxied method whose absence on an image skew does not
park a task.
The reviewer prompt and record_finding schema ask for a suggestion on a
confirmed, mechanically fixable defect only.
Regenerating the wfextract symbol table -- the documented way a new exported
workflow symbol reaches interpreted stage plugins -- also picked up symbols that
were missing from the committed table (the Status* and Source* constants,
ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to
every wrapper afterwards, as that file's header requires.
Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new
stage logic each fail a test that names the behaviour -- dropping the
confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure
escape -- so the tests discriminate rather than passing vacuously.
* fix(build): drop the Dockerfile pin assertion
The guard fetched golangci-lint's go.mod at image build time to fail the build
when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped
on self-inflicted pin drift, but it added a network fetch and a new failure
mode to the release build, which is not where that belongs.
The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0
equals GOFUMPT_VERSION) and the comment above them still states the invariant,
so the reasoning survives without the build-time machinery. The pin change
itself reaches the agent image through the normal release path: CI rebuilds
and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only
release deliberately does not.
* feat(workflow): add the remediate workflow for PR review remediation
Implements step 5 of docs/prds/pr-review-remediation.md: a remediate
workflow that resumes the task's existing worktree onto its PR branch
(worktree.Manager.Resume, not Prepare's refresh), runs a builder agent
against the review's actionable comments, commits and pushes to the
same branch, and replies via the forge's ReplyToReview. Task.RetryCount
doubles as the remediation round counter, capped by the repo's
max_retries; the round-cap stage parks the task and posts one comment
when it's hit.
Task gains a ReviewPayload field (JSON-encoded review unit) with full
store/proto/staterpc plumbing. workflow.Forger gains Comment and
ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume
and its Dir lookup are added as an unexported optional Trees capability
rather than widening the exported interface, which is already at
golangci-lint's interfacebloat cap and is projected into wfextract's
Yaegi symbol table for repository-authored stage plugins.
The daemon-side reaction consumer that dispatches into this workflow
(subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing
per-task serialization) is tracked separately in archie-core-8li9.4.
* feat(messaging): extract standalone messaging service binary and process composition
* feat(messaging): adapt channel frontends to consume Gateway ChatContract
* feat(messaging): remove in-process channels and Router from daemon bootstrap
Telegram, email and webhook now run only in the Messaging Service, which
reaches this process through the Gateway's ChatContract. The daemon builds
no channel and no gateway.Router, so the wiring that existed only to serve
them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway,
setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the
release-announcement path helper.
The seams those paths owned move to where they can still be honoured:
- Channel ValidateConfig runs in archiemessaging.compose, which now returns
an error, so a configured-but-invalid front-end fails the service rather
than being dropped silently.
- The inbound rate limiter moves to the Gateway process, which owns the only
Router and therefore the only place a per-sender budget applies to every
channel's turns.
- The daemon's gateway readiness probe becomes a ContractProbe against the
Gateway. It cannot observe a channel lifecycle it no longer runs, and a
channel-count probe would have reported every daemon degraded.
- telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a
chat turn runner actually reads.
Telegram operator features that were wired only in the daemon (/update,
release announcements, version reporting, SIGHUP reload) are not yet wired
in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting:
archie-core-8cda.6.8. The Gateway process builds no worktree manager, so
review_pr is unadvertised on every channel: archie-core-8cda.6.7.
* feat(messaging): re-wire the Telegram operator surface in the Messaging Service
setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's
own process. Each is resolved by where the fact it needs is owned, not by
where it used to be built; the decision table is in
docs/architecture/migration-decisions.md.
Wired here: /update (built from this service's own [chat.telegram] check and
install commands), the update-report relay (same sha256(bot_user)[:8] path the
daemon wrote, so a pending report is found rather than written afresh),
show_tool_calls, and /restart's config reload, which re-resolves the token and
allowlist from this service's own file and refuses a reload that resolves to
an empty token.
/version is sourced from the Gateway: ChatSnapshot gains a Version field
carrying the Gateway's rendered build block, read per call and bounded by the
dependency timeout. cmd/archie-messaging deliberately takes no version
ldflags, so it cannot report a partial upgrade as a matched one.
RunningVersions and ReleaseAnnouncements stay nil. Both need a component's
real running version, and the only versions this process can obtain are a
different binary's stamps -- reporting them would manufacture exactly the
false success the update check exists to catch, and the announcer without
parseable versions is a no-op that reads as configured. archie-core-8cda.6.9
carries the contract that unblocks them. Dangerous stays nil: no composition
has ever supplied a command authority.
Enrich is dropped from the update service: componentInstallTypeEnricher read
[nats], which this service must not decode, so the check command's own
reported install type stands.
* fix(workflow): guard inline review comments against head drift
Two findings from the review of q9au.
A comment's line numbers describe exactly one revision of the branch, but the
forge resolved the pull request's head at posting time -- after the review had
already read the worktree. A push in that window (a collaborator, a retry) meant
the findings were anchored to whatever now occupied those lines, mislabelling
instead of failing. The revision the review measured now travels with the
comment set: OpenPR records it from the same worktree read it already performs
(TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through
Forger to forgerpc, and the forge refuses the whole set once the head it reads
has moved off it -- which the best-effort stage logs, the PR body remaining the
record. An unmeasured revision posts unverified rather than dropping every
finding, so a worktree that cannot report one degrades instead of regressing.
Suggestion was documented single-line only, because GitHub applies a suggestion
fence up to its first line and a multi-line replacement would silently corrupt
the file. Only the verdict was validated, so a multi-line suggestion reached the
renderer and posted as that truncated fence. Validate now rejects an embedded
newline, which makes record_finding refuse it with feedback the model can act on
instead of the reviewer discovering the corruption later.
Server panic via missing :authority/Host header, reachable through
archied's gRPC gateway server. No stable google.golang.org/grpc release
carries the fix yet, so this pins the pre-release commit that does.
Wires the durable-memory engine into the chat turn: prepareTurn resolves a
per-channel Subject (BotUser as AgentID, TurnRunnerConfig.UserIdentity for
the user), runs a scope-only Query over Subject.Scopes(), and renders the
result into a new <memory purpose="durable_context" trust="data"> block
between <tools> and <env>, following the same untrusted-data framing as
those two blocks. The read is synchronous, total, and never surfaces an
error: a nil engine, a failing Query, or a panicking provider all degrade to
no memory block (recovered in gateway.renderMemory).
UserIdentity is supplied per channel by the composition
(userIdentityResolver in internal/app/archied): telegram and email resolve
their native SenderID, the dashboard ("web") and webhook resolve nothing, so
a webhook's route-path SenderID can never become a user identity and the
dashboard's shared bearer token can never impersonate a person.
Fixes the composition-ordering bug that left every turn runner holding a nil
memory engine: setupMemoryAll now runs before setupGateways in main.go, and
before setupGatewayChat in gateway.go's startGatewayRuntime, so
boot.memoryStore() has a live engine at every turn-runner construction site.
Named constants bound the read: memoryRecordsPerScope per scope, and
memoryBlockByteCap on the rendered block, which drops (and logs) trailing
records rather than truncating one mid-line.
Direct bumps:
- github.com/nats-io/nats-server/v2 v2.14.6 -> v2.15.0
- github.com/nats-io/nats.go v1.53.1 -> v1.54.0
- github.com/samcharles93/ai-sdk v0.1.32 -> v0.1.39
- google.golang.org/grpc v1.83.2 -> v1.84.0
- modernc.org/sqlite v1.58.0 -> v1.59.0
- golang.org/x/net v0.58.0 -> v0.59.0
- golang.org/x/term v0.45.0 -> v0.46.0
Indirect: go-humanize, x/crypto, x/exp, x/sync, x/sys, x/text, x/time,
genproto/googleapis{,/api,/rpc}, modernc.org/libc.
tools/ is a separate module and needs its own tidy to match the root's
ai-sdk and sqlite bumps. docs:check runs it with -mod=readonly, so a
stale tools/go.mod fails loudly there rather than being rewritten.
Operator report: tool output in the Telegram channel was unreadable during
search-heavy turns -- a wall of fenced blocks each showing one arbitrary
match line ("/path/config.json-322- }") under a heading that said
only "grep -- done".
The renderer quoted the first non-module-cache line of a result and appended
a line count recomputed from its own truncated sample, which could not agree
with the total the tool had already reported: one search rendered the tool's
"194 more lines" beside our "… 3 more lines". Two different numbers for one
result set read as noise, and the quoted line carried no context at all.
- Describe, don't quote: a search is reported as "N matches", a truncated
result as "<total> lines total; showing <n>", and every other tool falls
back to its first informative line. Truncation notices are skipped, since
they are metadata rather than content.
- Never invent a count: the tool's own reported total is the only
trustworthy source, parsed from its truncation notice rather than
recomputed from the visible sample.
- Remove the now-dead compactToolPreview and countNonEmptyOrContentLines.
Also bump go-telegram/bot v1.25.0 -> v1.27.0, which fixes a streaming bug
that lands squarely on this path: rawRequest sent the multipart body through
an io.Pipe, which net/http cannot replay, so sendMessage/editMessageText
failed until the connection was dropped.
Remaining work from the report (collapsing repeated calls into one counted
entry, and a ring of recent activity lines with a capped frame) is tracked
in #837.
* refactor(workflow,store): relocate Task/Status/Source and define workflow.Store
Move store.Task, store.Status*/store.Source*, and the 3-method workflow
store interface out of internal/store into internal/domain/workflow as
workflow.Task/workflow.Status/workflow.Source plus a consumer-owned
workflow.Store, superseding store.WorkflowStore. internal/domain/workflow
now imports zero internal/store symbols; internal/store persists the
domain type instead (infrastructure depends on domain), and its Store
satisfies workflow.Store.
Updates every production and test caller of the relocated symbols across
daemon, webui, gateway, agentworker, agenttransport/nats, storerpc,
taskrun, and worktreerpc, and removes TestRecordDispatchViaExplicitTx per
docs/prds/state-store-contract.md (rev. 2c) sections 4 and 12 step 2.
Two workflow-package integration tests that exercise the real *store.Store
move to an external workflow_test package (store_integration_test.go) to
avoid a workflow(test)->store->workflow(prod) import cycle now that store
depends on workflow.
* no-mistakes(document): docs(state-store): mark §4.8 relocation done in state-store-contract
Stands up archie-gateway as its own binary serving ChatContract over gRPC
and makes it the daemon's only transport for webui chat (Q3 part 5's
atomic flip -- the in-process serving path is deleted, not deprecated).
- contract seams + protobuf toolchain (Phase 0)
- single taskactions.Service across webui, daemon NATS responder and the
standalone gateway's client
- services.gateway.target is the only config surface left; mode is gone
now that remote is the only transport
- task dev launches archie-gateway alongside archied + Vite
Verified end-to-end against live infra: real GitHub token (zero repos
configured, so no repo was polled or touched) and the real
@heyarchie_home_bot Telegram bot, both processes booted together against
shared NATS/store, chat and /status round-tripped successfully.
# Conflicts:
# go.sum
archie-gateway is now the sole owner of ChatContract; the daemon always
dials it over gRPC for webui chat, no in-process fallback left. Telegram
and email keep their own in-process routers unchanged (their streaming
responder is a callback that can't cross the wire-safe contract).
- composeChatContract only accepts mode="remote"; config defaults
Services.Gateway to remote + 127.0.0.1:8585 when unset
- deleted taskActionsActor (dead code once the local branch is gone)
- task dev now launches archie-gateway alongside archied + Vite
Verified end-to-end: archie-gateway + archied booted against a shared
NATS/store, webui's /api/chat/sessions round-tripped through the gRPC hop.
The chat agent had no way to know where it lives without probing the
filesystem (pwd, find, git remote), wasting turns on every orientation.
Per docs/architecture/identity.md the <env> block is Layer 1 invariants,
so the daemon's own facts belong there, driven from live configuration.
Render into the prompt's <env> block:
- workspace path (chat.workspace)
- repositories under management with forge host and default branch
- operator identity (chat.operator, which was dead plumbing)
Unconfigured values render explicitly as unknown / none configured
rather than a plausible-looking default, and a repo with no forge
reports forge unknown, so the model never claims a fact the daemon
cannot confirm. Repos are resolved per active chat identity, mirroring
chatTaskProfiles.
gateway: add RepoEnv, SystemPromptConfig Workspace/Repos/Operator,
TurnRunnerConfig Workspace/Repos.
app: chatRepoEnv resolver wired through newChatTurnRunner.
tests: prompt rendering (incl. explicit-unknown + hostile-SOUL guard)
and chatRepoEnv identity resolution. go.sum gains module-graph
/go.mod checksum lines.
Sixth slice of docs/prds/eda-playbook-engine.md (t2db.14): the
internal/domain/eda/expr package implementing the resolved open question 1
(CEL decision), standalone -- no coordinator/dispatch yet, mirroring how
t2db.13 built ModuleRegistry before any consumer.
- NewEnv: CEL env declaring the two context roots (event + actions, both
map(string, dyn)) with DefaultCostLimit (100,000, tunable per J5).
- Compile: parses/type-checks an expression string; syntax error, unknown
root (anything other than event/actions), or type error is a returned
error -- the reject-at-load entry point the playbook loader and lint
tool will share.
- Eval: evaluates a compiled program against a dispatch-time Context;
missing-field/wrong-type/cost-limit errors are returned, never panics.
No recover() wrapper: CEL is panic-free by design, verified by the
hostile-data tests (5000-deep map, no panic). CEL's ref.Val wrappers
(types.Bool etc.) are unwrapped to native Go values.
Dependency: cel.dev/cel-go v0.32.0 (direct), the only new dependency,
already vetted in the resolved doc's vetting record -- no re-vet.
Tests (table-driven, verified against real CEL semantics, not guessed):
valid boolean against event fields; syntax error at compile; unknown root
rejected at compile naming the root; missing event field errors not
panics (== on a missing key evaluates false -- verified CEL semantics);
has() presence macro; actions context reads; deep-nested hostile data
error-free or false without panic; cost-limit enforcement proven by
aborting a macro expression under a tiny limit (CEL's cost model accrues
on map/filter iteration, not field reads -- verified by probing).
task check clean (113/113 UI, exit 0).
go-telegram/bot v1.24.0 fixes getUpdates to honour Telegram's retry_after
on a 429 instead of its own 100ms-doubling-to-5s backoff (release notes:
https://github.com/go-telegram/bot/releases/tag/v1.24.0). pipelineErrorHandler
was our workaround for that upstream gap -- it now just logs.
Task runs now preserve real model context limits, provider usage, baseline-repair spend, commit identity, durable agent-finish telemetry, and useful timeline details without imposing a token cap. Dashboard forge links are canonical per owning GitHub or Gitea identity. Chat turn claims acquire SQLite writer intent before reading, eliminating the concurrent SQLITE_BUSY snapshot race.
ai-sdk v0.1.21 wraps the cancellation cause in aborted-stream errors
("%w: %w") instead of formatting it, so errors.Is(err, context.Canceled)
is reliable again. The Telegram channel was compensating with a comment
explaining why errors.Is could not be trusted.
The code was already correct; only the comment was obsolete. It now
states the real reason for context.WithoutCancel(turnCtx): turnCtx is
dead on both stop and fault paths, so the cursor-drop edit needs a live
context. The runtime effect of the bump is that a /stop landing inside
the step loop is now logged as "chat turn stopped" rather than
"route failed".
Refs ai-sdk-0pn
Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format.
Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology.
Composition root work tying the config resolver, channel manager, log
feed, and executable workflow registry into the running daemon and
dashboard server: web.Channels/LogFeed/Workflows/ConfigProvenance,
channel-reload wiring, TaskStopper for the Stop action, and
SpawnRequest.Body/WorkRequests threading dashboard "Start work" requests
through the same admission path chat uses. Touches all three features at
once because this is where they're composed, not owned by any single one.
Refs #53, #54, #55
archie-core-via. internal/infrastructure/configuration/setup defines
Prompter -- Select, ReadLine, ReadSecret, Confirm, all context-aware --
which is all the setup step logic (to follow) needs from a prompt
surface. No terminal dependency, so steps are testable without a TTY.
internal/infrastructure/terminalprompt.Terminal is the real
implementation, using golang.org/x/term. New refuses construction when
its input isn't a real terminal, with a message naming the problem --
enforcing "a non-TTY invocation fails with a clear message rather than
writing a partial config" at the earliest possible point, rather than
falling back to a plain read that would silently accept piped/scripted
input (ssh, `archied setup < answers.txt`, CI). Terminal satisfies
Prompter structurally; this package does not import that one, so
there's no infrastructure -> infrastructure edge for what Go's type
system already gives for free.
Each blocking read runs in a goroutine raced against ctx.Done(), so
Ctrl+C returns promptly instead of leaving the operator stuck; the
losing goroutine is abandoned on cancellation; term.ReadPassword's own
raw-mode restoration is not interruptible, so an abandoned secret read
can leave the terminal in raw mode until it unblocks on its own --
documented on Terminal.readSecret rather than worked around, since a
cancelled setup command is expected to exit shortly after via its own
signal handling anyway.
Tested by constructing a Terminal directly (bypassing New, same
package) over a plain pipe with an injected readSecret seam -- New's
TTY gate itself is exercised separately against a real os.Pipe(). No
weakening of the production constructor for testability.
Refs archie-core-via
internal/worktree no longer executes the git binary. Clone, fetch,
checkout, commit, push and diff all run in-process through go-git v6,
which also removes the package's 9 noctx findings since the Context
variants are first-class.
Security: the forge token no longer leaves the process. The old
implementation wrote a GIT_ASKPASS shell script to disk and exported the
token into the environment of every git child process. Authentication is
now an in-process credential passed via client.WithHTTPAuth. cloneURL
also stops embedding the bot user in the GitHub URL.
Dropped the per-repo object cache (PreparePersistent, prepareCache,
CleanupExpiredCaches). go-git can clone with shared alternates but has no
equivalent of --dissociate, so a cached bare repo would remain a live
dependency of every worktree built from it, and expiring one would
corrupt running tasks rather than fail cleanly. Every task now gets an
independent full clone. repo.PersistentStorage still governs the
container volume; only the git object cache is gone.
Two real defects surfaced while porting, both caught by the new tests:
- go-git honours the host's global git config and cannot sign commits
(no gpg fallback, only an ObjectSigner plugin). On any machine with
commit.gpgSign=true set globally, every bot commit would have failed
with "cannot auto-sign commit". setIdentity now pins gpgsign=false in
the clone's own config so daemon behaviour does not depend on the
ambient config of whatever host it runs on.
- go-git's Add(All) does NOT honour .git/info/exclude, which is how the
.archie-prepared sentinel was kept untracked. It was being committed
and would have been pushed onto every task branch. The sentinel now
lives at .git/archie-prepared, where nothing can ever track it, and a
regression test asserts it never appears in a commit.
Diff is now merge-base relative via Commit.MergeBase, matching the three
dot semantics of `git diff origin/base...HEAD`; diffing against the remote
tip would attribute commits landed on base since the branch started to
this task and could trip the diff-size cap. Base resolution tries the
remote-tracking ref first and falls back to the short "origin/<base>"
revision, keeping git's more permissive lookup.
The test suite was rebuilt on go-git fixtures and no longer needs a git
binary installed to run.
golangci-lint run --fix plus the formatters: errorlint, gocritic,
sloglint, usestdlibvars, usetesting, gci, gofumpt, goimports.
160 issues -> 130.
One autofix was wrong and had to be reverted by hand. gocritic rewrote
ctx, cancel = context.WithTimeout(ctx, m.prefetchTimeout)
to `:=` inside an if-block in internal/memory/manager.go. That does not
compile, which is the good outcome — had it compiled, the shadowed ctx
would have scoped the timeout to the if-block and the prefetch deadline
would silently never have applied. Restored the assignment and commented
why it must not be a declaration.
Worth recording: --fix is not a safe no-op. It broke the build on a
24-file change, and the failure mode it was one compiler error away from
was a silent behaviour change.
First slice of the tau cherry-pick strategy: copy-and-mutate rather than
extracting tau to pkg/. Exporting would force designing metrics, session
and logger seams upfront, before archie-core knows which of them it wants
differently — a cost paid for reuse not yet proven. ai-sdk earned library
status by stabilising across two consumers; nothing in tau/internal has.
indexing is the cheapest high-value lift: 512 LoC, one file, and its only
coupling to tau was three calls to process-global config path helpers.
Nothing else in tau imports it.
Mutations from upstream:
- path helpers become an explicit indexing.Config. Two archied instances
share a host (archie and winter), so they must not share one index.
- the child-process helper is archied's own workspace-codesearch
subcommand, dispatched before flag parsing so it touches no config,
store or NATS.
- deferred db.Close calls explicitly discarded; archie-core runs errcheck.
The child process is not incidental: google/codesearch calls fatal exits on
a corrupt index and leaks mmapped regions. Verified end to end against this
repo — 2.2MB indexed, correct hits for BuildSystemPrompt, [] for no match,
and a deliberately corrupted index returns "corrupt index" with exit 1
instead of taking the process down.
Every lifted file carries a provenance header naming its tau path and
commit (4893818d0c76), so refreshing from upstream is a diff rather than
archaeology.
Streamed chat replies hung on the first token: the draft rendered an
empty cursor, the typing indicator never cleared, and the turn never
completed.
RouteStream consumed stream.TextStream, but ai-sdk's channel contract
makes FullStream authoritative and requires draining it until close --
its writes are synchronous, so an unread FullStream applies backpressure
and stalls the producer. Once its buffer filled, the producer blocked,
TextStream stopped yielding, and the range loop blocked forever.
TextStream was the wrong source regardless: it is explicitly best-effort
and drops deltas when not drained, so a reply reconstructed from it can
silently lose text. Range over FullStream and collect StreamPartTextDelta
parts, exactly as the SDK documents.
Also bumps ai-sdk v0.1.17 -> v0.1.18 (build, full suite and lint clean).
Upgrades go-telegram/bot v1.18.0 -> v1.22.0 and uses the Bot API's rich
message support instead of hand-rolled formatting.
The previous commit converted LLM Markdown into Telegram's HTML subset,
on the premise that the API could not take Markdown directly and had no
table element. Both are true of v1.18.0 but not of v1.22.0, which adds
sendRichMessage/sendRichMessageDraft taking InputRichMessage{Markdown},
plus RichBlockTableCell for native tables. markdownToHTML and its tests
are deleted: LLM Markdown, tables included, now goes to Telegram as-is.
Replies also stream. runtime.ChatStream already returned a TextStream
and sendRichMessageDraft renders partial output, so the only missing
piece was a gateway seam: gateway.LLMStreamResponder plus Router.
RouteStream, which degrades to the blocking Route when unset so any
adapter can call it unconditionally. Local commands answer from local
state and are not streamed; an unrecognised /command is, since Route
hands it to the LLM. main.go derives both responders from one shared
turn implementation.
Draft updates are throttled to one per 700ms to respect per-chat rate
limits, and every streaming/rich path falls back rather than dropping a
reply: a rejected rich send retries unformatted, and a failed draft
update is skipped since the final message is authoritative.
go.mod pointed NellDB at a local dev-machine path
(/work/apps/nell-engine) instead of the published v0.2.5 module,
which the Gitea CI runner can't resolve — every push since the
replace was added has failed the deploy workflow's docker build
(go mod download: no such file or directory), silently leaving
carina on a two-day-old image. Confirmed nell-engine's local HEAD
is functionally identical to the already-tagged-and-pushed v0.2.5
(only a trivial .gitignore commit ahead), so dropping the replace
and re-resolving from the registry is a no-op for behavior.
Implements the Forge interface for Gitea instances (tested against
git.catlow.cloud, Gitea v1.26.4). The forge.New factory now dispatches
on forge type, and config validation accepts 'gitea'.
Changes:
- internal/forge/gitea.go — GiteaClient implementing all 11 Forge
methods: issue polling (assigned + label), comments, PR creation,
PR state reconciliation, issue closure, reactions, state labels,
push verification. Handles edge cases: not-found PRs return
'closed', GetUserByName errors from the Gitea SDK are mapped to
user-friendly messages.
- internal/forge/forge.go — New() factory dispatching on forge type
(github/gitea). GitHub constructor renamed to NewGitHub.
- internal/forge/github_test.go — updated to use New() signature
- internal/config/config.go — forge.type accepts 'gitea', BotEmail
defaults change per forge type (gitea uses @gitea.local)
- cmd/archied/main.go — passes cfg.Forge.Type to forge.New()
Dependencies: added code.gitea.io/sdk/gitea v0.25.1
End-to-end verified against live Gitea instance: daemon starts clean,
registry built (5 workflows), web UI listening, no errors or warnings.
Adds internal/skill package with YAML frontmatter parsing and skill
discovery from .agents/skills/ (agentskills.io spec convention).
- Frontmatter struct with name, description, version, metadata.archie
- Parse() extracts YAML frontmatter delimited by --- markers
- Discover() scans .agents/skills/*/SKILL.md (follows wfeval pattern)
- LoadBody() for single-skill lazy loading
Skills moved from .archie/skills/ to .agents/skills/ per the
agentskills.io specification.
Wiring: TaskContext.SkillBody field, lazy-loaded on first agent stage
from worktree. When non-empty, prepended to Mission as "Follow these
project-specific guidelines" context. Hardcoded Mission templates stay
(task-specific formatting). Backward compatible: empty when no skill
found.
Implements the full PRD (docs/prds/yaegi-plugin-system.md): repos can
now define .archie/gate.go for diff-inspecting quality rules shell
commands can't express, .archie/stages/*.go for custom pipeline steps,
and skills can ship Go scripts run via a new run_go_script agent tool —
all interpreted in-process with Yaegi, with panics recovered so a bad
script can't take down the daemon. Hot reload (phase 4) needed no code:
every loader reads from disk per call and every task gets a fresh
clone, so nothing is ever cached to go stale.
AgentStage is the reusable bridge from workflow stages to agentloop
runs: role->model selection from config, budgets, repo gate conversion,
task-row NotesStore (survives worktree cleanup, never pollutes the PR),
and park-on-anything-but-passed. Every future LLM stage (tdd,
feasibility) is an AgentStage with a different mission/gate/handler.
The implement workflow: prepare -> baseline gate (park on red base,
prevents park-storms) -> plan (read-only agentloop, plan posted to the
issue as a veto window) -> build (full toolset behind the repo's
configured gate) -> commit/push -> diff cap -> PR with the builder's
finish summary as the body.
Proven live on samcharles93/todo#3: planner 3 steps, builder 4 steps
(~31k tokens total), producing gate-verified table-driven TodoStore
tests as PR #4.