Skip to content

React frontend + Claude Code subagent linkage - #19

Open
artcashin wants to merge 65 commits into
prime-radiant-inc:mainfrom
artcashin:feature/react-frontend
Open

artcashin wants to merge 65 commits into
prime-radiant-inc:mainfrom
artcashin:feature/react-frontend

Conversation

@artcashin

Copy link
Copy Markdown

New Vite + React frontend on engineering-notebook's existing Bun/Hono/SQLite backend, replicating the 3-panel layout (index · Claude summary · session detail) with top nav (Journal / Projects / Calendar / Groups), plus first-class support for Claude Code subagents.

Highlights

  • React session viewer — panel 3 ports claude-session-viewer's display (active-path branch resolution, thinking/tools toggles in the top bar, redacted-thinking markers, incremental rendering for large transcripts, local-command-stdout filtering).
  • Session titles — Desktop titles imported, LLM-generated fallback for Claude-Code-only sessions, sticky user edits; used in panels 2 and 3.
  • Desktop groups — import Claude Desktop's session groups; Groups tab.
  • Subagent linkage — subagents are linked to their originating session (parent_session_id) and re-homed to the parent's project (relinkSubagents, idempotent backfill). Surfaced across the viewer:
    • panel 2 nests a session's subagents (revealed on selection), labelled by subtask title;
    • panel 3 gets a compaction-proof subagent index, a "Subagent of …" backlink that scrolls to / highlights the exact spawn point (falling back to the index when compacted away), and inline spawn links matched by tool_use id (name-agnostic — Claude Code names the tool Agent, not Task);
    • subagents are excluded from Ungrouped and the flat sessions list.

Tests

  • Backend: 180 tests pass; typecheck clean.
  • Web: 16 vitest tests pass; build clean.

🤖 Generated with Claude Code

artcashin and others added 30 commits July 19, 2026 07:58
Manual groups over coding sessions: a Groups nav tab, one group per
session, in-app create/rename/delete, membership in a separate table
that survives re-ingest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7 TDD tasks: schema, helper module, nav, views, routes, session
control, verification. Corrects spec FK note (foreign_keys=ON means
session_id must have no FK to survive re-ingest).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
One-way import of Claude Desktop groups (dframe-group-scopes) into the
notebook: reader + reconcile (mirror by desktop_id, manual groups
untouched), Ungrouped view, and a block-while-Desktop-open guard behind
a single policy switch. Write-back deferred to Phase 2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7 TDD tasks: desktop_id migration, classic-level reader (schema pinned
against real store), reconcile/mirror, Ungrouped view, block-while-open
guard, import route+button+CLI, verification.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Approach A (re-parse source JSONL on demand). Default text-only; Show
thinking/tools via query params re-parses source_path, warns if the
file is unavailable. No ingest/schema change. Precedes the group work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 TDD tasks: transcript parser, enriched session render + toggle
controls + CSS, route params, verification. Re-parses source_path on
demand; default view unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…es, param-preservation test

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Core match: collapsible tool calls (name + preview, result paired
inside), thinking bubbles + token estimate, teal accent + rounded
styling on the notebook's light palette. No markdown/diff (deferred),
no new deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3 TDD tasks: parser tool id/input enrichment, collapsible-tool +
thinking-bubble render rework + CSS, verification.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t edge

Final-review cleanups: remove redundant style="display:block" on the
orphan tool_result div; update spec edge-case wording to match the
implemented (extras-dropped) behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Umbrella doc: keep engineering-notebook backend, new React/Vite frontend
matching claude-session-viewer's session display, plus Desktop groups.
Recommends monorepo + a 5-phase roadmap (Phase 1 = session display
parity). Evidence-based session-chain findings (resume = same session;
subagents are the multi-file case). Each phase gets its own spec/plan.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
React/Vite app in web/, Hono JSON API (session list, structured
transcript, subagent), polished session viewer (collapsible tools,
thinking, subagent nesting, client-side hide/show toggles), Tailwind.
Subagent->Task mapping via first-prompt match (viewer's strategy).
Spikes deferred to plan: on-disk subagent layout, Vite<->Hono wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7 tasks: Vite/Hono scaffold+wiring, structured transcript endpoint,
subagent discovery via .meta.json + endpoints, session list, React API
layer + list view, session viewer (collapsible tools/thinking/subagents
+ toggles), verification. Additive-only; legacy views/DB untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- web/ Vite React-TS + Tailwind SPA; App pings /api
- createApiRouter mounted at /api; GET /api/ping
- createApp({react}) serves web/dist SPA (assets + index.html fallback),
  skipping legacy views; --react flag threaded through serve
- exclude web/ from backend tsconfig
Verified end-to-end: dev proxy + prod build; /api/ping, SPA, assets, and
client-route fallback all 200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
artcashin and others added 18 commits July 19, 2026 16:05
Claude Code sometimes emits a thinking block with only a signature
(encrypted) and empty text. The viewer rendered these as blank boxes;
we dropped them. Now the parser keeps empty thinking blocks and
ThinkingBlock renders a "🔒 redacted thinking" marker, so it's visible
that reasoning occurred even when the text is encrypted. Same change
applied to the local claude-session-viewer's ThinkingBlock.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Render the transcript in bounded batches (80) and grow as the reader
scrolls (IntersectionObserver sentinel), so a 1000+ message session no
longer freezes on first paint or when toggling thinking/tools. Small
sessions render in one batch (jsdom tests unaffected).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lift the toggle state into a TranscriptTogglesProvider (context) so the
buttons live in the always-visible top bar, left of the search box, and
stay usable no matter where you are in the session scroll. SessionView
reads the toggles from context instead of owning them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- sessions.title / title_source columns
- import captures each Claude Desktop session's title (titleSource
  desktop|user) from local_*.json (same files the group import reads)
- generate a Desktop-style title via the Claude Agent SDK for Claude
  Code sessions without one; stored as title_source=generated
- `engineering-notebook title [--generate --limit N]` CLI + POST
  /api/sessions/:id/title on-demand endpoint
- API exposes titles (session list, group sessions, journal/project
  entry sessions); panel 2 and Groups list show the name instead of
  "Session N"

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…edits

- Panel 3 h1 shows the stored session title (Desktop/generated),
  falling back to the first prompt.
- summarize now generates a Desktop-style title for each summarized
  session that lacks one (applies Desktop titles first so it only
  LLM-generates where genuinely missing).
- User-edited Desktop titles are sticky (never overwritten by auto or
  generated); auto/generated titles refresh on re-import. Expose
  title_source in the session API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A user record whose content is purely <local-command-stdout>…</…> is
machine output, not a user turn — it was rendering as a 'You' bubble.
Skip it in the tree build (bridging parentUuid through it), matching the
same fix applied to the local claude-session-viewer's buildMessageTree.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ingested subagent transcripts (<project>/<parentUUID>/subagents/agent-*.jsonl)
now record parent_session_id — taken from the records' own sessionId without
triggering the continuation prefix-skip (a separate continuationParentId drives
that). A new relinkSubagents() fills the link (from the column or recovered from
the path) and re-homes each subagent's project_id to its parent's project. It
runs at the end of ingest and is order-independent + idempotent, so it also
backfills. Adds idx_sessions_parent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
/api/sessions/:id now returns the subagent backlink (parent_title, gated on
is_subagent so continuations aren't mislabeled), subtask_title, spawn_tool_use_id,
and the session's ingested subagents ordered chronologically. Journal, project,
and group rows carry their nested subagents via a shared ingestedSubagents()
helper (single batched query, filtered to ingested rows so there are no dead
links). Ungrouped and the flat /api/sessions list exclude subagents.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Panel 2 nests each session's subagents (revealed once the session is selected),
labelled by subtask title. Panel 3 gains: a compaction-proof SubagentIndex; a
"Subagent of …" backlink (shown only for subagents) that navigates to the parent
and scrolls/ring-highlights the exact spawn point, falling back to the index when
the spawn was compacted off the transcript; inline spawn links matched by
tool_use id (name-agnostic — Claude Code names the tool "Agent", not "Task"),
visible even with tools hidden; and subtask titles as the panel header. The
focus scroll fires once per target and the window grows-only, so reading past a
spawn no longer snaps back.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The date was interpolated raw into the muted/error summary cards; wrap it in
escapeHtml() like the surrounding fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ingestion was nested inside the remoteSources block, so a purely local setup
never scanned/ingested on sync. Hoist the scanSources/ingestSessions call so it
always runs, appending any remote cached paths when present.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… toggle

Compacted sessions keep their full pre-compaction messages in the same file, but
active-path resolution prunes them (e.g. 1,036 shown of 3,122). Panel 3 now
defaults to the uncompacted view: the transcript parser gains a `full` option
(returns every message in file order, dropping the injected isCompactSummary
blob) and a `compacted` flag; the endpoint honors ?full=1. A third top-bar
toggle — "View compacted" / "View uncompacted" — switches modes, defaulting to
uncompacted so pre-compaction detail (and its subagent spawn links) is shown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… compacted

Plumb the transcript's `compacted` flag to the toggle bar. The "View compacted"
button is disabled (and greyed) unless the open session actually has a compacted
view to switch to. Non-compacted sessions are forced back to the default
uncompacted view so the disabled toggle never strands the reader in compacted
mode; the toggle re-disables when leaving the session.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Light green (matching the other toggles) when the session has a compacted view;
gray when it doesn't.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…uped to remove)

Adds POST /api/sessions/:id/group ({ groupId } assigns, { groupId: null }
unassigns; 404s on missing session/group). In the Groups view, panel-2 session
rows are draggable and panel-1 group rows (and Ungrouped) are drop targets with a
hover highlight; dropping assigns/unassigns the conversation and refreshes the
counts and current list. Subagent rows stay non-draggable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`bun test` collected web/src/**/*.test.tsx and failed 18 of them with
"document is not defined". Those are React component tests that need a DOM,
which is configured for vitest in web/vite.config.ts — a file Bun's test
runner does not read. Nothing was wrong with the tests themselves: they pass
under their intended runner.

The failure was invisible locally because the pre-commit hook runs the scoped
`bun test ./src`, while both CI workflows run a bare `bun test`. main has no
web tests, so this branch would have turned CI red on merge.

bunfig.toml scopes Bun's runner to src/, leaving it responsible for the
backend suite alone. That also excludes web/src/session/adapt.test.ts, which
is DOM-free and did run under Bun, so CI now runs the web suite with vitest —
covering all 20 web tests, which CI never executed at all. web/ is not a
workspace of the root package, so its dependencies install separately.

Verified: bare `bun test` 182 pass / 0 fail, `bun run test:web` 20 pass,
typecheck clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
artcashin added a commit to artcashin/engineering-notebook that referenced this pull request Aug 2, 2026
…ime-radiant-inc#19 merge

prime-radiant-inc#16 replaced ingest's single `skipped` counter with alreadyIngested / empty /
duplicateId, deriving `skipped` from their sum, and dropped the no-start-time
guard. prime-radiant-inc#19 keeps that guard and still increments `skipped`.

Git merges the two cleanly: prime-radiant-inc#16's counters plus prime-radiant-inc#19's guard, referencing a
variable that no longer exists. Tests pass; `tsc` does not:

    src/ingest.ts(108,9): error TS2304: Cannot find name 'skipped'.

A session with no start time cannot be placed on a date, so it is as unusable
as one with no messages and is counted as empty, which flows into the derived
`skipped`. Keeping the guard rather than dropping it as prime-radiant-inc#16 did: without it a
session with no timestamp is inserted with an empty started_at and misgroups.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@artcashin

Copy link
Copy Markdown
Author

Heads-up: this and #16 merge cleanly into code that does not compile

Cross-posting from #16 so it is visible on both sides. Found while rebasing other work onto #16 and #18.

This PR keeps the !session.startedAt guard in ingestSessions and increments skipped. #16 replaces skipped with alreadyIngested / empty / duplicateId, derives skipped from their sum, and drops that guard.

Merged, git produces no conflict but the result references a variable that no longer exists:

src/ingest.ts(108,9): error TS2304: Cannot find name 'skipped'.

The test suite passes on the merged result; only tsc catches it. Since pull_request builds against a simulated merge with the base, this shows up as a red typecheck on whichever of the two is merged second.

It cannot be fixed ahead of time in either PR — the correcting line only compiles when both are present. The resolution I used was to keep the guard and count it as empty++, which feeds the derived skipped; dropping the guard would let a session with no started_at be inserted and then misgroup by date.

artcashin and others added 3 commits August 8, 2026 16:49
…ders

Clicking a date swapped raw JSON into the journal's middle panel.

The React JSON API is mounted with app.route("/api", ...) before the HTMX
fragment routes are declared, and Hono matches in registration order. The API
router defines /journal/entries, so /api/journal/entries resolved to the JSON
handler and the HTML fragment route below it was unreachable dead code. HTMX
got application/json and swapped it in verbatim.

Moves that fragment to /hx/journal/entries and points the hx-get at it. Only
this one path collided; every other fragment route still returns HTML, verified
endpoint by endpoint.

Tests pin both halves: the fragment must return text/html, and the JSON API
must keep its own /api route. Without the first, the next colliding path breaks
a panel silently again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Follow-up to the journal panel fix. /api belongs to the React JSON API, which
is mounted first and wins on any colliding path, so every fragment route living
there was one rename away from silently swapping JSON into a panel. Only
/journal/entries collided so far; the rest were latent.

Moves the remaining seven fragments (journal conversation, project timeline and
summarize, sync, sync status, summarize, settings card and test-connection) to
/hx and updates their 13 call sites.

/api/calendar.ics deliberately stays: it is a public subscription URL published
in the README as webcal://…/api/calendar.ics, and moving it would break
calendar apps already subscribed. A test pins that it stays reachable.

The structural guard is the point of this change — a test now fails if any view
emits an hx-* attribute pointing at /api, so the next collision is caught at
test time rather than by a user seeing raw JSON.

Two pre-existing sync tests referenced the old paths and were updated to follow
the routes they cover.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
.gitignore listed `node_modules/` with a trailing slash, which matches a
directory only. A `node_modules` symlink — what `git worktree` users create to
share an install — is not a directory entry, so the pattern missed it and
`git add -A` staged it. I did exactly that, committing an absolute symlink to
my own machine.

Worse than noise: merging a commit whose tree has node_modules as a symlink
makes git replace a real node_modules directory with that symlink, and a later
reset removes it, leaving the branch with no dependencies installed at all.

Drops the trailing slash so the pattern covers both, and untracks the symlink.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant