Skip to content

feat: governed agent architecture (ADR-0036)#83

Open
nerdsane wants to merge 13 commits intomainfrom
feat/temper-claw
Open

feat: governed agent architecture (ADR-0036)#83
nerdsane wants to merge 13 commits intomainfrom
feat/temper-claw

Conversation

@nerdsane
Copy link
Owner

Summary

  • Governed Agent Architecture (ADR-0036): Implements a full agent runtime as governed Temper specs — session tree storage (JSONL append-only with branching), context compaction, two-loop steering (CheckSteering/ContinueWithSteering/FinalizeResult), and event streaming
  • New entity types: AgentSoul, AgentSkill, AgentMemory, ToolHook, CronJob, CronScheduler, HeartbeatMonitor, Channel, AgentRoute, ChannelSession — each with IOA specs, CSDL schemas, Cedar policies, and WASM integration modules
  • Subagent + coding agent management: Entity-to-entity spawning via OData, CLI process management (Claude Code, Codex) via sandbox bash
  • Shared libraries: session-tree-lib (JSONL tree data structure), wasm-helpers (TemperFS I/O, field extraction, URL resolution)
  • Channel system (os-apps/temper-channels/): Webhook/Discord/Slack channel entities with route resolution, session tracking, and reply delivery
  • Code review fixes: Extracted duplicate helpers into shared crate, server-side OData filtering for ChannelSessions, real timestamp comparison in heartbeat scan, Cedar policy for agent self-memory management

New OS Apps

App Entities WASM Modules
temper-agent TemperAgent (extended), AgentSoul, AgentSkill, AgentMemory, ToolHook, CronJob, CronScheduler, HeartbeatMonitor llm_caller, tool_runner, sandbox_provisioner, steering_checker, context_compactor, heartbeat_scan, cron_trigger, cron_scheduler_check, cron_scheduler_heartbeat, heartbeat_scheduler, coding_agent_runner
temper-channels Channel, AgentRoute, ChannelSession channel_connect, route_message, send_reply

Test plan

  • cargo test --workspace passes (all gates green)
  • cargo clippy clean
  • rustfmt check passes
  • Readability ratchet within baseline
  • E2E proof run against live server (proof harness script at scripts/temper_agent_e2e_proof.py)

🤖 Generated with Claude Code

rita-aga and others added 13 commits March 24, 2026 09:19
Add Discord Gateway WebSocket transport that receives DMs and routes them
through TemperAgent entities. Per-user sessions track TemperFS conversation
file IDs so follow-up messages Resume with full history instead of starting
fresh.

Infrastructure additions:
- Internal blob storage (Turso-backed) for TemperFS content-addressed files
- Secrets vault always-on with ephemeral key fallback
- Auto-seed secrets (anthropic_api_key, sandbox_url, temper_api_url, blob_endpoint)
- Local sandbox auto-start (spawns local_sandbox.py on port+10)
- --discord-bot-token CLI flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	crates/temper-server/src/state/dispatch/wasm.rs
#	os-apps/temper-agent/specs/model.csdl.xml
#	os-apps/temper-agent/specs/temper_agent.ioa.toml
#	os-apps/temper-agent/wasm/llm_caller/src/lib.rs
#	os-apps/temper-agent/wasm/sandbox_provisioner/src/lib.rs
#	os-apps/temper-agent/wasm/tool_runner/src/lib.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use floor_char_boundary() instead of raw byte slicing to prevent
panics on multi-byte characters (emoji, CJK) at split boundaries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Session tree integration: save session_file_id/session_leaf_id from
  completed entities, append to JSONL session tree for follow-ups,
  fall back to legacy conversation file when session tree unavailable
- Bot online presence: send presence in IDENTIFY + opcode 3 after connect
- Vault integration: resolve bot token from vault as fallback, seed
  CLI/env token into vault, clear startup diagnostics
- Hardcoded cleanup: extract DISCORD_API_BASE and INTERNAL_PRINCIPAL_KIND
  constants, replace all hardcoded URLs and headers
- UTF-8 safety: use floor_char_boundary() in truncate/split_message
- Add PresenceUpdate opcode, PresenceUpdateData, PresenceActivity types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the WASM sandbox_provisioner fails to create a session tree, the
Discord transport now creates one from the legacy conversation file
after the first agent completes. This enables the session tree path
for follow-ups, which is required for context compaction.

Also guards against empty LLM results that cause Discord 400 errors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
User sessions (conversation_file_id, session_file_id, workspace_id,
etc.) are now serialized to a discord-sessions.json File in TemperFS
after every session update. On startup, the transport queries TemperFS
for this file and restores all sessions, enabling conversation
continuity across server restarts.

Flow:
- Startup: query Files by name → read JSON → populate user_sessions
- After each agent completion: write updated sessions map to TemperFS
- Sessions keyed by Discord user ID, scoped to tenant

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants