Skip to content

feat(runtime): stabilize context, interactions, compaction, and capabilities - #398

Draft
Haz3-jolt wants to merge 5 commits into
Observal:mainfrom
Haz3-jolt:hari/obs-896-capability-prompt-foundation
Draft

Haz3-jolt wants to merge 5 commits into
Observal:mainfrom
Haz3-jolt:hari/obs-896-capability-prompt-foundation

Conversation

@Haz3-jolt

@Haz3-jolt Haz3-jolt commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Purpose

Stabilize the daemon-owned model context and complete runtime capabilities that every client can project consistently:

  • expose only the active profile-aware tool roster while loading hierarchical project instructions deterministically
  • add typed user questionnaires with canonical interaction lifecycle events for TUI and web clients
  • add proactive deterministic compaction, one bounded provider-overflow recovery, and queued manual compaction during active responses
  • add daemon-owned BM25 capability discovery, Agent Skills, session-persistent activation, and progressively disclosed daemon command tools

Fixes

Approach

  • Keep prompt construction, resource discovery, capability indexing, activation, interaction ownership, and compaction decisions in the daemon and kernel.
  • Discover AGENTS.md from the nearest Git repository root through the session working directory, prefer same-directory AGENTS.override.md, and reject invalid or escaping resources.
  • Record exact loaded-resource snapshots canonically, project them through the SDK, retain them across restart, and rediscover them only on /reload.
  • Add strict protocol contracts for questionnaires, compaction, and capability search, activation, denial, and resource reads.
  • Build one deterministic BM25 index over compact capability metadata. Load full Skill bodies and referenced resources only after activation.
  • Discover global Skills from ~/.axl/skills/ and ~/.agents/skills/, plus hierarchical project .axl/skills/ and .agents/skills/ directories.
  • Keep activated Skills and tool schemas available for the rest of the session and restore them from canonical events after restart.
  • Derive model-callable compact_context and reload_context tools from the authoritative daemon command registry rather than a parallel runtime list.
  • Keep slash commands out of Bash and direct model requests for hidden operations through capability discovery.
  • Compact before model requests when the configured token boundary is crossed, including between tool rounds. Retry one classified provider overflow only before output is exposed.
  • Preserve complete tool groups, split-turn context, cumulative read and modified file tracking, steering and follow-up ordering, and the authoritative JSONL history.
  • Advance the wire protocol from 17 to 21. The persisted event format remains version 1.

How was this tested?

  • pnpm check: passed with 947 tests passed and 8 environment-dependent sandbox tests skipped.
  • uvx reuse lint: passed with 590 of 590 files carrying copyright and license information.
  • pnpm audit --audit-level high: passed with no known vulnerabilities.
  • git diff --check: passed.
  • Live Anthropic testing passed for hierarchical instruction precedence, override rediscovery through /reload, canonical restart preservation, and post-restart reload.
  • Live Azure OpenAI Responses testing passed for BM25 Skill discovery, recursive Skill activation, containment-checked resource reads, session-persistent activation, dynamically exposed daemon command tools, context reload, and restoration after a real daemon restart.
  • The exact prompt can you run /reload searched for tool:reload-context, activated it, called reload_context, and produced a logged reload boundary.
  • The sandboxed Observal flow confirmed that global Skill resources are readable only through the capability broker. Host-installed CLI execution remains intentionally unavailable inside the current sandbox.
  • UI screenshots are not attached to this draft and must be added before marking it ready for review.

Learning

  • Used the Agent Skills and AGENTS.md conventions as interoperability references while keeping discovery daemon-owned.
  • Reviewed OpenCode's Skill implementation at revision 1364769e516289bcd805dd813c36e68391858ab9 as a read-only behavioral reference. Axl retains bounded search rather than embedding the complete Skill catalog.
  • Reviewed Pi 0.85.0 compaction documentation and regression behavior as a read-only behavioral reference. The Axl implementation follows its own protocol and architecture boundaries.
  • Capability activation works best as session state: discover once, activate once, and retain the exact canonical content and tool binding until the session ends.
  • Model-callable daemon commands must derive from the authoritative command registry rather than a second hardcoded capability inventory.

Checklist

  • I reviewed the complete diff.
  • I added or updated the smallest relevant test for behavior changes.
  • I ran the relevant formatting, lint, type-check, test, boundary, and license checks.
  • Every new file has SPDX metadata, directly or through REUSE.toml.
  • Every commit has a matching DCO Signed-off-by trailer.
  • UI changes include screenshots attached to the pull request, not committed to the repository.

AI assistance

  • Generative AI materially assisted this change. Tool and model/version: pi coding agent; the model/version was not exposed to the session.
  • I manually reviewed, understood, and tested the generated work.

Keep AGENTS.md instructions in a structured stable prompt, remove optional Skills and MCP activation, and expose the intended core tool roster with explicit pending interaction and capability-search tools.

Signed-off-by: Hari Srinivasan <harisrini21@gmail.com>
Add strict questionnaire contracts and daemon-owned interaction handling across the runtime and SDK. Render the same canonical requests as stepped flows in the TUI and web clients, with durable session eligibility and restart-safe cancellation.

Signed-off-by: Hari Srinivasan <harisrini21@gmail.com>
Compact before model requests using configurable token budgets and retry one
classified provider overflow before output is exposed. Preserve split-turn
context, cumulative file tracking, and cache-safe summaries.

Record queued and active compaction lifecycle state canonically, reconcile
interrupted work after restart, and let TUI and web clients queue manual
compaction behind an active response.

Signed-off-by: Hari Srinivasan <harisrini21@gmail.com>
Discover AGENTS.md files from the repository root to the session directory,
apply same-directory overrides, and reject invalid or escaping resources.

Record exact resource snapshots canonically, project them through the SDK,
preserve them across restart, and rediscover them on explicit reload.

Signed-off-by: Hari Srinivasan <harisrini21@gmail.com>
Signed-off-by: Hari Srinivasan <harisrini21@gmail.com>
@Haz3-jolt Haz3-jolt changed the title feat(runtime): stabilize context, interactions, and compaction feat(runtime): stabilize context, interactions, compaction, and capabilities Sep 16, 2026
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.

1 participant