Context assistance broker and workspace workflows
Context assistance is an optional local service that prepares focused context for Guard reviews, supported AI apps, and selected execution flows. Its CIGAR engine is built into Guard, so the normal setup needs no Python or download. Guard controls which workspaces and sources are available. CIGAR finds relevant pages and returns cited results, while Guard keeps approval, access, and evidence decisions authoritative. See Context assistance and CIGAR integration for the wider service and artifact lifecycle, and CIGAR artifact installation and release for release identity and runtime status.
Service boundary
Context assistance separates context preparation from Guard enforcement. The native service owns availability and scope checks. The CIGAR bridge performs context work through a private local process and does not decide whether an action may run (src/…/native_context_assistance.py• L19-36, integrations/…/bridge.py• L1-5).
The service can be used in three broad ways:
- Guard prepares supporting context for an operator review.
- A paired AI app asks for context from an approved workspace.
- A native execution flow receives bounded context checks before a separate Guard decision.
Context is supporting data. It never grants command approval, changes policy, or proves that an action was delivered or executed (dashboard/…/workspace.tsx• L143-149, dashboard/…/review-panel.tsx• L106-114).
Actor and broker coordination
Context assistance actor
The context assistance actor is the single owner for a verified CIGAR runtime and its private state. Callers place bounded jobs on the actor instead of holding Guard policy or evidence locks while the external process works. This keeps service status responsive and makes cancellation and cleanup explicit (rust/…/actor.rs• L30-42, rust/…/actor.rs• L108-151).
The actor applies a finite queue and a short call deadline. A queued job that misses its deadline is abandoned. A job that already started with an unknown outcome closes that runtime generation rather than retrying a possible mutation (rust/…/actor.rs• L213-231, rust/…/actor.rs• L291-312).
References: rust/…/actor.rs• L30-42 rust/…/actor.rs• L108-151 rust/…/actor.rs• L213-231 rust/…/actor.rs• L291-312
Broker domains and clients
The broker is the context-sharing boundary between native Guard and CIGAR. A broker domain holds source revisions, cited documents, provenance, proposals, and optional private evidence storage. A client is a short-lived view of that domain with an explicit source set, a policy revision, and a lease. Public handles identify these capabilities but do not contain SDK credentials (rust/…/broker.rs• L39-118, rust/…/broker_clients.rs• L22-67).
The domain type determines what may be shared. Private graph and private broker use stay separate from shared broker access. Execution context uses a private domain with no agent sharing or saved storage. Shared app connections receive only the sources and note rights selected by the operator (rust/…/broker_domain.rs• L4-18, dashboard/…/workspaces-api.ts• L8-18).
The native side checks the broker handshake, source revisions, policy revision, lease, and response shape. If transport or validation makes the result uncertain, Guard retires the current generation instead of replaying a proposal or context mutation (rust/…/broker_domain.rs• L63-92, rust/…/broker_clients.rs• L164-190).
References: rust/…/broker.rs• L39-118 rust/…/broker_domain.rs• L4-18 rust/…/broker_domain.rs• L20-126 rust/…/broker_clients.rs• L22-67 rust/…/broker_clients.rs• L164-190 dashboard/…/workspaces-api.ts• L5-18
The main coordination path moves from operator-selected access to a cited result. This diagram shows the trust boundaries and the point where Guard remains in control.
sequenceDiagram
participant Operator
participant Dashboard
participant Guard as Native Guard service
participant Actor as Context actor
participant CIGAR
Operator->>Dashboard: Select workspace and sources
Dashboard->>Guard: Request scoped access
Guard->>Actor: Queue bounded broker job
Actor->>CIGAR: Compile context through private bridge
CIGAR-->>Actor: Cited context and ticket
Actor-->>Guard: Validate revisions and scope
Guard-->>Dashboard: Return context with citations
Dashboard-->>Operator: Show supporting context
Workspace selection and discovery
Workspace access
A workspace scope binds one project folder to one consumer and a selected set of sources. The dashboard can grant, refresh, withdraw, revoke, or clear that access. It can also include native Guard policy facts and a bounded window of recent native receipt facts when the selected settings allow them (dashboard/…/workspaces-panel.tsx• L77-103, dashboard/…/workspaces-panel.tsx• L124-160, dashboard/…/workspaces-api.ts• L5-18).
Project selection is optional for the built-in app integrations. CIGAR can use the project folder in which an AI app is open and add only the parts that match the prompt. The Projects view is the explicit control for choosing a folder and exact files. That choice is shared by the supported AI apps (dashboard/…/workspace-guide.tsx• L10-28, dashboard/…/tutorial-content.ts• L37-63).
The access flow is deliberately narrow. The operator chooses the folder and files when exact access is needed. Guard skips unsafe paths and sensitive material. A separate approval proof can be required before access is granted. A policy can turn a saved project off until it is added again. Turning the service off ends active access, while existing Guard approvals remain available (dashboard/…/workspaces-panel.tsx• L118-140, dashboard/…/workspaces-panel.tsx• L186-190, src/…/context_assistance_http.py• L65-84).
References: dashboard/…/workspace-guide.tsx• L10-28 dashboard/…/tutorial-content.ts• L37-63 dashboard/…/workspaces-panel.tsx• L19-25 dashboard/…/workspaces-panel.tsx• L77-103 dashboard/…/workspaces-panel.tsx• L118-190 dashboard/…/workspaces-api.ts• L5-18 src/…/context_assistance_http.py• L65-84
Agent and action discovery
Agent discovery reports whether the verified runtime can expose its context tool. Claude Code, Codex, Pi, and Oh My Pi use the built-in Guard integration. Other supported apps request a short-lived connection through Guard’s tool server and appear in the dashboard with a code. The operator matches that code, names the app, selects a project, and then authorizes the session (dashboard/…/tutorial-content.ts• L67-100, dashboard/…/agents-panel.tsx• L15-18).
Pairing links the session to a workspace scope and its selected files. If enabled, the operator can also allow the app to read approved shared notes or suggest new notes for review. A connection has a short lease and can be disconnected or turned down without changing the project itself (dashboard/…/agents-panel.tsx• L79-100, dashboard/…/agents-panel.tsx• L141-151, dashboard/…/workspaces-api.ts• L8-18).
The dashboard supports Guard review context for the dashboard itself and paired connections for supported AI apps. Native execution associations are a separate path. They provide context checks for captured actions but do not install an adapter or approve commands (dashboard/…/workspaces-panel.tsx• L130-140, dashboard/…/workspaces-panel.tsx• L189-190).
For a Guard review, the action flow uses an authenticated native decision association. It checks that the workspace, policy revision, decision identity, and allowed citations still match before showing context. The operator can refresh the context or verify its sources again. This links context to a native evaluation without turning context into an approval (dashboard/…/review-panel.tsx• L62-83, dashboard/…/review-panel.tsx• L106-118).
References: dashboard/…/tutorial-content.ts• L67-100 dashboard/…/agents-panel.tsx• L15-18 dashboard/…/agents-panel.tsx• L59-70 dashboard/…/agents-panel.tsx• L79-100 dashboard/…/agents-panel.tsx• L121-151 dashboard/…/workspaces-api.ts• L8-18 dashboard/…/workspaces-panel.tsx• L130-140 dashboard/…/workspaces-panel.tsx• L189-190 dashboard/…/review-panel.tsx• L62-83 dashboard/…/review-panel.tsx• L106-118
Context preparation
Context preparation turns a query and an authorized scope into a brief with excerpts, citations, source digests, and a policy revision. The project view lets the operator ask what a connected AI app would get. Guard checks the result against the current scope and source revisions before it reaches the dashboard or an app (dashboard/…/workspaces-panel.tsx• L122-123, dashboard/…/workspaces-panel.tsx• L148-157, dashboard/…/workspaces-api.ts• L20-25, dashboard/…/workspaces-api.ts• L139-145).
The dashboard labels a brief as checked when it was prepared and shows where each part came from. It keeps the last brief available for comparison after a new preparation or workspace change, while marking that older result as possibly out of date. It asks the user to prepare a fresh brief after a file or access change. The cited source list makes the result explainable without treating the selected text as a policy or execution record (dashboard/…/workspaces-panel.tsx• L165-183).
Review context adds a native decision association when a Guard approval request has one. A background check removes the prepared result if the runtime generation, policy facts, or source versions no longer match. The approval controls remain available because context is optional (dashboard/…/review-panel.tsx• L28-60, dashboard/…/review-panel.tsx• L94-114).
References: dashboard/…/workspaces-panel.tsx• L122-123 dashboard/…/workspaces-panel.tsx• L148-157 dashboard/…/workspaces-panel.tsx• L165-183 dashboard/…/workspaces-api.ts• L20-25 dashboard/…/workspaces-api.ts• L139-145 dashboard/…/review-panel.tsx• L28-60 dashboard/…/review-panel.tsx• L94-114
History, notes, and evidence
Prepared context history
History is a small local memory of prepared context. Each entry records the preparation time, snapshot and policy revisions, source versions, citations, and any native decision association. The operator selects an authorized workspace and app to load it. It records preparation only. It does not claim delivery, approval, or execution (dashboard/…/history-panel.tsx• L76-112).
When an operator opens an entry, Guard compares the recorded source versions with current access. It shows the old brief only when the required source access is still available. Changed or unavailable sources remain visible as such, so historical context cannot look current by accident (dashboard/…/history-panel.tsx• L113-137).
The history view also checks that context assistance remains enabled and that its runtime generation is unchanged while the list is open. If access changes or the runtime stops, it clears the active view and asks the operator to reload it (dashboard/…/history-panel.tsx• L31-60).
References: dashboard/…/history-panel.tsx• L31-60 dashboard/…/history-panel.tsx• L76-112 dashboard/…/history-panel.tsx• L113-137
Reviewed notes and proposals
Shared notes are a controlled source for paired connections. An app may read admitted notes only when the workspace grant allows it. It may propose note changes only when the operator also enables proposal rights. Proposals remain quarantined until the operator reviews and admits or rejects them (rust/…/broker_proposals.rs• L41-75, dashboard/…/notes-panel.tsx• L69-79).
Admission uses the proposal's expected notes revision and source basis. If the source files or notes changed, the proposal is stale and cannot be admitted. Admitted notes keep their upstream basis and provenance, so later context still shows what the notes depended on (rust/…/broker_proposals.rs• L87-109, rust/…/broker_proposals.rs• L242-306).
Notes are supporting evidence only. They do not approve commands. The operator can clear notes and proposals, revoke the connection, or remove workspace access (dashboard/…/notes-panel.tsx• L70-79, dashboard/…/notes-panel.tsx• L104-115).
References: rust/…/broker_proposals.rs• L41-75 rust/…/broker_proposals.rs• L87-109 rust/…/broker_proposals.rs• L242-306 dashboard/…/notes-panel.tsx• L69-79 dashboard/…/notes-panel.tsx• L104-115
Evidence persistence
Optional saved evidence preserves bounded context-related records across a service stop. It does not restore source access, app permissions, or execution authority. Guard can inspect, retain, remove, or repair this data without starting a verified context runtime (rust/…/context_assistance_service_data.rs• L1-3, rust/…/context_assistance_service_data.rs• L102-188, dashboard/…/saved-evidence.ts• L3-10).
Persistent broker evidence uses a private Guard-owned directory. The native side checks directory identity, ownership, links, file mode, and size before it allows the broker to use the store. Recovery restores evidence metadata only; fresh source authorization must rebuild the native view (rust/…/broker_storage.rs• L18-58, rust/…/broker_resume.rs• L49-61).
The Privacy view reports counts without showing source text, queries, paths, credentials, or approval tokens. It can clear past answers while keeping project access, remove saved notes and end current access, delete all context data and recent projects, start the service fresh, or download redacted diagnostics. Each destructive action leaves Guard approvals and records unchanged (dashboard/…/data-repair-panel.tsx• L26-35, dashboard/…/data-repair-panel.tsx• L39-58, dashboard/…/data-repair-panel.tsx• L97-121).
The data controls expose clear states such as saved, empty, busy, repair required, and unavailable. These states prevent a partial cleanup or an unknown write outcome from appearing as a clean result (dashboard/…/saved-evidence.ts• L12-36, dashboard/…/data-repair-panel.tsx• L124-175).
References: rust/…/context_assistance_service_data.rs• L1-3 rust/…/context_assistance_service_data.rs• L102-188 rust/…/broker_storage.rs• L18-58 rust/…/broker_resume.rs• L49-61 dashboard/…/data-repair-panel.tsx• L26-35 dashboard/…/data-repair-panel.tsx• L39-58 dashboard/…/data-repair-panel.tsx• L97-121 dashboard/…/data-repair-panel.tsx• L124-175 dashboard/…/saved-evidence.ts• L3-36
Operator controls and dashboard workspace
Operator controls
The local HTTP and CLI surfaces present native context state and route commands to the native service. They do not discover runtimes or decide availability in the presentation layer. The controls cover status, runtime checks, start, stop, workspace access, and connection management (src/…/context_assistance_http.py• L12-38, src/…/context_assistance_commands.py• L13-32).
High-risk access changes use the existing Guard approval gate. Stop and data-removal paths remain available as access-reduction controls. A stop cancels context work and persists opt-out without removing unrelated Guard approvals (src/…/context_assistance_http.py• L65-84, src/…/context_assistance_commands.py• L19-27, rust/…/context_assistance_service_data.rs• L129-170).
References: src/…/context_assistance_http.py• L12-38 src/…/context_assistance_http.py• L65-84 src/…/context_assistance_commands.py• L13-32 rust/…/context_assistance_service_data.rs• L129-170
Settings and runtime readiness
The settings surface separates a saved request to use CIGAR from proof that the built-in engine is ready. Status is accepted only when its availability, generation, runtime facts, capabilities, and effective settings agree. The dashboard therefore treats ready as a live readiness result, not as evidence that a preference was saved (dashboard/…/status.ts• L83-129, dashboard/…/types.ts• L49-72).
The main settings control context size, review briefs, AI-app context, selected workspace documents, shared app context, native policy facts, execution context, and evidence storage. Project files reach prompts only when both AI-app context and workspace-document access are enabled. An untouched setup turns on those two choices when the operator uses the one-click action. Later choices remain unchanged (dashboard/…/settings-controls.tsx• L108-171, dashboard/…/one-click.ts• L218-225).
Turning on CIGAR runs a short safety check and then starts the engine built into Guard. Opening the page reads native metadata only. A click is required before setup work starts. The flow can ask for one approval, follows the resulting job, resumes a recent prepared job, and gives Stop priority over later setup steps (dashboard/…/one-click-setup.tsx• L27-69, dashboard/…/use-one-click.ts• L65-126, dashboard/…/use-one-click.ts• L131-229).
References: dashboard/…/status.ts• L83-129 dashboard/…/types.ts• L49-72 dashboard/…/settings-controls.tsx• L108-171 dashboard/…/one-click.ts• L218-225 dashboard/…/one-click-setup.tsx• L27-69 dashboard/…/use-one-click.ts• L65-126 dashboard/…/use-one-click.ts• L131-229
Runtime update jobs
The Updates view is a record of CIGAR selection work that Guard is running, has prepared for approval, or stopped partway. CIGAR is built into Guard, so this view does not download an engine or offer a general version picker. It shows native job state and gives the operator refresh, stop, commit, or cleanup controls (dashboard/…/versions-panel.tsx• L26-44, dashboard/…/versions-data.ts• L5-11).
Selection work is split into preparation and commit. Guard checks the expected generation and current selection before commit. A switch may pause context access and require the operator to reconnect sources and apps. A failed or interrupted job stays visible until Guard finishes or undoes its partial work (dashboard/…/versions-actions.ts• L4-13, dashboard/…/versions-jobs-panel.tsx• L41-66).
The dashboard does not resend a mutation after an unknown submit result. It refreshes the job by ID and marks busy, failed, recovery-required, and completed states separately. This lets the operator recover without treating an uncertain change as safe to repeat (dashboard/…/one-click.ts• L168-215, dashboard/…/versions-api.ts• L46-70, dashboard/…/versions-jobs.ts• L35-75).
References: dashboard/…/versions-panel.tsx• L26-44 dashboard/…/versions-data.ts• L5-11 dashboard/…/versions-actions.ts• L4-13 dashboard/…/versions-jobs-panel.tsx• L41-66 dashboard/…/one-click.ts• L168-215 dashboard/…/versions-api.ts• L46-70 dashboard/…/versions-jobs.ts• L35-75
Dashboard workspace
The dashboard presents context assistance as one workspace with Home, Projects, Settings, Updates, Usage, Privacy, and Guide sections. The selected section is reflected in the URL, which lets links reopen the same view. The workspace keeps service status and the stop control available while the operator moves between views (dashboard/…/workspace.tsx• L32-49, dashboard/…/workspace.tsx• L71-89, dashboard/…/workspace-model.ts• L3-11).
The normal operator flow is:
- Open CIGAR and verify its status.
- Click Turn on CIGAR when the engine is off. Guard checks and starts the built-in engine.
- Allow project files if prompts should receive matching project content. Add a project in Projects only when exact file control is needed.
- Use the dashboard review flow, a built-in AI-app integration, a paired app, or a supported execution consumer.
- Prepare cited context or pair an app connection.
- Refresh, narrow, or revoke access when sources, policy, or the runtime generation changes.
The Guide explains the first brief, optional app pairing, and native execution context. Privacy shows what CIGAR holds and provides repair and removal actions. These views describe context state and do not change Guard's own approvals or records (dashboard/…/tutorial-content.ts• L24-129, dashboard/…/data-repair-panel.tsx• L177-199).
The page keeps the boundary clear: CIGAR helps find and explain context, while Guard still decides what an AI may do. The workspace also reports when a project was turned off by policy and when its bounded receipt window missed recent decisions. Those notices describe the context view and do not change Guard's own records (dashboard/…/workspace.tsx• L71-83, dashboard/…/workspaces-panel.tsx• L118-190).
References: dashboard/…/workspace.tsx• L32-49 dashboard/…/workspace.tsx• L71-89 dashboard/…/workspace-model.ts• L3-11 dashboard/…/tutorial-content.ts• L24-129 dashboard/…/data-repair-panel.tsx• L177-199 dashboard/…/workspaces-panel.tsx• L118-190
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the native workspace request, daemon route, dashboard parser, and data-role contract aligned. A route can otherwise accept a result that the dashboard must reject.
- Keep scope identity, app identity, policy revision, source revisions, and broker leases aligned across workspace grants, agent sessions, prepared briefs, history, and proposals.
- Keep private graph, private broker, shared broker, and execution domains separate. Execution context must not gain shared agents, saved storage, or command approval.
- Preserve the distinction between a context result, a Guard decision, an approval grant, and execution evidence in UI labels and API schemas.
- Keep proposal basis revisions and provenance with admitted notes. Do not admit a proposal after its source files or current notes have changed.
- Keep actor queue, deadline, cancellation, and generation checks aligned. Do not retry a dispatched operation with an unknown outcome.
- Keep one-click setup, status readiness, effective preferences, and the built-in engine contract aligned. Reading metadata must not start work, and a saved preference must not be shown as ready.
- Keep update-job preparation, commit generation, reconnect acknowledgement, cancellation, and recovery states aligned. Do not expose a stale commit action.
- Keep data removal available when the runtime is off, and ensure recovery restores data only after fresh source authorization.
- Keep the bridge private and credential-free at the HTTP, CLI, browser, and MCP result boundaries.
- Keep the seven dashboard section names and URL mapping aligned. Retired section links must resolve to a safe current section.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The actor queue is full or a context call misses its deadline. | The request is refused or the runtime generation is retired. | Use bounded queues and deadlines. Do not replay an operation whose outcome is unknown. |
| A workspace source, policy revision, or runtime generation changes during preparation. | The brief or history entry is stale. | Recheck scope and revisions before returning context. Ask the operator to refresh or grant access again. |
| CIGAR is off, resting, or not yet verified. | Prompts receive no extra files, or setup cannot start from the saved preference. | Show the live status and use the one-click check before activation. Guard protection continues. |
| Only one of AI-app context and workspace-document access is enabled. | CIGAR runs but prompts receive no project files. | Keep the two effective settings distinct and explain the missing setting on Home. |
| A one-click setup request loses its reply. | The engine may still be starting, so a second request could duplicate a mutation. | Follow the job or live status by ID. Never resend an uncertain submit. |
| CIGAR starts while the dashboard is listing projects. | Saved folders are temporarily read-only, or a failed list may show a start message instead of an empty project list. | List again after the runtime is ready. Do not allow folder changes until then. |
| A prepared update no longer matches the live generation. | The operator could commit an old selection. | Recheck the generation and current selection. Require cleanup for a partial job. |
| A pending note proposal has changed source basis or notes revision. | Admission could apply text to the wrong evidence. | Show source states and allow admission only when the current sources are unchanged. |
| The bounded receipt window misses recent Guard decisions. | CIGAR starts its decision notes fresh, while the Guard records stay unchanged. | Show the missed-decision notice and treat the window as context support, not full history. |
| A paired connection lacks its private credential or its lease expires. | The app cannot use the workspace scope. | Authenticate each session with its private credential and require a new pairing when the lease ends. |
| Saved evidence cannot be reconciled or its private store fails checks. | Context data may be unavailable or cleanup may remain incomplete. | Show repair-required or unavailable state. Remove saved data before starting fresh. |
| A result does not match its declared schema, role, scope, or citations. | The dashboard could show untrusted context. | Reject the result and keep Guard's protection and approval paths available. |
| Context assistance is stopped or unavailable. | Context features stop, but Guard approvals and enforcement continue. | Keep context optional and expose stop, retry, and data-repair controls. |
Key files
| File | Why to read it |
|---|---|
| rust/…/actor.rs | Defines the bounded actor that owns the verified CIGAR runtime and its lifecycle. |
| rust/…/broker.rs | Defines broker domains, source records, revisions, proposals, and retained context handles. |
| rust/…/broker_clients.rs | Shows scoped client leases, context compilation, citations, and stale-source checks. |
| rust/…/broker_proposals.rs | Shows proposal quarantine, review, admission, rejection, and provenance. |
| rust/…/broker_storage.rs | Shows the private storage boundary for persistent broker evidence. |
| rust/…/context_assistance_service_workspace.rs | Coordinates authenticated workspace requests with the actor and generation fences. |
| rust/…/context_assistance_agents.rs | Defines pending and authorized AI-app sessions and their private credentials. |
| rust/…/context_assistance_service_data.rs | Defines offline data inspection, retention, and removal controls. |
| integrations/…/bridge.py | Shows the private bridge between native Guard and CIGAR graph and broker operations. |
| integrations/…/broker_client.py | Shows the scoped client operations available to a paired connection. |
| dashboard/…/settings-controls.tsx | Shows the high-level feature, source, storage, and readiness controls. |
| dashboard/…/one-click.ts | Defines the safe setup plan and job-following rules for turning CIGAR on. |
| dashboard/…/workspaces-panel.tsx | Shows workspace selection, source grants, context preparation, notices, and operator controls. |
| dashboard/…/agents-panel.tsx | Shows app discovery, project selection, note-sharing choices, authorization, and revocation. |
| dashboard/…/action-api.ts | Defines the link between prepared context and an authenticated native decision. |
| dashboard/…/history-panel.tsx | Shows bounded prepared-history selection, generation checks, and source-state comparison. |
| dashboard/…/notes-panel.tsx | Shows shared-note proposal review and operator admission controls. |
| dashboard/…/review-panel.tsx | Shows optional decision context and live source authorization checks. |
| dashboard/…/data-repair-panel.tsx | Shows privacy counts, diagnostics, reset paths, and data-removal controls. |
| dashboard/…/versions-panel.tsx | Shows native CIGAR update jobs, approval, cancellation, and recovery. |
| dashboard/…/versions-jobs.ts | Defines the job states and safety data used by update controls. |
| dashboard/…/workspace-guide.tsx | Explains prompt matching, skipped files, and the optional project-selection model. |
| dashboard/…/tutorial-content.ts | Defines the operator journeys for briefs, app pairing, and execution context. |
| dashboard/…/workspace.tsx | Defines the dashboard context-assistance workspace and its operator-facing flow. |
| src/…/context_assistance_http.py | Maps local HTTP routes to native status, workspace, and control operations. |