ce-ai Ideation: Leveraging SKILL.state for Long-Horizon Agent Skills

Translating the runtime architecture from arXiv:2608.26263v2 into highly executable capabilities for ce-ai and Compound Engineering.

Ranked & Refined
Date 2026-09-01
Topic skill-state-integration
Mode repo-grounded
Focus Hint arXiv:2608.26263v2 SKILL.state runtime

Grounding Context

Codebase Architecture (ce-ai)

ce-ai is a fast Rust CLI orchestrating the 7-stage Compound Engineering lifecycle across 10 native AI harnesses (OpenCode, Claude, Antigravity, Cursor, Pi, Codex, etc.). Crucially, ce-ai is an orchestrator/governor, not the LLM inference runtime.

  • src/state/state.rs: Atomic state.json I/O and FSM workflow stage tracking.
  • src/commands/workflow.rs: FSM checkpointing, status queries, and stage resumption.
  • src/commands/skills.rs: Skill registry, installation, and harness distribution.
  • src/commands/doctor.rs & sync.rs: SHA256 manifest drift detection and health verification.

Key Findings from arXiv:2608.26263v2

SKILL.state (Badhe et al. 2026) replaces append-only conversational history with an explicit, mutable execution state:

  • Step Execution: (P, Σt, Ot) → (Rt, ΔΣt, at).
  • Discarded CoT: Reasoning Rt is discarded immediately after validating the state patch Σt+1 = Σt ⊕ ΔΣt.
  • Bounded Prompt: O(1) prompt footprint per step; O(T) cumulative token complexity (up to 16.2× token reduction at T=100).
  • Drift & Noise Resilience: 0-step recovery upon external environment drift; immunity to background telemetry context poisoning.

Topic Axes

The integration surface of SKILL.state into ce-ai decomposes across five orthogonal dimensions:

1. Deterministic State Validation
Zero-drift state recovery, manifest synchronization, and instant world-model alignment.
2. Git & CI Telemetry State
Transforming verbose build and test outputs into structured state deltas before agent context ingestion.
3. Skill Schema & Prompt Protocol
Declarative state schemas authored in SKILL.md frontmatter and distributed to harnesses.
4. Workflow Loop Execution
Skill-level behavioral conventions for long-horizon Stage 4 (TDD and compiler fix iterations).
5. Multi-Agent Coordination
Blackboard state architecture with concurrent write coordination (treated as a focused design spike).

Ranked Ideas (Pragmatic & Executable Ordering)

1

Zero-Step Environment Drift Recovery via Live RepoState Sync

Axis: Deterministic State Validation
Top Pick Conf: 96% Complexity: Low-Med

Connect doctor.rs and sync.rs SHA256 manifest diffing directly to ce-ai workflow resume. When human developers make git commits, edit files, or switch branches outside the agent's turn, conversational agents hallucinate for 5–8 turns because obsolete chat history overpowers reality. ce-ai computes a live RepoState projection upon invocation that injects a canonical ground-truth state update, achieving the paper's proven 0-step recovery without touching LLM inference internals.

Drift Recovery: 5-8 Turn Conversational Hallucination vs 0-Step Manifest Injection
Standard Agent: Stale History Hallucination User renames file on disk → Agent misses drift Turns 1-5: Hallucinates old path from chat logs Turn 6+: Finally recovers after repeated errors ce-ai RepoState Sync: 0-Step Ground-Truth doctor.rs / sync.rs computes SHA256 diff in <10ms workflow.rs resume injects canonical Σt Agent acts on true state immediately (0 lag turns)
Basis (External + Direct)
external: arXiv:2608.26263v2 §5.4 (Table 3) documents that history-based runtimes waste 5–8 turns recovering from environment drift, while explicit state updates achieve instant 0-turn recovery.
direct: src/commands/doctor.rs and src/commands/sync.rs already have robust SHA256 manifest and filesystem drift calculation; connecting this to workflow.rs requires minimal new code.
Why It Matters
Delivers the highest immediate value with minimal risk. Eliminates developer frustration when switching branches or making manual edits while working with an AI agent.
Downsides & Tradeoffs
Requires lightweight git status / file hashing check during workflow resumption (easily kept under 20ms in Rust).
2

Noise-Filtered Output Projections for Git & CI Telemetry

Axis: Git & CI Telemetry State
Conf: 92% Complexity: Low-Med

Implement deterministic output filters and distillers in ce-ai for command execution during Stage 5 (Verification) and Stage 7 (Shipping). Instead of dumping 500 lines of raw compiler warnings, cargo check logs, or gh pr checks polling telemetry into the agent context, ce-ai parses tool output into a clean structured summary (failing assertions, blocking jobs, specific line numbers) before it reaches the agent context.

Basis (External + Direct)
external: arXiv:2608.26263v2 §5.3 proves that standard ReAct agents drop from 0.68 to 0.53 task accuracy under background telemetry noise, whereas state-based noise filtering preserves ≥0.97 accuracy.
direct: Hard-Gate Invariant 2 and Stage 7 shipping workflows mandate running gh pr checks --watch and CI matrix gates, which generate high volumes of distractor logs.
Why It Matters
Pure output transformation before context ingestion. Requires zero control over the harness's LLM loop, making it 100% shippable and universally beneficial across all 10 harnesses.
Downsides & Tradeoffs
Requires maintaining parsers for common tool outputs (cargo, npm, pytest, gh CLI), though standard regex-based error extraction covers >90% of cases.
3

Declarative SKILL.state Schemas in Skill Frontmatter

Axis: Skill Schema & Prompt Protocol
Conf: 90% Complexity: Low-Med

Define formal execution state schemas in the YAML frontmatter of SKILL.md files in compound-engineering-plugin (e.g. ce-work, ce-debug, ce-optimize). ce-ai validates these schemas at skill installation and sync time, providing standard state templates that tell agents exactly what state fields to track in external files rather than accumulating conversational clutter.

Basis (External + Direct)
external: arXiv:2608.26263v2 §3.1 proves that static 5-field domain schemas can generalize across hundreds of diverse real-world tasks without per-task tuning.
direct: src/commands/skills.rs already manages skill distribution and validation; adding YAML frontmatter schema parsing is a clean additive change.
Why It Matters
Acts as the foundation for stateful agent behavior. Provides explicit structure so that skills instruct agents to maintain a local .ce-state.json instead of relying on prompt memory.
Downsides & Tradeoffs
Requires upstream updates to skill definitions in compound-engineering-plugin.
4

SKILL.state Behavioral Convention for Long-Horizon Stage 4 TDD Loops

Axis: Workflow Loop Execution
Conf: 85% Complexity: Low

Reframe the Stage 4 TDD loop as a skill-level behavioral convention rather than an impossible engine-level prompt interceptor. ce-work instructs the agent to maintain an explicit local state file (e.g. .ce-tdd-state.json with failing_tests, tested_hypotheses, active_lints) and explicitly consult and overwrite this state file during multi-step bugfixing rather than replaying past trial-and-error reasoning in conversational memory.

Basis (External + Direct)
external: arXiv:2608.26263v2 demonstrates that explicit state tracking prevents hypothesis repetition in Linux bash CTF challenges (+7.8 points pass@1).
direct: Reframing from a CLI runtime wrapper to a skill instruction pattern respects the reality that ce-ai orchestrates third-party harnesses without controlling their internal token loops.
Why It Matters
Achieves >80% of the cognitive benefit of SKILL.state (structured memory, no repeated failed attempts) purely through prompt guidance and file conventions.
Downsides & Tradeoffs
Relies on agent adherence rather than deterministic engine enforcement (though OpenSpec and AGENTS.md rules provide strong compliance guardrails).
5

Design Spike: Multi-Agent Shared Blackboard with Concurrency Control

Axis: Multi-Agent Coordination
Spike Needed Conf: 80% Complexity: High

Initiate a focused architectural spike to design a shared state blackboard for parallel subagents (e.g. ce-ideate, ce-code-review). Currently, write_atomic in src/state/mod.rs is a simple tempfile+rename without locking or concurrency controls. This spike will design a lock-safe patch merge mechanism (supporting null-deletion and conflict resolution) for multi-agent workflows.

Basis (External + Direct)
external: arXiv:2608.26263v2 §7 notes that multi-agent explicit state requires deterministic conflict-resolution semantics in the merge operator ⊕.
direct: src/state/mod.rs:38 uses tempfile rename, which guarantees atomic POSIX writes but can silently clobber concurrent writers without file locking or transactional merges.
Why It Matters
Prevents premature implementation of a naive multi-agent blackboard that would suffer race conditions, setting up a solid foundation for future parallel agent scaling.
Downsides & Tradeoffs
Requires designing file-locking / CRDT-like merge semantics across platforms (Unix flock vs Windows LockFileEx).
6

Redux-Style Pure Reducer Architecture for 7-Stage FSM Resumption

Axis: Workflow Loop Execution
Conf: 86% Complexity: Low

Re-architect src/commands/workflow.rs around a deterministic pure reducer pattern (State, Action) → State. Every user action, agent transition, and checkpoint becomes a discrete serializable action object. When resuming a session across different harnesses (e.g. starting in Claude Code and switching to Antigravity CLI), the target harness receives the compiled state snapshot without needing any chat history translation.

Basis (Reasoned + Direct)
reasoned: Pure reducer architectures provide mathematical determinism and lossless state reconstitution across disparate UI/agent clients.
direct: src/state/state.rs already uses atomic writes and serde serialization; refactoring transition methods into pure reducer functions requires minimal architectural disruption.
Why It Matters
Enables seamless cross-harness portability and flawless crash recovery across all 10 supported agent harnesses.
Downsides & Tradeoffs
Purely an architectural refactor for the Rust orchestrator; does not directly reduce LLM token usage by itself without companion skill changes.

Rejection Summary

Candidates evaluated during divergent ideation and adversarial filtering that were cut, along with their specific rejection rationales:

Candidate Idea Frame Rejection Rationale
Engine-Level Prompt Interception Loop Inversion & Removal Scope mismatch / unrealistic; ce-ai is a CLI orchestrator across 10 third-party harnesses and cannot intercept native inference loops. Reframed as Idea 4 (Skill-Level Convention).
Sufficient-Statistic Memory vs. RAG Assumption-breaking Duplicates stronger ideas; already incorporated into Idea 3 (Declarative Schemas) and Idea 2 (Telemetry State).
Git Object DAG for Agent State Transitions Cross-domain Analogy Too expensive relative to likely value; full content-addressed DAG storage adds unnecessary disk I/O compared to simple JSON state snapshots.
Strict 4k Token Context Window Constraint Constraint-flipping Below ambition floor; modern production models already have ≥128k context windows. The real bottleneck is context pollution and quadratic cost, not artificial 4k constraints.
1,000-Step Autonomous Coding Sessions Constraint-flipping Too vague and ungrounded; represents an aspirational vision rather than an actionable CLI or skill implementation unit.
LLMLingua Perplexity History Compressor Inversion & Removal Refuted by paper findings: arXiv:2608.26263v2 §5.6 shows statistical compression drops accuracy to 0.22 by destroying critical structured slot dependencies.