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
..

Resources — Detailed Reference

Resource Type Hierarchy

Physical Types — Git Layer

Type User Addable Sandbox Description
git yes none A git repository (object DB, refs, full history). May be local or remote.
git-remote no (none) A remote URL configured on a git repo. Auto-discovered child of git.
git-branch no (inherits) A named branch ref. Auto-discovered child of git.
git-tag no (inherits) A tag ref. Auto-discovered child of git.
git-commit no (inherits) A specific commit object. Auto-discovered child of git-branch.
git-tree no (inherits) A tree object (directory listing at a commit). Auto-discovered child of git-commit.
git-tree-entry no (inherits) A blob entry in a tree (specific file at specific path). Auto-discovered child of git-tree.
git-stash no (inherits) A stash entry. Auto-discovered child of git.
git-submodule no (inherits) A submodule reference. Auto-discovered child of git.

Physical Types — Git Checkout

Type User Addable Sandbox Description
git-checkout yes git_worktree A locally checked-out git repo. Composition type — auto-discovers git child and fs-directory child. Most users register this type.

Physical Types — Filesystem Layer

Type User Addable Sandbox Description
fs-mount yes copy_on_write A physical mount point. Root directory auto-discovered as fs-directory child.
fs-directory yes copy_on_write A directory. Can be standalone, root of fs-mount, worktree root of git-checkout, or subdirectory.
fs-file no (inherits) A regular file. Auto-discovered child of fs-directory.
fs-symlink no (inherits) A symbolic link. Auto-discovered child of fs-directory.
fs-hardlink no (inherits) A hard link (link count > 1). Auto-discovered child of fs-directory.

Virtual Types (abstract identity; never user-addable; no sandbox)

Type Links Answers
file fs-filegit-tree-entry "This file on disk and this blob in git are the same file"
directory fs-directorygit-tree "This directory on disk matches this tree object in git"
symlink fs-symlinkgit-tree-entry (mode 120000) "This symlink on disk and this git entry are the same symlink"
commit git-commit (cross-repo) "This commit exists in both repos"
branch git-branch (cross-repo) "These repos share a branch at the same HEAD"
tag git-tag (cross-repo) "These repos share a tag"
remote git-remote (cross-repo) "These repos share the same upstream"
submodule git-submodule (cross-repo) "These repos reference the same submodule"
tree git-tree (cross-commit/cross-repo) "These tree objects have identical content"

Sandbox Strategies

Strategy Resource Types Rollback
git_worktree git-checkout git reset --hard <commit_sha>
copy_on_write fs-mount, fs-directory Restore from snapshot
overlay Custom Discard overlay writes since checkpoint
transaction_rollback Database types ROLLBACK TO SAVEPOINT <name>
none git, APIs, cloud services No rollback; user proceeds at own risk

Resource Type Inheritance

# Example: devcontainer-instance inherits container-instance
name: devcontainer-instance
inherits: container-instance
description: "A container provisioned from a devcontainer.json"

cli_args:
  - name: config-path
    type: path
    required: false
    description: "Path to .devcontainer/devcontainer.json"

handler:
  class: DevcontainerHandler
  module: cleveragents.resource.handlers.devcontainer

Inheritance rules:

  1. Single inheritance only (no diamond)
  2. Maximum chain depth: 5 levels
  3. No circular inheritance (validated at registration)
  4. Built-in types may not inherit from custom (namespaced) types
  5. Removing a parent type is prohibited while subtypes exist

Field resolution: Walk inheritance chain from most specific to root. Subtype value wins (override). If omitted, parent's value is inherited.

Collection field merging: cli_args, child_types, parent_types use additive merging by default. Use <field>_replace: true to replace entirely.

Polymorphism: Tools bound to a parent type automatically work with all subtypes.


Execution Environment Routing (6-Level Precedence)

When a plan enters Execute, the runtime determines WHERE each tool runs:

Priority Source Condition
1 (highest) Plan-level execution_environment with priority: override agents plan use --execution-environment R --execution-env-priority override
2 Project-level execution_environment with priority: override agents project context set --execution-environment R --execution-env-priority override
3 Nearest-ancestor devcontainer (auto-detected) Lazy-built on first access
4 Plan-level execution_environment with priority: fallback Used only when no devcontainer detected
5 Project-level execution_environment with priority: fallback Used only when no closer-scoped environment
6 (default) Host The local operating system

Tool-level environment preferences:

  • environment.required: container → tool MUST run in container; error if router resolves to host
  • environment.preferred: container → hint only; runs wherever router places it
  • environment.specific: local/api-dev → route to specific named resource regardless of chain

Devcontainer Integration

Auto-discovered when a git-checkout or fs-directory resource contains a .devcontainer/ directory.

Lifecycle:

  1. During auto-discovery: created in detected (not built) state
  2. First time execution environment router selects it: built and started (lazy activation)
  3. Remains available for subsequent plan executions until explicitly stopped or removed

Resource type: devcontainer-instance (inherits container-instance)

CLI:

# Devcontainer discovered automatically on git-checkout registration
agents resource add git-checkout local/my-repo --path /path/to/repo

# View discovered devcontainer
agents resource tree local/my-repo

# Stop the running container
agents resource stop local/my-repo-devcontainer

# Rebuild the container (e.g. after devcontainer.json changes)
agents resource rebuild local/my-repo-devcontainer

Working with Resources

# Register a git checkout (auto-discovers git + fs-directory children)
agents resource add git-checkout local/api-repo \
  --path /repos/api-service \
  --branch main

# Register a standalone directory
agents resource add fs-directory local/config-dir \
  --path /etc/myapp

# List all resources
agents resource list

# Filter by type
agents resource list --type git-checkout

# Explore resource structure
agents resource show local/api-repo
agents resource inspect local/api-repo
agents resource tree --depth 3 local/api-repo

# Inspect a specific file within a resource
agents resource inspect --file src/main.py local/api-repo

# Link a child resource to a parent
agents resource link-child local/api-repo local/some-subdir

# Remove a resource
agents resource remove local/api-repo

# Custom resource type
agents resource type add --config ./types/my-db-type.yaml
agents resource type list
agents resource type show local/my-db-type