Introducing a new way to review your PRs.

Read the announcement

thedotmack / claude-mem

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

View on GitHub

47 documents · Updated Nov 20, 2026

docs / context-construction

Context construction pipeline

The context construction pipeline turns stored observations, session summaries, and current work state into a bounded text view that an agent can use at session start or during work. It applies project and platform scope, selects recent records, spends detail only on the most useful observations, and renders either agent-ready text or human terminal output. It is the construction part of context generation and delivery; MCP recall and tooling covers the later read path for details that do not fit in this packet.

Construction model

Context request

Each generation request carries the scope and presentation needs for one context packet. The request can name a current directory, a project chain, a platform source, a session, and whether the caller wants the normal bounded view or a full view.

The last project in a project chain is the primary project for the heading and empty state. The chain itself lets the query include related projects. Platform source values are normalized before they filter stored records, so equivalent names map to one source.

References: src/…/types.ts• L2-35 src/…/ContextBuilder.ts• L509-537 src/…/platform-source.ts• L1-18

Configuration profile

The context profile joins user settings with the active mode. Settings control record counts, detail depth, optional summary and message sections, and token display. The mode supplies the allowed observation types and concepts plus the labels and markers used in the output.

Configured observation types and concepts narrow the active mode instead of widening it. IDs saved under another mode are discarded. If no configured IDs remain, the profile uses the active mode's full list. If a mode cannot be loaded, the mode system falls back to the default code mode. This keeps the selection rules and the display vocabulary consistent.

References: src/…/ContextConfigLoader.ts• L28-49 src/…/ContextConfigLoader.ts• L52-90 src/…/types.ts• L38-68 src/…/ModeManager.ts• L102-139

Record selection

Selection reads observations and session summaries from the memory source for the active runtime after scope and mode filters are known. The local path reads the local memory store. The server-runtime path reads the shared server and converts its newest rows into the same observation and summary shapes used by the rest of the pipeline. Observations must match an included project or merged project, an observation type, and an observation concept. Summaries use the same project and platform scope but describe whole sessions. Project names are matched without case sensitivity, and large project chains are split into batches before the newest unique records are chosen. An explicit empty project scope returns no observations; only an omitted project filter can request a house-wide feed. The main-agent setting can also exclude subagent records from the standard context view.

Both record types are ordered from newest to oldest before the builder combines them. The normal view uses configured observation and session limits. A full request raises those limits so a caller can ask for the wider project history, although the shared-server read still applies its route limit. When reinforcement ranking is enabled, the selector first gathers a wider recent pool so recently re-confirmed older observations can enter the configured window. The selection can include a short look-ahead of summaries so the timeline can place the displayed session summaries correctly.

References: src/…/ObservationCompiler.ts• L45-60 src/…/ObservationCompiler.ts• L79-212 src/…/ObservationCompiler.ts• L233-284 src/…/ContextBuilder.ts• L658-691 src/…/ServerContextRows.ts• L30-46

Token budget

The pipeline uses configured record counts as the first context budget. It keeps most observations as compact index rows and expands only the newest configured number of observations into a detail field. This gives the agent a recent map while keeping the first render small.

The work-state section has its own 3,000-character cap. It keeps the session-start packet focused on open work and leaves room for memory. When lines do not fit, it reports the number left out and points the agent to work_state_read.

The final delivery budget is measured in characters because the session-start hook has a hard output limit. If the rendered block is too large, the pipeline removes detail first, then the latest summary block, then the prior session message, then older session summaries, and finally older observations. It renders after each reduction and drops whole units rather than cutting text in half. Health warnings are part of the measured block, and full requests bypass this delivery limit. Human terminal previews reserve space for the banner added after the context block and can hide presentation lines without changing the model's selected context.

The token calculator estimates read cost from the stored title, subtitle, narrative, and facts text. It compares that estimate with the recorded discovery cost to show savings and support telemetry. Facts are counted in the text form already returned by the reader, so the estimate does not add a second encoding layer. Injection statistics describe the observations and summaries that survive delivery fitting, not only the rows first selected.

References: src/…/ContextBuilder.ts• L435-507 src/…/ContextBuilder.ts• L544-580 src/…/ContextBudget.ts• L9-32 src/…/ContextBudget.ts• L35-94 src/…/TokenCalculator.ts• L6-43

Context assembly

The builder assembles the selected data in a fixed order. The agent form starts with a pointer to the rules and tools file, then places health notices and open work before the prior reply and timeline. The timeline ends the packet so later updates can append newer rows. The human form keeps the prior reply above the timeline and uses presentation-only truncation when needed.

This diagram shows how a request becomes model context or a human-facing view.

flowchart TD
    A[Generation request] --> B[Load settings and active mode]
    B --> C[Select observations and summaries]
    C --> D[Estimate token economics]
    D --> E[Build time-ordered timeline]
    E --> F[Render rules pointer, work state, and prior reply]
    F --> G[Render timeline and current summary]
    G --> H[Fit model delivery budget]
    H --> I[Render agent or human context]

Timeline compilation

Timeline compilation combines observations with session summaries and orders them by time. The result is grouped by day so the agent can follow work across sessions instead of reading two unrelated lists.

Each observation has a compact identity made from its ID, time, type marker, and title. The selected full observations also show either their narrative or their facts, based on configuration. Summary items show the session request. A newer latest summary can add investigated, learned, completed, and next-step fields.

References: src/…/ObservationCompiler.ts• L381-421 src/…/TimelineRenderer.ts• L12-87 src/…/SummaryRenderer.ts• L7-55

Work state context

The work state section gives the agent a compact view of open to-do lists and other tracked state at session start. It also defines work_state_write as the canonical way to track multi-step work and directs the agent to work_state_read when it needs closed items or entries omitted from the compact view.

The renderer folds each list in write order so the latest value for each field wins. It keeps tasks in first-seen order, hides closed tasks by default, and still shows open tasks inside a list whose state is closed. Lists are grouped by effective project scope and sorted by their latest write. A project label appears when the same list name exists in more than one scope. Lists already shown in My Work, such as owner goals, rules, and focus, are omitted from this section. Shared work-record lists are also omitted because they are shown through the shared work view.

If no eligible list has open content, the section is absent. Relative update times can be rendered as read-time placeholders for cached context. The section keeps only open lines within its character limit and adds an overflow line instead of silently presenting a complete-looking list.

References: src/…/WorkStateRenderer.ts• L12-29 src/…/WorkStateRenderer.ts• L31-68 src/…/WorkStateRenderer.ts• L70-103 src/…/WorkStateRenderer.ts• L105-169

Section formatting

Section formatting separates content decisions from display decisions. The agent form uses compact Markdown-like text and points to the rules and tools file. The human form adds color, labels, and readable token economics for terminal use.

The header creates or refreshes RULES-AND-TOOLS.md and points the reader to it. That file explains the active mode, timeline legend, and available retrieval path. Local context can use full observation IDs for detail reads. Shared-server context uses short display references and points to search instead. Both forms draw from the same selected timeline, while a human preview may hide complete entries without changing the model-facing selection.

References: src/…/HeaderRenderer.ts• L5-14 src/…/RulesAndToolsFile.ts• L13-18 src/…/RulesAndToolsFile.ts• L30-63 src/…/AgentFormatter.ts• L19-63 src/…/HumanFormatter.ts• L25-67 src/…/TimelineRenderer.ts• L90-175

Context bridges

The builder can add two small bridges to make the packet more useful than a list of records. A current session can receive the latest usable summary when it is newer than the latest observation. It can also receive the last assistant message from an earlier session when that option is enabled and a prior transcript is available.

The prior reply appears under a Previously section above the timeline. For Claude sessions, the bridge reads one assistant text from a different prior session and removes memory tags before rendering it. Missing transcripts, unsafe session identifiers, and non-Claude session IDs produce no prior reply. These bridges remain selective. The pipeline does not copy a full transcript into startup context, and it points the agent to observation IDs for deeper recall.

References: src/…/ContextBuilder.ts• L145-160 src/…/ObservationCompiler.ts• L286-379 src/…/PreviouslyRenderer.ts• L7-19 src/…/SummaryRenderer.ts• L7-33 src/…/AgentFormatter.ts• L80-90

Read worker boundary

Local context reads can run through a long-lived read worker. The worker owns read-only database access and exposes one typed request boundary for rendering, project-key expansion, work-state reads, observation checks, project lookup, and keyword searches. This keeps database work away from the caller while preserving the same builder and renderer for inline and worker execution.

Ordinary worker reads use short-lived query-only database access. Keyword search keeps a read-only connection for the worker lifetime so search can reuse its temporary search data without opening write access to the memory store.

The client creates the worker on first use, tracks pending requests, and returns failures to each waiting caller if the worker exits. A read that exceeds its timeout retires the worker, rejects all pending requests, and lets a later call create a replacement. The timeout names the read method and records time spent waiting and running so slow reads can be diagnosed. Worker shutdown also has a bounded termination wait, so a stuck native read does not hold the process open indefinitely. The client limits the pending queue and can close the worker without leaving unresolved reads. The worker applies the active mode snapshot before rendering, so a worker request uses the same mode and configuration that the caller selected. Search requests use a read-only search service that remains available for the worker lifetime.

References: src/…/ContextReadProtocol.ts• L6-54 src/…/ContextReadWorkerClient.ts• L8-29 src/…/ContextReadWorkerClient.ts• L32-58 src/…/ContextReadWorkerClient.ts• L75-129 src/…/ContextReadWorkerClient.ts• L142-218 src/…/context-read-worker.ts• L14-87 src/…/ContextBuilder.ts• L658-675

Context cache

The context cache keeps common session-start renders ready for fast delivery while the local memory store remains the source of truth. It learns variants from live requests and identifies them by project scope, platform source, and terminal color choice. A short delay combines nearby writes before the cache renders the affected variants again.

The cache removes a file before a deletion, merge, import, tombstone, or relevant work-state change can be served. It also discards a render that began before such a change or was overtaken by a newer render. When sync is not caught up, cached files are removed and the hook uses the live path until the cache is safe to serve again. Health banners and session-specific prior replies stay out of cached bodies.

References: src/…/ContextCacheService.ts• L1-30 src/…/ContextCacheService.ts• L131-148 src/…/ContextCacheService.ts• L167-235 src/…/ContextCacheService.ts• L267-319 src/…/ContextCacheService.ts• L344-423

Generation requests

Context generation is exposed through a worker endpoint and an MCP tool. Hooks, the viewer, managed context-file refreshes, and observer session briefings reuse the same construction pipeline. Each caller chooses the output form and the read boundary that fits its host.

Worker generation

The worker accepts a project or project chain and optional platform, full-view, and color flags. It can pull recent synchronized records with a short time limit before it builds context. Local worker routes use the context read worker for the database read and then return the shared text and statistics shape.

The normal worker path fits the rendered packet to the session-start output limit. It reports statistics for the records that remain after fitting. A full request keeps the wider selection without applying that delivery cap.

If the request has no project, or if the project list is empty, the worker rejects it. If the project has no records, it returns a welcome or empty state. Observer health warnings can prefix both empty and populated output so an outage is not confused with an empty history.

References: src/…/SearchRoutes.ts• L348-379 src/…/SearchRoutes.ts• L381-430 src/…/ContextReadWorkerClient.ts• L17-35 src/…/ContextBuilder.ts• L631-691

Hook and MCP requests

At session start, the hook builds a project-chain request from the current directory and sends it to the worker endpoint or the shared server runtime. It skips context for projects excluded by the tracking rule and skips new context when Claude Code is resuming an existing conversation. It also adds the configured memory instructions to the model packet, so the packet can carry both recalled context and the rules for using it.

The hook normalizes the platform source before it builds the request. By default, session start reads that source only. A setting can instead share startup memory across sources. The hook can serve a precomputed render from the context cache when the worker path has one. A request that includes the prior message uses a live request because the cache does not contain that session-specific bridge.

In server runtime, the hook reads the shared server through the server-row adapter and does not start a local worker. The adapter returns a successful empty server response as an empty corpus rather than using stale local rows. It also keeps separate room for observations and summaries within the server read cap. Both paths use the same model-facing render and the same bounded session-start budget.

Codex uses a bounded worker start and request wait for cold sessions, so a missing worker does not hold the session open. The session_start_context MCP tool remains a separate request path for clients that call MCP directly.

The hook places the generated result in model context. Optional colored output is kept as a user-visible system message, except on Codex where repeated output can exceed its hook-output limit. Antigravity receives the plain model packet for terminal display because it does not use the colored session-start path. A worker failure produces a safe empty hook result so memory failure does not block the session.

References: src/…/context.ts• L45-65 src/…/context.ts• L67-137 src/…/context.ts• L140-190 src/…/context.ts• L192-287 src/…/ServerContextRows.ts• L48-102 src/…/ContextBuilder.ts• L621-655 src/…/mcp-server.ts• L373-395 src/…/mcp-server.ts• L562-579

Packaged generation

The packaged context generator is a plugin-local route for creating the same kind of agent-ready packet when the plugin runtime handles the request. It derives the project scope from the current directory unless the caller provides a project chain, accepts an optional platform and session filter, and exposes both text-only output and output with generation statistics.

It reads the local memory database without changing it. A full request expands the selection limits and removes the normal hook output cap. A missing database or an empty result becomes a safe empty or welcome context instead of blocking the calling session. The normal route trims the rendered timeline to its output limit and reports statistics for the records that remain in the returned packet.

References: plugin/…/context-generator.cjs• L13-61 plugin/…/context-generator.cjs• L75-84

Preview and file delivery

The viewer uses the preview request to show the human form for a selected project and platform source. The same generated text can refresh a managed agent context file, where the file layer replaces only its marked context block and preserves user-authored text.

During an active session, a user-message hook can request a fresh banner. A transcript watcher can request the project-chain view for AGENTS.md updates. These are delivery choices around the same construction result, not separate context rules.

References: src/…/SearchRoutes.ts• L353-379 src/…/useContextPreview.ts• L83-122 src/…/user-message.ts• L13-45 src/…/processor.ts• L343-389 src/…/context-injection.ts• L6-43

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep context request fields aligned between contextHandler, /api/context/inject, session_start_context, and the read-worker render method. Project chains, platform filters, full mode, and human formatting must keep the same meaning.
  • Keep project exclusion checks aligned with observation writes and context reads. An excluded project must not save new memory and then show old memory at session start.
  • Keep resume handling aligned with session-start cache and hook registration behavior. A resumed conversation must not receive a new prompt prefix that invalidates its existing context.
  • Keep server-runtime reads, inline reads, worker reads, and context-cache keys aligned with the same project chain, platform scope, mode, and render variant. A cache hit must represent the same corpus and output form as a live request.
  • Keep the read-worker protocol aligned with its client and worker switch. Method names, request fields, mode snapshots, search options, and result shapes must remain compatible.
  • Keep worker lifecycle failure handling aligned with all callers. A worker exit or request timeout must reject pending reads and leave later calls able to create a new reader. Timeout diagnostics must keep the method and queue/run timing tied to the read that retired the worker. Shutdown must remain bounded.
  • Keep the shared-server row contract aligned with the local observation and summary shapes. Server kind values must preserve observation types, summary rows must remain separate, and JSON fields must keep the text form expected by the renderer and token counter.
  • Keep the shared-server read cap aligned with observation, summary, and look-ahead needs. Full mode can widen the normal request but cannot make the bounded server route return more rows than its cap.
  • Keep configured observation type and concept IDs aligned with the active mode, the selection query, and the formatter legend. Settings from a prior mode are ignored when their IDs are not valid in the active mode, and an all-invalid filter falls back to the mode-wide list.
  • Keep the normal observation count, full-detail count, session count, and full override aligned. A mismatch can make the packet appear complete while omitting the records the caller expects.
  • Keep the render and budget reduction order aligned. The output cap must measure health notices and must produce statistics from the same records and summaries that the caller receives. Keep terminal banner reserve separate from the model budget.
  • Keep the timeline item shape aligned with both formatters. Summary items and expanded observations must remain readable in agent and human output.
  • Keep work-state scope grouping aligned with checkout aliases and adopted source projects. Same-named lists must merge only within the intended effective project scope and must be labeled when scopes differ.
  • Keep work-state folding, shared-list filtering, and closed-item rules aligned with work_state_write and work_state_read. A closed list must not hide open tasks, and a null field must continue to clear its prior value.
  • Keep the work-state character cap and overflow line aligned with the session-start budget. Truncation must remain visible and must point to work_state_read rather than look like a complete list.
  • Keep the managed context tags stable. File refresh depends on those tags to replace generated text without replacing user content.
  • Keep platform-source normalization and the all-source session-start option consistent at request boundaries and in record queries. A naming or scope mismatch can return an empty but valid-looking context packet or expose memory from an unintended source.
  • Keep project-chain selection aligned with both project fields and the reinforcement pool. Batching must still return the newest unique records before any ranking reduces the result to the configured count.
  • Keep the meaning of an omitted project filter separate from an explicit empty project scope. A project-scoped request must not become a house-wide feed after its project names are removed.
  • Keep prior-session lookup limited to safe host session IDs and the correct platform namespace. Transcript-derived text must keep the same privacy filtering as stored messages.
  • Keep token economics aligned with the text shape returned by context readers. Facts already returned as JSON text must not gain a second encoding cost.
  • Keep the packaged context generator in sync with the source pipeline. Its project-chain, merged-project, platform, mode, full-view, statistics, and output-size rules must keep the same meaning as the worker path.
  • Keep model context and user-visible hook output separate. Codex must not receive a duplicate timeline in systemMessage, and terminal-only notices must not change the model packet unexpectedly.
  • Keep cached variant scope tied to the accepted body. Invalidation must match both the stored read scope and the scope currently being rendered, and removal or relevant work-state changes must remove the file before the next hook can serve it.
  • Keep cache availability tied to sync freshness. Do not serve precomputed blocks while sync is behind, and do not cache health banners or session-specific prior replies.
  • Keep the rules-and-tools pointer aligned with the generated file. The header must not point to a missing file, and local and server runtimes must publish the retrieval path that their references support.

Important failure modes

TriggerConsequenceGuard
A request has no project or contains only empty project namesThe worker cannot define a memory scope and rejects the requestValidate the project parameter before generation.
A project is excluded only on the write pathSession start can still inject old context for that projectApply the project tracking rule on the read and inject path.
A resumed Claude Code session receives a fresh timelineIts restored conversation can lose the prompt prefix expected by its context cacheReturn an empty session-start result for resume events.
A cache key omits a project, source, or render variantThe hook can serve context for the wrong scope or output formBuild cache keys from the same scope and color inputs used by live requests.
The shared server is unavailable in server runtimeSession start returns an empty block instead of falling back to stale local rowsUse the bounded server path and keep the empty result non-blocking.
A successful shared-server response is treated as a transport failureSession start can fall back to stale local rows and show memory that does not match the server runtimeTreat an answered empty response as authoritative and reserve fallback behavior for an unanswered request.
A read-worker method or result shape changes on one side onlyContext routes or worker search fail even though the local database is healthyKeep the protocol, client, worker, and route contracts synchronized.
The context read worker exits while requests are pendingHooks, previews, or searches can wait forever or report unrelated empty contextReject all pending requests on error or exit and recreate the worker on the next call.
A context read exceeds its request timeoutThe client retires the worker and rejects all reads queued behind itKeep the timeout longer than the expected cold read and let later calls open a replacement.
A timeout is reported without the read method or queue/run timingOperators cannot tell which read is slow or whether the queue caused the deadlinePreserve the timeout error metadata and report it once for the retired reader.
A cached variant is invalidated only from its last accepted scopeA write in the scope of an in-flight render can leave an old block available for the next sessionTrack the render's temporary scope and remove or requeue the variant before accepting its body.
Cached files remain servable while sync is behindSession start can show local memory that does not include remote changesRemove cached files until sync catches up and use the live path.
Shared-server rows are mapped with the wrong kind or field shapeType markers, summaries, expanded facts, and token statistics can be wrong even though the request succeedsPreserve the local observation and summary contract when adapting server rows.
A full server-runtime request is assumed to mean unlimited historyThe route still caps the fetched mixed recency windowKeep the server cap visible in full-mode behavior and use the common renderer and budget rules after the read.
Saved observation type or concept IDs are not part of the active modeThe loader discards those IDs; if all configured IDs are stale, the active mode's full list is used instead of an empty filterTreat context settings as a narrowing of the active mode and keep saved IDs compatible with that mode.
A full-detail count is greater than the selected observation countNo additional observations become detailed because detail is chosen from the selected setTreat total selection and full-detail counts as separate, ordered limits.
Reinforcement ranking is enabled without a wider candidate poolRe-confirmed older observations cannot enter the configured windowGather the ranking pool before applying the final observation count.
An explicit project list becomes empty after input cleanupA project-scoped request can return a house-wide feed instead of no contextTreat omitted project scope and explicit empty scope as different requests.
The rendered packet exceeds the normal delivery limitThe pipeline removes detail and older content in stages; if the remaining block still cannot fit, the result is marked over budgetMeasure the complete rendered block, including health notices, and use full mode only when a wider delivery is intended.
The terminal banner reserve is omitted from a human preview budgetThe added terminal lines can push the hook output over its hard limit and replace the context with a preview stubReserve banner space before truncating the human presentation.
The newest session summary is older than the newest observationThe summary status block can describe stale session stateShow summary fields only when the summary is newer and has content.
A prior session identifier is from another platform or can escape its transcript directoryThe prior-message bridge can read the wrong transcript or expose unintended textResolve prior messages only for the supported transcript namespace and accept only safe session identifiers.
Platform source names are not normalized at the request boundaryValid records from one agent source can be filtered outNormalize source names before querying and pass the normalized value through each delivery path.
The packaged generator binds its project and concept filters in the wrong orderA packaged runtime request can return the wrong records or no recordsKeep generated query bindings aligned with the source selection rules.
The worker or shared server cannot answer during hook deliveryThe agent starts without the optional memory packetUse the bounded worker or server path and return a non-blocking empty result.
A context result is repeated as both model context and hook output for CodexCodex can discard the full session-start payload after it exceeds its output limitKeep the timeline in additionalContext and suppress the duplicate system message.
Facts are counted after a second JSON encodingRead-token savings are overstated and visible context economics do not match the reader's textCount facts in the stored text form returned by the context reader.
The packaged normal route exceeds its hook output limitThe route trims timeline records, so older context can be absent even when the database has matching recordsUse full mode for an intentional wider view and keep the packaged size guard aligned with its caller's limit.
Work-state entries from different effective project scopes are merged by list name aloneTasks and state from separate projects can appear as one listGroup entries by effective project scope and list name, then add the project label when names collide.
Work-state output reaches its section limit without an overflow markerThe agent can mistake a partial list for the complete current stateReserve room for the overflow line and direct the agent to work_state_read.
Closed-list filtering removes all task rows because the list state is closedOpen tasks inside that list disappear from session-start contextHide the closed state line but retain tasks whose own status is still open.
Work-state lists already shown in My Work are rendered again in session contextThe agent sees duplicate goals, rules, or focus guidance and spends budget on repeated textExclude the special My Work lists from the session-start work-state section.
Shared work-record lists are treated as session-start listsThe same shared work can appear twice or consume memory budget in the wrong sectionFilter shared work lists from the session-start work-state section.
The header points to a stale or unavailable rules-and-tools fileThe agent cannot find the timeline legend or the retrieval path for the references it seesRefresh the file when the header is rendered and continue safely if the write fails.

Key files

FileWhy to read it
src/…/ContextBuilder.tsMain flow from configuration and record selection to fitting, rendered text, runtime choice, and generation statistics.
src/…/ContextReadProtocol.tsDefines the typed boundary between context callers and the local read worker, including render, state, and search requests.
src/…/ContextReadWorkerClient.tsShows worker creation, typed request tracking, queue limits, timeout metadata and retirement, bounded termination, and failure recovery for context and search calls.
src/…/context-read-worker.tsShows the read-only worker operations used by context, state, project lookup, and keyword search.
src/…/ContextConfigLoader.tsMaps user settings and the active mode into context limits and display choices. It also prevents stale mode-specific IDs from filtering all records.
src/…/ObservationCompiler.tsDefines project and platform filtering, optional reinforcement ranking input, summary preparation, timeline ordering, and prior-message lookup.
src/…/ServerContextRows.tsReads the shared server corpus for server runtime and adapts observations and summaries to the common construction pipeline.
src/…/ContextBudget.tsDefines the character cap and the order used to reduce a packet while preserving a well-formed result.
src/…/TokenCalculator.tsExplains read-cost estimates and the relationship between selected context and recorded work cost.
src/…/TimelineRenderer.tsShows how the common timeline becomes compact or expanded observation entries.
src/…/WorkStateRenderer.tsDefines the session-start view of open work, state folding, shared-list and special-list exclusions, project-aware list grouping, and section overflow behavior.
src/…/HeaderRenderer.tsDefines the pointer that connects the startup packet to its rules and retrieval guidance.
src/…/PreviouslyRenderer.tsConnects the prior-session reply to the agent and human render paths.
src/…/RulesAndToolsFile.tsDefines the generated guidance file for reading the timeline and retrieving details.
src/…/AgentFormatter.tsDefines the compact model-facing observation, summary, prior-reply, and empty-state text shape.
src/…/HumanFormatter.tsDefines the terminal-oriented form and visible context economics.
src/…/ContextCacheService.tsKeeps learned session-start variants fresh, removes unsafe cached bodies, and coordinates cache use with writes and sync state.
src/…/SearchRoutes.tsDefines the worker requests that preview and inject generated context and delegates local reads to the context reader.
src/…/context.tsShows session-start scope checks, resume handling, server and worker selection, cache use, platform normalization, bounded delivery, notices, and model-context output.
plugin/…/context-generator.cjsProvides the packaged plugin route, including local read-only selection, full-view behavior, statistics, and hook-size trimming.
src/…/mcp-server.tsDefines the MCP request that returns the worker-mode session-start context.
src/…/context-injection.tsDefines the safe boundary for refreshing generated context in managed Markdown files.