Skip to content

Context tree: relocate from top panel to context side panel #264

Description

@jeonghun-jj-lee

Summary

The context tree (the interactive graph showing what the agent holds in context) occupies
a persistent 192px top panel on every session. It adds no actionable information at a
glance and reads as visual noise — it should be relocated to the context side panel
(the drawer opened by the progress-circle ring button in the session header) where it
becomes on-demand rather than always-present.

Important

Problem: The context tree's persistent top-panel placement consumes prime chat space
without aiding pulse-design decisions — it's orientation at the cost of focus.

Approach: Move the graph canvas into the context side panel (top section, above
stats), delete the top panel, return 192px to the chat timeline. On-demand instead of
always-on.

Scope: UI relocation only — the engine (context-tree-engine.ts), data derivation
(context-tree-data.ts), interactivity (click-to-open, keyboard nav), and hover-glance
are unchanged. No new features.

Assumption: The narrower side-panel width (~320–400px) works with the existing
force-settled layout; the engine's resize() and auto-fit camera already adapt.

Acceptance Criteria

  • The context tree canvas renders at the top of SessionContextTab (the context
    side panel), 192px height, full panel width.
  • The top panel (ContextTreePanel in message-timeline.tsx) is deleted — the chat
    timeline reclaims the space.
  • sessionHasContextItems gates the graph section inside the panel (no empty canvas).
  • Node clicks still open files: project files → session tab, vault files → Vault panel.
  • amicode:brain-hover events from tool rows highlight the corresponding node when
    the context panel is open.
  • The engine pause()s when the panel is closed; resume()s on open.
  • The localStorage key amicode-context-tree-open (the old collapse toggle) is
    removed.
  • Keyboard navigation (arrows, Enter/Space to open) works on the canvas in the panel.
  • ADR 0004 recorded; CONTEXT.md "Context tree" entry updated.
  • Existing context-tree-engine.test.ts and context-tree-data.test.ts still pass.

Key Decisions

Decision Rationale
Top of the panel, not a separate tab The graph is the qualitative counterpart to the stats — same "what's in context" question, visual vs. quantitative
No inner collapse The panel itself is the toggle; an extra chevron is redundant
192px fixed height Matches the prior panel; the engine adapts width via ResizeObserver
Supersedes ADR 0003 positioning only Interactivity, data model, and vault browsability are unchanged

Constraints & Invariants

  • context-tree-engine.ts and context-tree-data.ts must not be modified (engine is
    container-size-aware, no layout rework needed).
  • The amicode:brain-hover custom event contract is unchanged (emitter stays in
    message-part.tsx; listener moves with the canvas).
  • Vault node locked/unlocked status (fail-closed browsability per ADR 0003) is preserved.

Prior Art

  • ADR 0003 (the design this supersedes — positioned the graph in the top panel)
  • ADR 0002 (brain-as-background — parked direction, not pursued)

Source

Design brainstormed in Amicode session 2026-08-08; resolved via grill-with-docs.
ADR 0004 records the decision (separate PR).

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions