08. Trust, History, and Compacting
Trust Is Treated as a Real Boundary
interactiveHelpers.tsx and components/TrustDialog/TrustDialog.tsx show that trust is not cosmetic.
The app delays system context prefetch, full environment application, GrowthBook reinitialization, and some approvals until trust
is accepted. The trust dialog also checks for hooks, MCP servers, helper commands, bash settings, and dangerous environment variables.
History Is Session Infrastructure, Not a Convenience Feature
history.ts uses JSONL logs, reverse readers, per-project filtering, paste references, lazy resolution, and session ordering.
That means command history is used as structured session infrastructure, not just a line buffer.
Compacting Is an Operating Constraint
The files under services/compact/ show a dedicated subsystem for keeping long sessions alive. The compacting layer tracks
token budgets, attachment reinjection, file restoration, partial compacting, post-compact cleanup, and retry limits.
This is one of the strongest lessons in the whole tree: once a product supports long sessions, prompt management becomes memory engineering.
AppState Explains Product Scope
state/AppStateStore.ts is worth reading because it reveals product ambition in one place: tasks, agent registry, MCP clients,
plugin loading, remote sessions, bridge state, session URLs, teammate views, todo state, file history, permissions, and rich footer behavior.
Takeaway
Source Navigation
Recommended Source Files
source/components/TrustDialog/TrustDialog.tsxsource/history.tssource/services/compact/compact.tssource/services/compact/autoCompact.tssource/services/compact/microCompact.ts
Next Files to Read
source/services/SessionMemory/sessionMemory.tssource/services/compact/prompt.tssource/services/compact/sessionMemoryCompact.ts