Commit Graph
8 Commits
Author SHA1 Message Date
shad 8d0b2b2aad Revert "perf: tighten recall relevance threshold"
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled
This reverts commit dd420bba44.
2026-06-24 18:36:15 +02:00
shad dd420bba44 perf: tighten recall relevance threshold
claude-automerge scrubbed in 1 iter(s): already clean
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled
Require >1 stem match so single-word noise queries don't surface
weakly-related memories.
2026-06-24 18:33:49 +02:00
canvas-bot 14a98056ed fix(memory): use edge role=child (valid EA2 vocab)
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled
Probed backend's defines edge role vocabulary. Accepted: child,
dispatch. Rejected: memory, observation, note, recall, vault, step,
view. Switching from invalid 'memory' to valid 'child' so the edge
attach actually lands without 500.
2026-06-16 21:21:52 +04:00
canvas-bot 2b91368a23 fix(memory): use edge role=memory not presentation
build-and-publish / image (push) Has been cancelled
build-and-publish / test (push) Has been cancelled
EA2 enforces one-defines-presentation-per-node — only the first
memory could ever attach because every subsequent
create_edge(role=presentation) from the vault returned 500
[ERR 1650]. Use role=memory for ongoing memories. listAll filter
accepts both for back-compat with the single existing
presentation edge.
2026-06-16 21:19:11 +04:00
canvas-bot f3a3794e54 fix: eliminate all 4xx noise from scene walks
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled
- buildScenarios: drop the /api/runtime/transactions/{id} headline GET
  entirely. Synthesize the RuntimeTransaction shape from the work-item
  data. Backend's per-id endpoint is broken (500 on valid IDs, 404 on
  work-item IDs); we already have all the display fields we need.
- store.ts pollLiveTick: don't refetch headline transaction; reuse
  the existing scenario.raw.headlineRt synthesized at build time.
- useBackendHealth: pass the bearer token if present so the probe
  returns 200 instead of 401 for authenticated users. The probe still
  treats 401 as 'up' for unauthenticated landing page.
- agentMemory.remember: track ensureVault result. Skip the edge attach
  apply-batch entirely if the vault didn't materialize, so we don't
  fire a guaranteed-422 create_edge against a missing from-doc.
2026-06-16 21:16:31 +04:00
canvas-bot b0127c24eb fix: silence Mission 404 storm + Assistant 422 noise
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled
Three sources of red errors in scene walk:

1. Mission/Approvals: GET /api/runtime/transactions/{key} 404 storm.
   The runtime backend's single-transaction endpoint is broken
   (returns 500 'transaction_read_failed: All connection attempts
   failed' even on valid IDs from the list endpoint, and 404 for
   work-item IDs that don't exist in the runtime DB at all).

   Fix in buildScenarios.ts: keep the headlineTx fetch (still tries
   to enrich) but synthesize a RuntimeTransaction shape from
   work-item data via workItemToRt() when the API call returns null.
   Skip the 3x 'recent' GETs entirely — they were always 404ing.

   Fix in store.ts pollLiveTick: .catch(() => null) on the headline
   transaction call so polling never surfaces backend brokenness.

2. Assistant: POST /api/ea2/apply-batch 422/404 when remembering.
   Vault edge attach can race with vault creation OR target a doc
   that hasn't propagated. Wrap in try/catch with console.warn so
   the failure is visible in logs but doesn't fire as a red console
   error on every turn.
2026-06-16 21:13:35 +04:00
canvas-bot 83a6b334c3 perf(agent): cap recall + 2s deadline so LLM fallback always fires
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled
Trace showed every Assistant submit triggered 60+ sequential
GET /api/ea2/flow/{key} requests via agentMemory.recall before
llmClient.chat ran. With a slow EA2 demo, recall took longer
than the test wait so the LLM fetch never started, the agent
reply never rendered, and [llm] telemetry never logged.

Two fixes:

1. agentMemory.listAll(cap) - default 200, recall uses 30.
   Edges are returned newest-first by EA2 so the 30-cap keeps the
   most recent vault entries and drops the long-tail history that
   was pinning the network.

2. routeAgentInput wraps recall in a 2s AbortController. If recall
   doesn't finish in 2s, hints[] stays empty and llmFallback runs
   immediately. Recall is best-effort context, never a blocker.
2026-06-15 21:42:58 +04:00
shad 9884ddf4ac feat(agent): per-tenant Karpathy-style memory vault
User explicit ask: 'maybe with a miniature hindsight or a Karpathy
vault behind it as its memory system for each tenant.'

- src/lib/agentMemory.ts: EA2-backed vault per user. Vault root is
  flow.kind=value at flow/memory_vault_<email_slug>; each memory is a
  flow.kind=value doc linked via defines edge with role=presentation.
- agentMemory.remember/listAll/recall — recall is a simple keyword
  overlap score with recency tiebreak.
- agentTools: new 'remember' and 'recall' tools.
  matchers: 'remember that ...', 'note ...', 'save ...' /
            'recall ...', 'remind me ...', 'what do you know about ...'
- routeAgentInput: every user turn is best-effort persisted as an
  episodic memory (fire-and-forget). When no command matches, the
  router does a vault recall and surfaces related notes before
  showing the help message.

Vault key: deterministic per-user. Owner_email stored on the vault
root + on each memory's config.memory. No raw IDs visible to the user.
2026-06-14 14:52:01 +04:00