Repository navigation
Session Roadmap: project biography pipeline + R2 UI (canvas, sidebar, review flow) - #1
Merged
Merged
Conversation
…nce anchors, S1 index, S6 verifier - core/sources: dual-profile journal + TUI sqlite location, three-state loud errors - core/tui-reader: S2 human-message filtering, chapter windows (15-30 human msgs), bounded digest with uncovered marker - core/anchor: evidence[] schema (S4a hashOf), S6 one-hop quote/hash verifier - core/card: frontmatter round-trip, idempotent atomic writes, handEdited protection - core/index-card: S1 session index (always-resident layer) - core/summarizer: one-shot zcode -p in isolated cwd, [2s,4s] retry, heuristic degrade - build.ts CLI + prompts/task-node.md + bun test suite (11 green) + package.json entries Spec: SessionRoadMap docs/designs/session-roadmap.md (schema v1, S0-S6 adopted)
- card.ts split (card + card-parse, max-lines ratchet): fail-closed parsing
(v>1 rejected, hashOf required, CRLF normalized, comments stripped,
unknown keys preserved in extra, multi-line scalars rejected loudly)
- discriminated kinds (session-chapter | session-index), structured uncovered
ranges, quality/provenance orthogonal, tzOffsetMin from OS, supersededBy
- writeCard lifecycle: same-index stale slugs superseded (filename is derived
not identity), handEdited protection CRLF-safe, unparseable cards
quarantine to .legacy.md without aborting
- anchors: raw SQLite-column-byte hashing (no re-serialization), quote field
per evidence, card-level anchors defaults (~300 token/card saved)
- tui-reader: inter-chapter gap closed (lastMsgSeq = next first - 1), tails
below half bandwidth merge, tool activity lines in digest, raw data kept
- build: per-point seq from summarizer -> generated evidence, S6 verifyEvidence
is a build gate (anchorsVerifiedAt stamped only when green)
- prompt returns {text, seq} points; 15 tests green, oxlint clean
Review: SessionRoadMap roadmap-card-schema-v1-suggestions.md §3 (2026-10-25)
…), numeric same-index match - .cmd shims reject argv containing cmd.exe metacharacters (CJK prompt); resolve ~/AppData/Roaming/npm/node_modules/zcode-app-cli/bin/zcode.js and spawn node on it directly - sameIndexFile compares numerically so v1's 2-digit padding and v1.1's 3-digit padding recognize the same chapter - live pipeline regeneration of ch1 specimen: LLM card, 18 evidence anchors, S6 gate caught 3 rewritten quotes (verified=false, no stamp)
…uote surfaces - verifyEvidence: hashPayload (anchored row raw bytes) vs searchText (row + its part rows, where conversational text lives) — conflating them made every part-quoted anchor a hash mismatch - rewritten LLM quotes are dropped from the card and counted in frontmatter anchorsDropped; a shipped card carries only one-hop-verifiable anchors (verified=true means 100% of retained anchors pass) - Windows temp cleanup best-effort (EBUSY on exited child's cwd) - live ch1 specimen: 17 evidence anchors verified, 1 dropped
…chors, point-coverage stamp - source/origin.db unified to tui-sqlite|orca-journal across anchor chain (frontmatter and evidence no longer disagree) - accepted anchors must carry a quote; quote-less ones drop as quote-missing instead of passing vacuously - anchorsVerifiedAt stamps only when every 要点 claim keeps a surviving anchor — zero-evidence pass impossible; drop reasons in build log - hash algorithm pinned in spec: sha256 UTF-8 bytes, 16 lowercase hex, hashPayload (row bytes) vs searchText (row + parts) documented - live ch1: 10/17 anchors survived the stricter gate, all points covered
…ernalization, pit keyword layer
- prompt: standard-terminology restatement with first-use jargon annotation
(owner opted for pure prompt constraint over a glossary file)
- body text carries no inline quotes; LLM returns {text, seq, quote} —
quote lives only in the evidence block as the machine pointer (S6 verified)
- pitfalls structured {keywords[], symptom, fix, seq}: keywords carry BOTH
standard terms and session jargon; dual-written to project-level
.roadmap/pits/KEYWORDS.md (per-session sections, other sessions survive)
- summarizer timeout 180s -> 420s (terminology+3-field output needs >3min
on a 24k digest; three attempts all timed out at 180s)
- live ch1: title de-jargonized, 18 anchors verified / 1 dropped
… derived, fail-closed normalize Dual third-party review (Codex + independent subagent) verdict REVISE-DELTA applied: - structured pits now persist IN the card (pits: block, second durable store); KEYWORDS.md rebuilt by scanning all session cards on disk -> partial rebuilds cannot lose rows, reruns idempotent by construction (live file had 3 accumulated headers), sessions this run never touched stay covered - pit rows link back to the card (relative path), carry verified/unverified marks from surviving S6 anchors, cells escape pipes/newlines - normalizePits whitelists and coerces every field (malformed keywords/strings can no longer crash the run after the 7-minute LLM call) - timeout-class failures stop retrying (budget problem, not transient) - --out redirects the pits rebuild root; empty directory no longer logs a fake path; 17 tests green incl. idempotency + escape + null cases
…ache-friendly prompt ordering
- core/term-consistency.ts: established term pairs extracted from earlier
chapter cards (the cards ARE the glossary — zero maintenance); injected as
a digest header the next chapter must reuse verbatim; post-hoc lint reports
same-jargon-different-rendering conflicts across chapters (non-blocking)
- prompt rewritten cache-friendly: constant instructions first, the only
variable ({{DIGEST_FILE}} path) moved to the last line; pitfalls gain an
optional quote field (contract gap found in delta review); units mandated
- renderCard split to core/render.ts (max-lines ratchet); 17 tests green
…at extraction, chapter-scoped injection, stable-cwd caching
Dual independent review (Codex + subagent with CLI decompile evidence) verdict REVISE-DELTA applied:
- pit quote now survives the full chain: PitfallEntry/PitRecord types,
normalizePits passthrough, serialize/parse, build mapping -> pit anchors
can pass S6 and KEYWORDS verified marks become reachable (previously
structurally impossible — the same contract-gap class the prior delta
review caught, now with regression tests)
- term extraction trusts ONLY injection-header-format lines; free-prose
regex proven to absorb junk prefixes ("我们最终采用了冻结参数集") that the
reuse rule would canonize — garbage feedback loop broken; model-declared
terms:[] added to the JSON contract as the primary source
- establishedTerms filters to chapters STRICTLY BEFORE the one being
generated (regenerating ch5 no longer treats stale ch5/ch10 as canon),
cross-chapter dedupe, injection capped at 60 pairs
- cache fix (mechanism-level finding): -p system prompt embeds
"Working directory: <cwd>", so per-chapter mkdtemp broke the provider
prefix cache BEFORE our template; one fixed session dir + stable
digest-ch<N>.txt names keep the cross-chapter prefix constant
- term lint report persists to term-lint.txt; index-card filename filter
tightened to ^0+-index; 22 tests green, oxlint clean
…al + specialist review CRITICAL: - cross-session seq collision faked ✓ in KEYWORDS: verified set keyed session:seq, omitted set fails closed - refreshIndex absorbed .superseded cards / drifted filters across 3 scanners: shared isChapterCardFile predicate (003-index-migration slug passes, superseded/legacy/new excluded) - session temp dir (full session digest) leaked every run: finally-cleanup + db.close on readTuiSession throw - markdown block forgery could bypass S6 (LLM text forging '## 证据锚点'/'pits:' blocks): sanitizeLlmText mangles line-start block markers, collapses newlines; chain-tested - S6 verified against the pre-summarization memory snapshot (near-tautological): lookup now queries the live DB by evidence.ref (hash proves against current rows) INFORMATIONAL: model terms: block now serialized+parsed (structured terminology source connected), parse-boundary hardening (newline/null), --out lastIndexOf guard, shared escapeCell everywhere incl. link cells, dead WriteResult removed, timer clearTimeout, zcode-entry fallback warn, slugify exported + property tests, run budget estimate line, verifiedScope stamp annotation 32 tests green (+10), oxlint 0/0
…(4/wave) - owner decisions on full-run findings: timeout raised 420s->600s AND one timeout retry allowed (second timeout confirms budget, breaks) - chapters processed in waves of 4 (Promise.all): ~3x throughput; rolling terminology injection still works — each wave reads cards written by earlier waves from disk
…tore, bootstrap src/main/roadmap/ (11 files, ~1800 lines): - journal-reader.ts: three-tier chapter segmentation (T0 hard: compact/epoch immediate; T1 candidate: git commit via input parsing, threadGoal, orcaStop, slash; T2 size: 50 turns OR 0.8x digest budget + 20-turn backtrack) with per-session open-chapter state; flush channel (idle/ exit/close) orthogonal to cut-point signals - journal-row-parse.ts: row parsing helpers (compact detection via presentation:context-cleared only; git commit via input.command parsing with exitCode + output-head corroboration; threadGoal/orcaStop/slash detection; projection size estimation) - journal-row-io.ts: journal SQLite reading + cursor-based resume - journal-digest.ts: fold journal rows into [user seq N]/[assistant seq N] format digest with 24k budget + truncation marking - render-journal.ts: journal cards with orca-journal source, sessionId@epoch:seq evidence anchors, S6 lookup via journal SQLite - roadmap-store.ts: dual cursors (scan/summarized), per-session opt-in, daily cap 20/day UTC, pending queue with idempotent keys and overflow merging, atomic temp+rename writes - summarizer-launch.ts: zcode -p spawn with stable cwd, constant-prefix cache ordering, 600s timeout + 1 timeout retry; service mode never degrades to heuristic (skip + pending on failure) - roadmap-service.ts: per-session task serialization, concurrency <=4, observeCommits + turnCompletion + idle subscriptions, S6 gate with anchorsVerifiedAt stamping, derived index + pits rebuild - roadmap-bootstrap.ts: Electron app lifecycle wiring + opt-in/opt-out API 23 new tests (segmentation tiers, git commit detection forms, backtrack, flush, state continuation, store cap/pending/optIn), total 55 green, oxlint 0/0. Spec: docs/specs/r1-service.md (triple-reviewed).
…type fixes - src/main/index.ts: dynamic import of roadmap-bootstrap in app startup (placeholder deps; real journal/workspace wiring follows in dogfood) - src/main/startup/main-process-quit.ts: roadmap service stop in before-quit - settings: sessionRoadmap?: boolean in global-settings-types (default false), default-global-settings, runtime-client-settings-shape, runtime-client-settings broadcast, runtime-store-contract allow-list - chapter-pipeline.ts split from roadmap-service.ts (max-lines); closures became explicit params (ChapterPipelineDeps narrow type) - type fixes from tsc: ../../roadmap/core → ../../../roadmap/core (import depth), sanitizeLlmText inlined in render-journal (avoids bun:sqlite transitive from render.ts), CutSignal flush variant + CutCandidate type, existsSync from node:fs not node:os, bun:test ambient type shim - latent fix: index-card.ts missing required pits:[] on index card literal (serializer already tolerated with ?? [], output unchanged) 55 tests green, oxlint 0/0, tsc node project 0 errors
…code probe - roadmap-runtime.ts: opens journal SQLite via node:sqlite DatabaseSync (readOnly not supported in current Node type defs — plain open; the service only reads); workspace path extracted from journal_sessions workspace_id 'hostId::path' format; session title from agent_session_records.conversationName; zcode probe checks npm entry - roadmap-runtime-wiring.ts: event wiring layer (currently listener-set pattern — runtime subscription upgrade when structured-session-runtime exposes subscribeTurnCompletions externally) - index.ts: placeholder deps replaced with real adapters - JournalDb type gains optional close() for cleanup 55 tests green, oxlint 0/0, tsc node project 0 errors
E2E: journal(68 rows) → segment → flush → digest → zcode -p(LLM) → render-journal → S6 → card write → index refresh. Card written to real workspace with source: orca-journal, provenance: llm. Fixes: node:sqlite → Orca sync-database; import.meta.dirname → process.cwd() for prompt path; backfill try-catch; debug logs removed. 55 tests green, oxlint 0/0, tsc 0 errors.
…STYLEGUIDE compliance 5 new renderer files (right-sidebar/): - RoadmapSidebarPanel.tsx: thin wrapper (AiVaultSidebarPanel pattern) - RoadmapPanel.tsx (~230 lines): shell + Sessions|Project|Pits segmented switcher (ToggleGroup matching FileExplorerViewSwitch), error bar, .scrollbar-sleek scroll, empty/loading states, open-card via openFile - RoadmapPanelViews.tsx: Sessions (VaultGroupHeader collapsible groups + chapter rows with quality/provenance badges), Project (milestone sections), Pits (keyword-bold, symptom→fix muted, clickable source, verified check) - roadmap-panel-data.ts: parsers for 000-index tables, KEYWORDS.md pits table, INDEX.md milestones; pipe-escaping + frontmatter quote handling - use-roadmap-panel-data.ts: loads via window.api.fs.readDir/readFile, fs.watchWorktree subscription with 300ms debounced refresh 6 registration files (type union, STATIC_RIGHT_SIDEBAR_TABS, two normalizers, activity items with Milestone icon, panel content switch). 18 i18n keys added (en + en-runtime-required). tsconfig.node.json includes bun-free roadmap/core files. pnpm tc passes (15,692 files, parity check green). 55 tests green. oxlint 0/0 across 851 files.
The stuck-session report (turn done, UI spinning until the window closes) matches a journal-wide fact: across every install's journal, 99 zcode turns sit 'running' — completions have been dropping systematically, and only the next turn's activity or a session close ever cleared the spinner. Two probes against a live app-server prove the server delivers turn.completed as a plain single notification, so the drop is on Orca's side and until now every candidate path failed silently. This commit makes each silent path speak: - the seq guard warns when it eats a turn.completed/turn.failed (a permanently stale lastSeq would do exactly this) - the translator's onDrop warns for any dropped turn.* envelope - the admission-retry loop counts consecutive refusals and warns when a held turn.end is still refused after 40 rounds (10s) instead of retrying forever with no trace Next occurrence now names its mechanism in the log; from there the fix is one targeted change instead of another archaeology dig.
…promotion Implements layer-002-003 spec v7.3 (owner-approved; dual adversarial review, 6 convergence rounds, dual APPROVE) on top of the v6 aggregator: - marks-store: append-only event log (.roadmap/002/boundaries.json) with replay-derived statuses, schema+reference validation, .bak + restore - aggregate-lock: whole-run lease with 60s heartbeat + fencing epoch (stale takeover bumps epoch; writes re-check it; only the current epoch holder may refresh the heartbeat) - fold: grouping as pure function of (live chapters, journal signals, marks events); total-order boundary arbitration (user-cut > user-mark > goal-set > orca-stop > time-gap > llm-cut > session-full); position-0 noop; any-source single-chapter merge - chapters: live chapter loading, chapterSetHash v2 with per-chapter versionHash (covers 001 content swaps at stable indices) - propose: >8-chapter folded groups trigger whole-span LLM subdivision; already-proposed guard with tail exception; proposalGroup atomic validation; attempt-event backoff with self-reference immunity - promote: 72h lazy first evaluation FROZEN into promote/reject-stale events (replay stability); human-trace detection by position keeps touched spans pending; needs-review anchor loss pauses groups - render/verbs/aggregate: Step 0-5 orchestration, manual verbs (add-cut / suppress-cut / review), marks validate/restore CLI Tests: 46/46 green (replay stability, three suppress states, promotion freeze, guard + tail, corruption + restore, anchor loss, mixed-source single-chapter groups, backoff, atomic validation rules, fencing). Dogfood on testZone (15-chapter campaign, no journal signals): LLM proposed 3 cuts at Ch.3/8/14 matching the true work arcs; idempotent no-op re-runs (0.17s, zero LLM); simulated-72h promotion regrouped into 4 milestones with ULID reuse via boundaryKey match + hash change.
Implements spec agent-retrieval v1.4 (owner-approved; dual adversarial review, 5-round convergence, Codex APPROVE): - agents-md.ts: managed block in workspace-root AGENTS.md (zcode loads it into every session's system prompt). Three states (create / append-when- absent / in-place update), exact begin/end markers, malformed markers refuse-write (user-data protection), BOM/CRLF/outside-bytes preserved, skip-unchanged, pre-write hash check + post-write merge-preserve against concurrent external edits. Wired into aggregate.ts Step 5 (runs every aggregation, after INDEX) - pits dual-file (pits-index.ts + pit-cells.ts): KEYWORDS.md bounded scan index (pit-id = keyword-set identity sha256, cross-session K merge, symptom from latest occurrence, union cell capped 79cp+ellipsis, window <=2400 code points & <=40 rows whole-row boundary) + DETAILS.md full rows with inline pit anchors, never truncated. Legacy single-file renamed to KEYWORDS.legacy.bak.N (never overwritten). DETAILS written before KEYWORDS (pointer side commits last) - persistent pit verification: mark derives from the card's own anchorsVerifiedAt + evidence seqs — fixes the runtime-verifiedSeqs regression where each new session build flipped older pits to unverified (build.ts verifiedSeqs set removed; chapter-pipeline.ts empty-set call updated) Tests: 94/94 green (16 new agent-retrieval incl. malformed/concurrency/ window/merge/migration/verification-persistence; 2 legacy pits tests migrated to persistent semantics; 46 aggregation + core suite). Dogfood on testZone (E2E, real zcode -p session): agent followed the protocol exactly — read INDEX + KEYWORDS + DETAILS only (no directory enumeration), cited 22 pits by id of which 9 came from OUTSIDE the index window via the DETAILS search channel, correctly reported the latest milestone stage, triggered the freshness rule (flagged INDEX-vs-git divergence), declared .roadmap read-only. Read-only proof: 47-file .roadmap hash snapshot identical before/after (ignored files included). Startup budget measured: L0 663 + L1 522 + Lp-i 1565 ~= 2750 tok (<=4000 target); index 29 rows/2380cp vs old single-file 98 rows/21.6k chars (9x reduction, window capped regardless of session count).
… (chains/overlaps/arcs, fork gate) - 9 tests + real testZone smoke
…g/fit) + selection re-resolution with demotion rules - 4 tests
…n, 8-point registration) + shared r2 store (generation-guarded loads) + CanvasTimeline/Inspector + sidebar rework (summary bar opens canvas, inbox, unified Session>Milestone>Chapter tree with two-level collapse); tc green, oxlint clean, 130 tests
….slug (cards' title field holds the session title) - sidebar tree, inspector and day-zoom cells now show real chapter names
…s; sidebar milestones as bordered cards with chapters collapsed by default, card click expands+selects (store toggle default flipped to closed)
…opens card as preview tab via chapter.file), sidebar auto-expands milestone card on chapter select; canvas UI zoom (toolbar -/%/+ and Ctrl+wheel, CSS zoom scales text with layout)
… sidebar cards, consistent M# + clamped-2 layout); lane date labels removed (left whitespace reclaimed); inspector moved below canvas as a bottom strip; sidebar sessions ordered by most recent activity
…time (002 files enumerate in ULID order which disagreed with time order) + computeLayout sorts segments defense-in-depth; regression test with alphabetically-reversed fixture
…ft pad 1 day -> 1 hour (horizontal space is the scarce axis); measured 9px block-to-scroller gap live
…ggregate lock fencing, preload roadmap bridge, inbox approve/reject with confirm->writing->done/error states); inbox derives review events as resolved; tsconfig node narrowed to the four-file aggregation closure
…bug), review-card separated-narrative context (prev/next chapter titles + first key-point from card body via snapshot summary), inbox review-event resolution fix (|| vs ?? chain), lock-queue retry in submit; E2E verified: UI approve writes real review event, inbox clears, narrative card renders
…t summary + 2-line rationale + single review entry; inline approve removed); full review in canvas bottom panel at 55% height — pinned before/after milestone rails with full wrapping titles via consequenceOf (pure + tested), per-cut rationale + adjacent-chapter narrative, sticky footer with consequence one-liner
…o trace file - dispatchZcodeTurn dropped image-ref blocks: the model read only the '[Image #1]' placeholder. image-ref path/url now maps to the protocol's attachments (kind:image, localPath / dataBase64), verified against the server's own attachment mapping in server-operations. - lane's dropped-completion / seq-guard / stuck-retry diagnostics went to console.warn, invisible in a packaged desktop (beta0.4 logs had zero hits for exactly this reason). They now ride deps.logger into main.trace.ndjson. - interactions cluster (held prompts + answer building) extracted to zcode-lane-interactions/-answers so the lane stays under 300 lines.
KyleQuinn888
added a commit
that referenced
this pull request
Oct 27, 2026
…: isLocalSession/policy on native scope, cursor advance in (epoch,seq) order not ts, candidate metrics dedup via folded-cursor stamp, workspace fallback picks a real journal carrier
KyleQuinn888
added a commit
that referenced
this pull request
Oct 28, 2026
…ds, stablyai#4 progress cleanup, stablyai#6 reentrancy guards, stablyai#10 debug removal)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature line: (1) zcode protocol client NDJSON + journal translator (phase 1-2); (2) R1 roadmap service — chapter pipeline, v7 aggregation (cut-point set model, marks event log, tiered promotion); (3) R2 UI — roadmap-canvas virtual editor tab (timeline, milestone bands, chapter drill-down, zoom), reworked sidebar (inbox, unified tree, pits), review write-verbs over IPC with aggregate-lock fencing, full review surface with before/after consequence preview. Gates: 133 bun tests, pnpm tc 4/4 projects, oxlint clean; runtime-accepted on real workspace via CDP.