Skip to content

clawdash: agent context visibility#173

Merged
mostlydev merged 2 commits intomasterfrom
issue-agent-context-visibility
Apr 22, 2026
Merged

clawdash: agent context visibility#173
mostlydev merged 2 commits intomasterfrom
issue-agent-context-visibility

Conversation

@mostlydev
Copy link
Copy Markdown
Owner

@mostlydev mostlydev commented Apr 17, 2026

Summary

End-to-end agent context visibility in clawdash. Operators can now see what each agent was compiled with, plus the exact system message cllama assembled for the most recent turn — captured from the real request flow, not reconstructed.

What's in scope

cllama (submodule bump to mostlydev/cllama#issue-agent-context-visibility):

  • ContextSnapshot struct + sync.Map per-agent store, captured after the real injection pipeline (memory recall → feeds → time → tools → model resolution) as a side effect of normal requests
  • Anthropic system preserved as string-or-block-array; managed-tool turns update TurnCount on loop completion
  • Two bearer-authed internal endpoints: GET /internal/context and GET /internal/context/<id>/snapshot

claw-api:

  • New agent.context verb + three endpoints: GET /agents, GET /agents/<id>/contract, GET /agents/<id>/context
  • Contract endpoint recursively redacts token, auth, and secret fields across metadata/feeds/tools/memory/service-auth before serving
  • Scope filtering via a composite pod-OR-claw_id-OR-service check so claw-api: self principals can reach their own service's agents
  • Live endpoint proxies through to cllama using the existing CLLAMA_UI_TOKEN

clawdash:

  • New /agents index and /agents/<id> detail page with Contract / Live tabs (nav link integrated across existing pages)
  • Minimalist live layout: inline meta strip (captured · format · requested → resolved), the assembled system message as the hero, dynamic inputs as a tagged ordered list with a cyan left rail (feed / memory / time / intervention). Supporting data (recent captures, tool schemas, raw snapshot) lives behind <details>

claw up:

  • Mounts .claw-runtime/context/ into claw-api and injects CLAW_CLLAMA_API_URL / CLAW_CLLAMA_API_TOKEN
  • Always creates a claw-dashboard principal when claw-api is injected, so the Agents UI works on every pod with claw-api (not just pods with invoke entries as before)
  • Emits the dashboard URL on success: [claw] dashboard: http://localhost:8082

audit:

  • ParseReader switched from bufio.Scanner to bufio.Reader — large context events no longer trip the 1 MiB token limit

Review notes

Design went through two rounds of Codex review before implementation — 9 findings addressed in the plan, then implemented. Design doc: docs/plans/2026-04-17-agent-context-visibility-design.md.

Closes #172

Test plan

  • go test ./... green
  • go vet ./... clean
  • Live preview validated end-to-end against a sample pod (contract + live tabs render, credential redaction verified, minimalist layout confirmed)
  • Deploy to live trading pod for real-world validation

Design plan for surfacing agent contracts and live assembled context
in clawdash via claw-api. Covers cllama snapshot capture, new API
endpoints, credential redaction, dashboard principal, and scope model.
Reviewed through two rounds of Codex review (9 findings addressed).
Adds end-to-end agent context inspection: operators can see each
agent's compiled contract (AGENTS.md, CLAWDAPUS.md, feeds, tools,
memory) plus the live system message cllama assembled for the most
recent turn.

- cllama: bumps submodule to capture a ContextSnapshot per agent and
  expose it via two internal UI endpoints.
- claw-api: new agent.context verb and three endpoints that read
  contract artifacts from the mounted context dir and proxy live
  snapshots from cllama. Credentials in metadata/feeds/tools/memory
  are recursively redacted before serving.
- clawdash: new /agents index and /agents/<id> detail page with
  contract + live-context tabs. Minimalist live layout — the
  assembled system message is the hero, dynamic inputs render as a
  tagged ordered list, supporting data lives in <details>.
- claw up: injects CLAW_CLLAMA_API_URL/TOKEN and the context-dir
  mount into claw-api; always creates a claw-dashboard principal so
  the Agents UI works on every pod with claw-api (previously only
  pods with invoke entries). Emits the dashboard URL on success.
- audit: switches ParseReader to bufio.Reader so large context
  events no longer trip the 1 MiB Scanner token limit.

Closes #172
@mostlydev mostlydev marked this pull request as ready for review April 22, 2026 20:46
@mostlydev mostlydev merged commit 0a421fe into master Apr 22, 2026
2 checks passed
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.

clawdash: agent context visibility (contracts + live assembled context)

1 participant