Capability Model
This page defines capability kinds, forms, scopes, refs, and sync materialization.
Capability kinds
Toolang currently manages four capability kinds:
skillservicepromptpsyche
Capability forms
Toolang uses three authored capability forms:
refdeclared withuse ...inlinedeclared directly in{AGENT}.toolocalhuman-edited files or directories kept in local cap roots
Rules:
inlineis agent-scoped onlylocaldoes not appear in.tooref,inline, andlocalmay coexist for the same kind
Capability scopes
Toolang uses three capability scopes:
agentsharedglobal
Runtime precedence is:
agentsharedglobal
Important rule:
- same-name capabilities in different scopes stay separate through sync
- the effective override is chosen at runtime, not flattened during sync
Runtime scope visibility
invoke, run, and start always load agent-scoped capabilities.
Two switches control whether wider scopes are enabled:
--sharedor--no-shared--globalor--no-global
Default visibility depends on agent kind:
residentshared on, global onroamingshared on, global offvisitingshared off, global off
These switches affect runtime visibility only. Sync still materializes each scope in its own root.
Capability references
cap_ref is kind-neutral. Resolution depends on the selected capability kind.
Examples:
toolang skill add by3gus/pdf-processingtoolang service add by3gus/githubtoolang prompt add by3gus/rewritetoolang psyche add by3gus/revieweruse skill by3gus/pdf-processing
The same ref syntax is used in .too declarations, shared source files, and
capability-management commands.
GitHub resolution
The first supported registry is GitHub. Bare refs use:
user-or-org/cap-nameProbe rules:
service- repos:
agent-services,services - paths:
services/<cap-name>.md,<cap-name>.md
- repos:
prompt- repos:
agent-prompts,prompts - paths:
prompts/<cap-name>.md,<cap-name>.md
- repos:
psyche- repos:
agent-psyches,psyches - paths:
psyches/<cap-name>.md,<cap-name>.md
- repos:
skill- repos:
agent-skills,skills - paths:
skills/<cap-name>/SKILL.md,<cap-name>/SKILL.md
- repos:
Sync outputs
toolang sync materializes three scope roots plus one per-agent state file.
Materialized roots:
- global
${TOOLANG_ROOT}/sync/ - shared
${AGENT_HOME}/.toolang/sync/ - agent
${AGENT_HOME}/.toolang/agents/{AGENT}/sync/
Per-agent state:
${AGENT_HOME}/.toolang/sync/<agent>.state.json
The state file stores freshness metadata, the compiled synced program, and the exact resolved refs by scope.
Sync contract
High-level sync flow:
- parse top-level
.toofiles - analyze declarations, refs, and inline capabilities
- parse shared and global
agents.too - read local cap roots
- resolve refs to exact immutable targets
- materialize global, shared, and agent sync roots
- rewrite one state file per top-level
.too
The reason for this design is simple: unchanged agents should not need a fresh parse just to recover inline capabilities, and runtime precedence should remain inspectable.
Read next
- Read Layout and Storage for the filesystem roots behind each scope.
- Read Plugin Model for the broader integration boundary around capabilities and plugins.