Files
freemo 5a24b5bdf2 docs(skill): add cleveragents-spec skill from docs/specification.md
New skill covering every architectural concept, entity, workflow, CLI
command, and design decision from docs/specification.md (47,181 lines
read in full). Explains WHAT the system is intended to build.

SKILL.md (1,282 lines) — 18 decision trees:
- 'What am I working on?' master routing tree
- 'What is a Plan?' — 4 phases, reversion rules, hierarchy, decision tree
- 'How does a plan run?' — step-by-step Action→Strategize→Execute→Apply
- 'What is a Decision?' — 10 types, data model, dual tree+DAG structure,
  timing by phase, decision recording protocol
- 'How do I correct a plan?' — revert vs append modes, Strategize vs
  Execute correction mechanics, affected subtree computation
- 'What is an Invariant?' — 4 scopes, precedence chain (plan>action>
  project>global), non-overridable globals, Invariant Reconciliation Actor
- 'What is an Actor?' — LLM vs graph types, Jinja2+env-var preprocessing,
  specialized roles (strategy/execution/estimation/invariant)
- 'What is a Tool?' — 4 sources, capability metadata, 4-stage lifecycle,
  resource bindings and slots, anonymous tools, metadata overrides
- 'What is a Validation?' — Tool subtype, always read-only, required vs
  informational modes, 3 attachment scopes, wrapping existing tools
- 'What is a Skill?' — composition patterns, includes, tool overrides
- 'What is a Resource?' — physical vs virtual, 34+ built-in types, DAG,
  type inheritance, 5-sandbox strategies, 6-level execution env routing,
  devcontainer auto-discovery and lazy activation
- 'What is a Project?' — resource linking, multi-project plans, context
  config, execution environment
- 'Which automation profile applies?' — 8 built-in profiles, 11 flags,
  Safety Profile, Automation Guard, Semantic Escalation, progressive trust
- 'How does naming work?' — namespace format, types, ULID vs name identity
- 'Which CLI command do I use?' — every command group with key flags
- 'What is the architecture?' — 4 layers, 2 deployment modes, A2A
  protocol (full method routing, error codes, streaming), DI container
- 'What is the ACMS?' — UKO, CRP, 10-slot pipeline, hot/warm/cold tiers
- 'Which milestone am I in?' — v3.2.0–v3.8.0 status + cross-milestone invariants
- Key Numbers table (35 entries)

Reference files (1,974 lines across 9 files):
- plan-lifecycle: phase mechanics, decision tree schema, checkpoint triggers,
  child plan execution modes, merge strategies, plan identity fields
- entities: data models for Plan, Decision, Action, Session, Invariant,
  AutomationProfile, SafetyProfile, AutomationGuard, Namespace
- architecture: 4-layer diagram, deployment modes, complete A2A method
  routing tables (standard + plan + registry + context + sync + health),
  streaming events, authentication, error taxonomy, full tech stack
- automation-profiles: threshold table for all 8 built-in profiles, use
  cases, Semantic Escalation algorithm, custom profile YAML
- actors-tools-skills: Actor/Tool/Validation/Skill YAML schemas with
  complete annotated examples, Jinja2 filter reference, LSP integration
  detail, LSPToolAdapter, actor context precedence
- resources: complete resource type hierarchy (all 34+ types), sandbox
  strategies, type inheritance rules, execution environment routing,
  devcontainer integration, CLI usage
- acms: UKO 4-layer ontology, CRP, 10-slot Context Assembly Pipeline with
  per-slot component names, hot/warm/cold eviction rules, skeleton
  compression, context view configuration
- milestones: v3.2.0–v3.8.0 deliverables, architectural constraints, and
  definitions of done; cross-milestone quality gates and invariants
- cli-commands: complete CLI reference for all command groups with all
  flags: plan, action, session, project, actor, skill, tool, validation,
  resource, invariant, automation-profile, lsp, config, utility

ISSUES CLOSED: #0
2026-04-15 19:19:11 +00:00
..

ACMS — Advanced Context Management System

Overview

The ACMS is the pluggable, strategy-driven framework for assembling actor context. It comprises:

  1. UKO — Universal Knowledge Ontology
  2. CRP — Context Request Protocol
  3. Pluggable Context Strategies
  4. Context Assembly Pipeline (10 components, 3 phases)
  5. Hot/Warm/Cold Storage Tiers
  6. Skeleton Compressor (for child plan context)

UKO — Universal Knowledge Ontology

An RDF-based, inheritance-driven ontology representing resources at multiple abstraction levels with provenance and temporal versioning.

Four Layers:

Layer Description Examples
Universal Foundation Core relationships applying to all resources Ownership, timestamps, permissions
Domain Specializations Software, documents, data schemas, infrastructure domains Code files, markdown docs, database tables
Paradigm/Format Programming paradigms, document formats Procedural programming, Markdown format
Technology-Specific Specific languages/technologies Python files, PostgreSQL tables

Key property: Semantically aware — implicit relationships are inferred from content analysis (not just explicit declarations).

URI format: UKO URIs are stable identifiers — changing a file's content does not change its URI (the URI identifies the entity, not its content).


CRP — Context Request Protocol

A structured vocabulary through which actors declare:

  • What information they need
  • At what detail depth
  • What scope they want

Actors declare context needs via CRP; the ACMS satisfies them through the assembly pipeline.


Context Strategies

Pluggable retrieval components that search for and assemble ContextFragments using a specific approach:

Strategy Type Mechanism
Keyword search Full-text search via Tantivy
Semantic embedding Vector similarity via FAISS/Qdrant
Graph navigation Structural relationships via Neo4j/rdflib
Temporal archaeology Historical context retrieval
  • Strategies are registered with the Context Assembly Pipeline
  • Executed in parallel by the StrategyExecutor (with circuit-breaker protection per strategy)
  • Each produces ContextFragments tagged with UKO URIs

Context Assembly Pipeline

10 pluggable Protocol-defined components in 3 phases. Each ships with a default implementation and is overridable at plan > project > global scope.

Phase 1: Strategy Orchestration

Slot Component Role
1 StrategySelector Selects which strategies to run based on CRP request
2 ParallelStrategyExecutor Runs selected strategies concurrently
3 ResultValidator Validates strategy outputs for correctness

Phase 2: Fragment Fusion

Slot Component Role
4 FragmentFusionCoordinator Coordinates combining fragments from multiple strategies
5 DeduplicationFilter Removes duplicate fragments
6 RelevanceCoherenceOrderer Orders fragments by relevance and coherence
7 GreedyKnapsackPacker Fills context up to token budget greedily

Phase 3: Context Finalization

Slot Component Role
8 Summarizer Optionally summarizes fragments to fit budget
9 ContextFormatter Formats assembled context for actor consumption
10 SkeletonCompressor Produces compressed skeleton for child plan inheritance

Hot/Warm/Cold Storage Tiers

Tier What It Holds Bounded By
Hot Active context in memory; currently relevant to actor reasoning hot_max_tokens
Warm Recent decisions and context; quickly accessible warm_max_decisions
Cold Persistent storage; all historical context cold_max_decisions

Eviction rules:

  • Hot → Warm: on overflow (hot_max_tokens exceeded)
  • Warm → Cold: on age threshold
  • Cold: persistent storage

Per-actor scoped views: Each actor has its own view of the hot/warm/cold tiers.


Skeleton Compression

When a parent plan spawns child plans, the child plans receive a compressed representation of the parent's accumulated context (the "skeleton"). This provides child plans with:

  • The parent's key decisions and their rationale
  • The strategic context within which the child plan operates
  • Inherited invariants and constraints

The skeleton size is governed by the skeleton_ratio budget parameter (configurable per project context view).


Context View Configuration

Each project can configure context behavior independently per plan phase:

agents project context set \
  --view strategize \
  --include-resource local/api-repo \
  --exclude-path "**/__pycache__/**" \
  --hot-max-tokens 8000 \
  --warm-max-decisions 50 \
  --cold-max-decisions 200 \
  --query-limit 20 \
  --max-file-size 102400 \
  --max-total-size 10485760 \
  --summarize \
  --summary-max-tokens 2000 \
  --strategy keyword_search \
  --strategy semantic_embedding \
  --default-breadth 10 \
  --default-depth 3 \
  --skeleton-ratio 0.2 \
  --temporal-scope current \
  --execution-environment local/dev-container \
  --execution-env-priority fallback \
  my-api-service

Available views: strategize | execute | apply | default

Context inspection commands:

# Show current context policy for a project
agents project context show --view strategize my-api-service

# Run context assembly and show results (without executing a plan)
agents project context inspect \
  --view strategize \
  --strategy keyword_search \
  --focus uko:py:module:auth \
  --breadth 5 \
  --depth 2 \
  my-api-service

# Simulate context assembly and show token budget breakdown
agents project context simulate \
  --view strategize \
  --budget 8000 \
  --strategy semantic_embedding \
  my-api-service