Commit Graph
263 Commits
Author SHA1 Message Date
sam e3ec4f01d6 chore: bump beads version to 1.3.2 2026-10-25 18:11:33 +11:00
sam 885837caf5 chore: reindent beads config and add agent profile
Quality / check (push) Failing after 3m14s
2026-10-12 01:01:19 +11:00
sam 2e00777f07 refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat 2026-09-25 01:10:28 +10:00
sam c13959ac37 chore(beads): stop tracking issues.jsonl/interactions.jsonl in git
Dolt is the source of truth and already syncs via its own git+ remote
(bd dolt push/pull). Committing the JSONL export separately produced a
steady stream of no-op "chore(beads)" commits that skewed commit counts
without adding information. Untrack the export files, disable
export.auto/git-add, and drop the beads-commit step from CLAUDE.md's
Session Completion Protocol.
2026-09-05 20:37:45 +10:00
sam 2f9a101d30 chore: beads interactions and issues 2026-09-05 17:11:43 +10:00
Samuel Catlow afba5800b2 feat(gateway): wire progressive tool disclosure (bridge tools)
Compose the base registry with per-turn extras into a turn-local registry and
let ContextPressureGate decide full-vs-bridge disclosure per chat turn. The
three bridge tools (tool_search, tool_describe, tool_call) are now wired into
the chat toolset and only disclosed under context pressure, keeping the LLM's
schema footprint small while preserving full arsenal access on demand.

Per-turn extras are identity-bound per channel and cannot live in the
process-wide registry (agentexec.BuildToolSetFrom invariant), so the bridge is
composed turn-locally rather than registered globally. Thread the model's
context window through TurnModel.Prepare (TurnPrepareContext) so the gate
activates with a real window.

Refs #167
2026-09-05 16:02:53 +10:00
sam 4582248fef chore: beads interactions and issues 2026-09-05 03:13:06 +10:00
sam a4a8ae7e92 feat(eda): thread Playbook ID/Version and DispatchInput task identity (gap-2 prereqs)
Playbook now carries ID (path-relative to the configured root) and Version
(sha256 content hash recomputed on load), both populated in loadOne, mirroring
Binding.Version's provenance pin without a DB row. DispatchInput gains TaskID
carrying TaskEnvelope.IdempotencyKey(), the identity available at the
discovery point (pollNATS / webhook receiver compute kind+labels from a
TaskEnvelope before any store.Task row exists), NOT a store.Task.ID int64.

These are the two implementation prerequisites named by the t2db.17
idempotency resolution; the playbook_dispatches ledger is built on top.

Note: task check fails on 5 lint findings PRE-EXISTING at HEAD in unrelated
files (bootstrap.go cyclop/nestif, install_script_test.go noctx,
telegram_setup_test.go usetesting), reproduced in a clean worktree and not
caused by this change; the eda/playbook package is gofumpt/vet/lint clean.
2026-09-05 03:10:58 +10:00
sam 5942fd913e chore(beads): file archie-core-wdn0 (GitHub reconciliation follow-up) 2026-09-03 22:31:01 +10:00
sam 452283aab8 chore(beads): recover 5 carina-only beads during cross-machine sync
Reconciled the helix/carina beads divergence via the Dolt remote. Carina held
28 beads absent from helix, but 23 were the same GitHub issues re-pulled under
freshly-minted IDs -- importing by ID would have duplicated them. Imported the
5 genuinely unique beads (462t, fwvf, n5fz, tzzn, w1d5) with comments intact,
and closed fwvf/n5fz/w1d5 to match GitHub #703/#709/#710, whose fixes had
already merged.
2026-09-03 20:18:47 +10:00
sam 238aba8d81 chore(beads): wp9s phase-1 notes, file archie-core-mxls (/agents dead wiring) 2026-09-03 07:18:03 +10:00
sam 11c8121d81 chore(beads): close [[repos]] multi-forge bug as superseded by [[identities]] 2026-09-03 06:58:48 +10:00
sam ddb183642a chore(beads): close archie-core-1786637500926-421-7c63bcd3 2026-09-03 06:57:31 +10:00
sam a6cfbdb3ca fix(webui): stretch HEALTH row cards to equal height
Gate pulse and Finish setting up sat in the same CSS grid row, but a
block-level .card doesn't fill its grid-stretched wrapper's height on
its own -- it shrinks to its own content. With Gate pulse's empty
state being much shorter than the setup checklist, its card ended up
noticeably shorter than its sibling, leaving dead space below it that
read as the content floating uncentered relative to the row.

Flexing the wrapper and growing .card to fill it (scoped to
.dash-top, not the shared .card rule used elsewhere) makes both
HEALTH cards match height while each card's own content keeps
flowing from the top. Verified via a static repro using the real
project CSS: card heights and bottom edges now match (290.5px/y=343
for both, versus 227px/279.5 vs 274.5px/327 before).

Closes archie-core-1786637500926-421-7c63bcd3.
2026-09-03 06:57:22 +10:00
sam 75e050b674 chore(beads): close stale golangci-lint epic and Phase 5 (gate verified green) 2026-09-03 06:50:13 +10:00
sam e090e2c0ec chore(beads): close archie-core-7d5u.6 2026-09-03 06:48:32 +10:00
sam b5ca1b889b docs: reconcile plugins-and-extensions.md and ARCHITECTURE.md with shipped webhook intake
ARCHITECTURE.md described forge intake as polling-only and listed Gitea
as still "planned" despite internal/forge/gitea.go fully implementing
it -- both stale since 7d5u.4/.2/.3 shipped forge webhook intake.
Corrected the opening description, package map, Provenance-by-origin
paragraph, [forge] config bullet, and Implemented/Planned lists; added
a "Webhook intake" subsection documenting internal/forge/webhook as a
separate HTTP receiver reusing the poller's TaskEnvelope/PublishTask
path.

CLAUDE.md gains the internal/forge/webhook/ trap: HMAC verification
must precede payload parsing, and the webhook-built TaskEnvelope must
keep its poll-compatible owner/repo/number idempotency key or
poll/webhook double-dispatch returns.

plugins-and-extensions.md gains a section cross-referencing 7d5u.1's
decision (in-process typed families, no amendment needed) and naming
the Module action position as the shipped instance -- Channel/Forge
positions are correctly left as open investigation (t2db.19), not
claimed as shipped.

Closes archie-core-7d5u.6.
2026-09-03 06:48:02 +10:00
sam d5edd5c1bd chore(beads): close archie-core-t2db.16 2026-09-03 06:42:40 +10:00
sam 5aaa6fd432 refactor(eda): extract helpers to satisfy cyclop/gocognit gates
loadWorkflows (bootstrap.go) split into loadWorkflowRouting,
loadModules, loadEDAPlaybooks -- cyclop 17>15.

LoadPlaybookDirs (routing.go) split into sortedPlaybookFilenames,
loadPlaybookFile, bindPlaybookKey -- gocognit 52>30.

Pure extraction: identical log messages, error strings, and
control flow. golangci-lint run ./... now reports 0 issues.

Closes archie-core-t2db.16.
2026-09-03 06:42:27 +10:00
sam 3eac0c98a8 chore(beads): full vetting record for jsonrpc2 dependency (t2db.20) 2026-09-03 06:33:00 +10:00
sam 353b4fd7e7 chore(beads): narrow LSP dependency candidates for t2db.20 2026-09-03 06:31:20 +10:00
sam 9815a0f831 chore(beads): note proposed gap resolutions on t2db.17/.18 2026-09-03 06:29:54 +10:00
sam f6a341ddb7 chore(beads): close archie-core-mlro 2026-09-03 06:25:31 +10:00
sam 06b1fe4cb3 chore(beads): close archie-core-t2db.6 2026-09-03 06:20:16 +10:00
sam 417a3dcc3a docs(guides): operator walkthrough for building a first playbook binding
Completes the last open item in archie-core-t2db.6, now unblocked by
t2db.8's UI landing. Every claim verified against the real handler
code, not assumed: the capture endpoint (POST /webhooks/capture/
{source}, mounted on the bypass mux per api_capture.go's own comment
-- capture must accept unauthenticated senders), the HMAC scheme
(webhookguard.VerifyHMAC: HMAC-SHA256 over the raw body, hex-encoded,
X-Hub-Signature-256 header) confirmed against its actual implementation
and cross-checked the documented openssl command against it directly,
and the default listen port from config.example.toml.

Six steps end to end: send a test event, inspect it in the Event
inspector, map fields by clicking the payload tree, create the binding
(covering the new owner/repo pin), approve it, then fire a signed
request and see the resulting task. Cross-references
docs/architecture/bindings.md and ARCHITECTURE.md's provenance
addendum rather than re-deriving their content.
2026-09-03 06:20:14 +10:00
sam 8ddda37997 chore(beads): record binding UI + Preact render fix work 2026-09-03 06:17:44 +10:00
sam 44ff855a54 chore(beads): block t2db.6's walkthrough on t2db.8 (UI doesn't exist yet) 2026-09-03 04:41:44 +10:00
sam a871f0fc6c chore(beads): record t2db.6 progress (3 of 4 items done) 2026-09-03 04:40:43 +10:00
sam 133cac8370 chore(beads): record t2db.8 backend Owner/Repo resolution 2026-09-03 04:39:00 +10:00
sam 4a62df09f2 chore(beads): confirm yaml.Node line-tracking is feasible for t2db.20 2026-09-03 04:29:18 +10:00
sam 2c7eab2b2d chore(beads): add workflow.Run park() precedent to t2db.18 (mid-run failure) 2026-09-03 04:25:59 +10:00
sam 020ddcb1c4 chore(beads): add binding_dispatches ledger precedent to t2db.17 (idempotency) 2026-09-03 04:21:17 +10:00
sam bf8faaccb8 chore(beads): close archie-core-uhtz 2026-09-03 04:17:14 +10:00
sam f08b9b2bc4 chore(beads): record t2db.19 Forge/Channel scoping update 2026-09-03 04:15:50 +10:00
sam d368b729fb chore(beads): file t2db.16-20 from crew investigation (execution-time gaps, Channel/Forge scoping, LSP, docs corrections) 2026-09-03 04:13:04 +10:00
sam c9a08bde98 chore(beads): record t2db.16 and uhtz lint-debt tickets 2026-09-03 04:11:33 +10:00
sam fc118f1bd7 chore(beads): close archie-core-t2db.15 coordinator slice 2026-09-03 04:06:12 +10:00
sam e7afe2da8b feat(eda): playbook document + event coordinator, single-action workflow-kind dispatch
Seventh slice of docs/prds/eda-playbook-engine.md (t2db.15), consuming
t2db.14's expr package: the rich trigger+actions playbook document and
the coordinator that dispatches it.

- internal/domain/eda/playbook: Load(dir) reads *.yaml/*.yml playbook
  documents (trigger + exactly one workflow-kind action + optional CEL
  when), validating the HARD BOUNDARY at load: a playbook with 2+ actions
  or a non-workflow action position is a reported load failure --
  multi-action and Module/Channel/Forge actions stay blocked on the
  unresolved execution-time gaps. Any malformed YAML, invalid trigger,
  missing workflow name, or when compile failure fails the WHOLE load
  (reject-at-load, same shape as routing collisions); a missing dir is an
  empty store. Trigger reuses the existing workintake kind/label
  vocabulary (no second label-matching mechanism). Dispatch matches
  trigger, evaluates when (CEL, event context with actions: {} -- no
  prior actions in single-action playbooks), and returns the named
  workflow from the registry via the same lookup Route() uses -- no
  duplicated dispatch logic. when eval error follows the resolved doc's
  J3: false, skip, caller logs.
- Store.Dispatch(reg, DispatchInput) is the coordinator entrypoint; input
  carries Labels/Kind/Event. Production task intake wiring
  (daemon.go/pollNATS/publishTask) is explicitly NOT in this ticket -- a
  follow-up; proven end to end via direct tests plus the shipped example
  (examples/eda-playbooks/bug-tdd.yaml) loaded and dispatched through the
  real path.
- Config: EDAPlaybookDir (eda_playbook_dir), documented as DISTINCT from
  PlaybookDirs (flat binding files) -- a reader cannot confuse the two.
- Bootstrap: playbook.Load wired in loadWorkflows, log-and-abort on
  failure matching every prior slice; nonexistent dir is an empty store.
- workflow.Route(), workflowForLabels, and the t2db.9-.12 binding loaders
  are UNTOUCHED (verified: their full test suites pass, zero regressions).

Also carries small lint cleanups on t2db.13/.14 code flagged by the gate
run: expr Eval no longer type-asserts to ref.Val (Eval returns ref.Val
directly in v0.32.0; cel-go's own Eval wraps evaluation in recover --
verified in source); module decodeLogArgs extracted to clear the nestif
finding. golangci-lint: 0 issues.

Tests (10): single-action round trip, when-false skip, 2-action load
failure, non-workflow position load failure, when compile failure drops
playbook, empty trigger load failure, trigger mismatch skip, no-when
match, one-invalid-file fails whole load, missing dir empty store, plus
the shipped example load+dispatch. task check clean (113/113 UI, exit 0).
2026-09-03 04:05:59 +10:00
sam 7e34fcb598 feat(eda): CEL expression environment (compile/validate at load, evaluate at dispatch)
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).
2026-09-03 04:01:21 +10:00
sam eea0544ee6 chore(beads): close archie-core-t2db.13 module-position slice 2026-09-03 03:35:32 +10:00
sam de468ebec9 chore(beads): close archie-core-e7bo extract-drift fix 2026-09-03 03:30:38 +10:00
sam 43c6f257ed fix(extract): regenerate stale Yaegi symbol tables; fix wfextract directive
Two pre-existing issues discovered while scoping the Module-position slice
(archie-core-e7bo), unrelated to the playbook engine work:

1. wfextract's //go:generate directive still targeted
   internal/workflow, a path gone since the domain migration -- the
   committed generated file was hand-patched for imports only, never
   regenerated. 'go generate ./...' failed repo-wide, silently.

2. Regeneration surfaced real drift on three surfaces:
   - wfextract: the committed table predated the migration and was
     missing everything added since -- routing YAML loaders (t2db.9/.10/
     .11), the review types, and the Forger/Reviewer/Trees interfaces
     that TaskContext exposes to every interpreted stage plugin. A stage
     plugin referencing tc.Trees or the review types could not resolve
     them.
   - pluginextract: internal/plugin/host.go (f73b2d1) added the
     Host/Module/Manifest/Permission/Health/CapabilityKind/LifecycleState
     /ModuleStatus types and NewHost/AdaptLegacy/HostAPIVersion, none of
     which were ever extracted. A daemon plugin written against the
     capability-host API (bootstrap.go:707 LoadDir) silently had no way
     to reference them.
   - secretextract: symbol exports were current; only the hand-applied
     nil-guards and comments differ from raw generator output.

Fix: update the wfextract directive to internal/domain/workflow and
regenerate all four extract surfaces via 'go generate ./...'. Re-apply
the documented hand-written nil-guards on interface wrappers (Yaegi
wrappers omit them natively), restating the IMPORTANT note in wfextract's
package doc (it now has interface wrappers for the first time). Delete
the stale hand-patched wfextract generated file in favour of the
correctly-named regeneration.

Regression coverage (the previously-missing types are now reachable from
interpreted code, proven by tests that fail against the old tables):
- wfextract/reachability_test.go: interprets a stage plugin referencing
  Trees/Reviewer/LoadPlaybookDirs and calls it; plus a Go-side nil-guard
  test on the three wrappers.
- pluginextract/reachability_test.go: interprets a daemon plugin building
  a Host from a Go-side Module and calls it end to end; plus nil-guard
  tests on the _Module/_Plugin wrappers.
- secretextract keeps its existing wrapper nil-guard tests.

Verified red-then-green: after a fresh 'go generate ./...' wipes the
guards, the guard tests fail with nil-pointer panics; after re-applying,
they pass. task check clean (113/113 UI, exit 0).
2026-09-03 03:30:23 +10:00
sam 26f47716b5 chore(beads): record archie-core-t2db.12 close interaction 2026-09-03 03:10:21 +10:00
sam 9038eb5c75 docs(prds): add Module position design doc
Resolves eda-playbook-engine.md's deferred schema-generation question
for the Module action position. Generalizes the fixed-signature,
resolved-by-name Yaegi pattern already shipped three times (custom
gate, workflow stage plugins, skill plugins) instead of inventing a
new mechanism: one small hand-written schema package per action kind,
go:generate yaegi extract (the same command wfextract/gateextract
already use) producing its symbol table, a ModuleRegistry keyed by
kind rather than a generic any-typed Module interface -- keeping every
position individually compliant with the plugin engine rule instead
of reopening the generic-hook question event-sources-and-reactions.md
already closed.

Closes open question 3 (trust boundary: operator-installed, in-process,
same tier as PluginDir/SecretEngineDir -- not repository-supplied task
code). Recommends a side-effect-free first Module kind, since any kind
with a real external effect is still blocked on the parent doc's
unresolved execution-time gaps (idempotency, mid-run failure).
2026-09-03 03:10:09 +10:00
sam 71da312f0a chore(beads): close t2db.11, record t2db.12 lint-tool slice 2026-09-03 03:01:30 +10:00
sam cf6c5f42d5 feat(workflow): load kind/label bindings from multiple playbook directories
Third slice of docs/prds/eda-playbook-engine.md (t2db.11), completing open
question 2: instead of a single playbook dir, the config gains a LIST of
directories (playbook_dirs) of *.yaml/*.yml binding files, loaded at
startup as an additional input to workflow_routing_file and
workflow_labels_file, which remain supported unchanged.

- LoadPlaybookDirs(dirs []string) reads every yaml file across the
  configured directories and merges kind + arbitrary-label bindings.
- This is what finally exercises the design doc's drop-and-report
  collision rule: a single file cannot collide with itself, so the
  cross-source path (two files in one dir, two dirs, or a dir plus a
  single-file field) had never run in production. A binding key declared
  by more than one source is a reported load failure, not a silent
  pick-one by source order or version.
- Router-level collision handling: MergeKindWorkflows/MergeLabelWorkflows
  fail on a key bound by both the single-file fields and the playbook
  dirs, applied at boot.
- Config: PlaybookDirs []string, empty by default (no behavior change for
  existing configs). Repo-scoping (typing dirs to Config.Repos owner/name)
  is explicitly deferred to a separate later decision per ticket;
  org/tenant keying is out of scope.
- PRD: records the list shape per Sam's correction (single dir would
  contradict multiple independently-maintained playbook sources).
2026-09-03 02:57:38 +10:00
sam da3fe2dbd5 chore(beads): record archie-core-t2db.11 slice 2026-09-03 02:51:07 +10:00
sam 1a20a42a98 chore(beads): record archie-core-t2db.10 close interaction 2026-09-03 02:49:06 +10:00
sam 245f2ad0c0 chore(beads): record archie-core-t2db.9 close interaction 2026-09-03 02:38:07 +10:00
sam 08d9f7a1ed chore(beads): close archie-core-t2db.9 2026-09-03 02:35:48 +10:00