AgentFS Setup
Scaffold the .agents/ directory tree and seed foundational files for
AgentFS — a layered, agent-agnostic context structure that works across
AI coding agents.
Overview
| Property | Value |
|---|---|
| Default scope | project |
| Scopes | project (per-repo context) · lite (minimal per-repo) · user (shared library) |
| Scripts | scaffold-dotagents.sh · seed-agents-md.sh · sync-agents-md.sh · verify-setup.sh |
| Design spec | references/design-spec.md |
Scope Definitions
AgentFS operates in two scopes. These definitions are canonical.
| Scope | Root Path | Resolves To | Purpose |
|---|---|---|---|
| USER | ~/.agents/ |
/home/<user>/.agents/ |
Machine-wide shared library: skills and knowledge visible across all projects and agents |
| PROJECT | ./.agents/ |
<repo-root>/.agents/ |
Per-repository agent workspace: identity, profiles, memories, and project-scoped skills |
What Lives Where
| Resource | USER (~/.agents/) |
PROJECT (./.agents/) |
|---|---|---|
skills/ |
✅ shared | ✅ project-specific |
knowledge/ |
✅ shared | ❌ never |
memories/ |
❌ never | ✅ per-agent |
profiles/ |
❌ never | ✅ multi-agent |
SOUL.md |
❌ never | ✅ agent identity |
AGENTS.md |
❌ never | ✅ (at repo root ./) |
index.md |
✅ | ✅ |
log.md |
✅ | ✅ |
Rules
Do NOT fabricate directory structures, file contents, or configuration state. Every fact in setup output MUST come from actual filesystem operations and script results. If a setup step fails, report the error — do not simulate success.
Prerequisites: USER Scope Setup
Before running PROJECT scope, ~/.agents/ must exist. There are two
paths to set it up:
Path A: Full Install (recommended)
Clone the published AgentFS repository directly into ~/.agents/:
git clone https://github.com/rhtevan/agentfs.git ~/.agents
This gives the complete skill library, knowledge bundles, and structural scaffolding — ready to use immediately.
Path B: Minimal Install
For users who want a clean, empty ~/.agents/ and prefer to
cherry-pick skills selectively:
- Clone the repo to a staging location (not
~/.agents/):git clone https://github.com/rhtevan/agentfs.git ~/repos/agentfs - Make the staging location visible to the agent (e.g., add
~/repos/agentfs/skills/to the agent’s skill search paths — see the relevant agent setup skill for details). - Ask the agent to run this skill with USER scope:
“Set up AgentFS in USER scope”
The agent loads this skill, recognises the USER scope hint, and scaffolds an empty
~/.agents/withskills/,knowledge/,index.md, andlog.md. - Cherry-pick specific skills using the
skill-mergeskill or manual copy.
After USER Setup: Agent Configuration
Each agent needs its own setup to discover AgentFS context files:
| Agent | Setup Skill |
|---|---|
| Goose | goose-agentfs-setup |
| Hermes | hermes-agentfs-setup |
Usage
PROJECT scope (default — run once per repo)
Ask the agent to run this skill in the target repo:
“Set up AgentFS for this project”
Since PROJECT is the default scope, no additional scope hint is needed. The agent runs the following scripts:
# 1. Scaffold .agents/ directory
bash ~/.agents/skills/agentfs-setup/scripts/scaffold-dotagents.sh --scope project
# 2. Create AGENTS.md at repo root
bash ~/.agents/skills/agentfs-setup/scripts/seed-agents-md.sh
Creates:
.agents/skills/— project-scoped agent workflows.agents/profiles/— named agent profiles for multi-agent collaboration.agents/memories/— default agent’s experiences and user model.agents/SOUL.md— default agent identity.agents/index.md,log.mdAGENTS.md— workspace entry point with scope definitions, progressive loading (SOUL.md, knowledge index), and twelve structural rules
USER scope (minimal install only)
Ask the agent to run this skill with a USER scope hint:
“Set up AgentFS in USER scope”
The agent runs:
bash ~/.agents/skills/agentfs-setup/scripts/scaffold-dotagents.sh --scope user
Creates an empty structural skeleton:
~/.agents/skills/— shared agent workflows (initially empty)~/.agents/knowledge/— shared OKF knowledge bundles (initially empty)~/.agents/index.md,log.md
Note: If you used Path A (full clone), this step is unnecessary — the clone already contains the complete structure.
LITE scope (minimal project for small-context models)
LITE scope creates a minimal AgentFS for projects consumed by small-context models (e.g., Granite 3B at 16K context). No skills, profiles, or knowledge — only identity and memories.
Scope auto-detection: The scripts detect LITE scope automatically. When a target directory is passed and it resolves to a different path than CWD, the scripts infer LITE scope. The agent does NOT need to decide — just pass the path. Examples:
| User says | What the agent runs |
|---|---|
| “Set up AgentFS” | scaffold-dotagents.sh (no path → PROJECT) |
| “Set up AgentFS at ~/projects/foo” | scaffold-dotagents.sh ~/projects/foo (auto-LITE) |
| “Sync AgentFS at ~/projects/foo” | sync-agents-md.sh ~/projects/foo (auto-LITE via metadata) |
The agent runs:
# Just pass the target directory — scope is auto-detected
bash ~/.agents/skills/agentfs-setup/scripts/scaffold-dotagents.sh <TARGET_DIR>
bash ~/.agents/skills/agentfs-setup/scripts/seed-agents-md.sh <TARGET_DIR>
The scripts compare <TARGET_DIR> against CWD. Different path → LITE.
Same path (or no path) → PROJECT.
Creates (LITE):
.agents/memories/— default agent’s experiences and user model.agents/SOUL.md— default agent identity.agents/index.md,log.mdAGENTS.md— lite workspace entry point with 6 simplified rules (~850 tokens, no script dependencies)
Not created: skills/, profiles/, SPECKIT markers, Agent Profiles
table, Signal Routing, full guardrails.
Lifecycle: LITE projects are provisioned and maintained by full-capability sessions (with skills extension), then consumed by developer-only sessions. A lite session cannot sync or scaffold.
Sync mode (update existing project AGENTS.md)
When a project’s AGENTS.md was created by an older template version, use sync to bring it up to date:
“sync agentfs” or “update agentfs”
The agent runs:
bash ~/.agents/skills/agentfs-setup/scripts/sync-agents-md.sh [PROJECT_DIR]
sync-agents-md.sh handles the full workflow:
- Detects scope from
agentfs-scope:metadata in existing AGENTS.md (defaults toprojectfor pre-4.19.0 files without the stamp) - Reads current template version from
<!-- agentfs-template-version: X.Y --> - Compares against installed template version in
SKILL.md - If versions match — reports “already up to date” and exits
- Extracts project-owned sections (PROJECT scope only):
- Agent Profiles rows (excluding
default— owned by template) - SPECKIT block content
- Agent Profiles rows (excluding
- Regenerates AGENTS.md from current template via
seed-agents-md.shwith the detected scope (scope is preserved — never auto-switched) - Re-injects preserved rows using awk (idempotent, no duplicates)
- Reports what changed
Sync works for both PROJECT and LITE scope projects. For LITE, there are no profile rows or SPECKIT blocks to preserve — only the template version and scope metadata are updated.
Agent post-sync actions (REQUIRED):
After sync-agents-md.sh completes, the agent MUST inspect the output
for a ⚠️ SOUL.md warning. If detected, the agent MUST NOT present a
raw bash command to the user. Instead, the agent MUST:
- Inform the user: explain that SOUL.md defines the agent’s identity and that the Agentic SRE default is available.
- Ask the user to choose one of:
- Apply default — Agentic SRE identity, no questions asked
- Customise — agent asks 2–3 targeted questions, then writes SOUL.md
- Skip — leave SOUL.md empty for now
- Execute the user’s choice by running
author-soul.shdirectly:- Apply default:
bash author-soul.sh --path <SOUL_PATH> --non-interactive - Customise: gather answers, then write SOUL.md directly (do NOT run interactive shell — instead collect answers in the conversation and use the write tool to produce the file)
- Skip: acknowledge and move on
- Apply default:
- Confirm the result to the user once SOUL.md is written.
Agent post-sync Rule re-read (REQUIRED):
After sync completes (whether the template was upgraded or already up-to-date), the agent MUST re-evaluate its operating rules against the current AGENTS.md. Specifically:
- If
search_nodes(or equivalent KGM tools) are available in the session and the knowledge graph is empty, the agent MUST load entities from~/.agents/knowledge/.kgm-index.jsonlinto the live graph. This applies even when KGM isenabled: falseinconfig.yaml— session-level availability takes precedence over static config. - This addresses a bootstrap ordering problem: when syncing from an
older template version, the rules that mandate KGM loading (e.g.,
Rule #1’s
search_nodesclause) only exist after the sync completes, so the agent must re-read to pick them up.
Version policy
version: in this SKILL.md doubles as the AGENTS.md template version:
seed-agents-md.sh stamps it as agentfs-template-version, and
sync-agents-md.sh, agentfs-eval/template-check.sh and
pre-push-scan.sh compare against it. Bumping it re-syncs every
project AGENTS.md.
| Change | version: |
CHANGELOG |
|---|---|---|
Template text (seed-agents-md.sh AGENTS.md/SOUL output) |
Bump | New row under the new version |
| Scripts, docs, tests only | Keep | Row under the current version, e.g. v7.8.0 — scripts only, version not bumped; fix: … |
post-write.sh requires --version for behavioral files: pass the
current version for script-only changes. Splitting a separate
template_version from version: is deferred; the user decides when.
Verification
The agent can verify the setup by running:
bash ~/.agents/skills/agentfs-setup/scripts/verify-setup.sh [--scope user|project|lite] [--fix] [ROOT_DIR]
Checks all expected files/directories exist. Scope-specific:
- PROJECT: verifies skills/, profiles/, Scope Definitions, SPECKIT markers
- LITE: verifies memories/ present, skills/ and profiles/ absent,
agentfs-scope: litein AGENTS.md metadata - USER: verifies skills/, knowledge/, excludes PROJECT-only files
With --fix, creates missing directories and seed files without
overwriting existing content.
Structural Guardrails (in AGENTS.md)
The seed-agents-md.sh script creates AGENTS.md with 7 numbered rules
in When/Do prose format, ordered by operational frequency:
- Signal Dispatch — route
hey-prefixed messages per dispatch table - Pre-Flight — specification-driven planning with two modes: Standard Mode (independent steps) and Spec-Driven Mode (dependent steps, multi-phase); includes Design Spec validation gate
- Post-Write — run post-write.sh after
.agents/writes - Session Canary — session continuity check; read USER.md on start
- Conflict Resolution — state what changed on reversal;
[OVERRIDE]for rule conflicts - Checkpoint — checkpoint before destructive
.agents/ops - Scope Rules — memories PROJECT-only; skills default USER; graduation to OKF
Layer Reference
| Layer | USER (~/.agents/) |
PROJECT (./.agents/) |
|---|---|---|
| Identity | — | .agents/SOUL.md |
| Profiles | — | .agents/profiles/ |
| Capability | ~/.agents/skills/ |
.agents/skills/ |
| Knowledge | ~/.agents/knowledge/ |
— |
| Memories | — | .agents/memories/ |
| Workspace | — | AGENTS.md |
Script Input/Output Conventions
merge-log-entry.sh
Writes an entry verbatim under a timestamped heading in log.md.
The entry text MUST be bullet-prefixed using - . For multi-item
entries under one heading, pass multiple bullet lines separated by
\n:
# Single entry
bash merge-log-entry.sh ~/.agents/log.md "- Updated README.md skill categories"
# Multi-line entry
bash merge-log-entry.sh ~/.agents/log.md "- Added SoC principle to skill-gen\n- Fixed merge-log-entry.sh comment"
Do not start an entry line with a date or time — the ## YYYY-MM-DD HH:MM
heading already carries it. The script strips a leading date/timestamp
from each entry line and warns on stderr.
merge-changelog-entry.sh
Writes a version entry to a skill’s CHANGELOG.md. Pass the version
without the v prefix — the script adds it:
bash merge-changelog-entry.sh ~/.agents/skills/my-skill/CHANGELOG.md "1.1.0" "Added new feature"
Supporting Files
scripts/scaffold-dotagents.sh→load_skill(name: "agentfs-setup/scripts/scaffold-dotagents.sh")scripts/seed-agents-md.sh→load_skill(name: "agentfs-setup/scripts/seed-agents-md.sh")scripts/sync-agents-md.sh→load_skill(name: "agentfs-setup/scripts/sync-agents-md.sh")scripts/verify-setup.sh→load_skill(name: "agentfs-setup/scripts/verify-setup.sh")scripts/static-sheet-status.sh→load_skill(name: "agentfs-setup/scripts/static-sheet-status.sh")references/design-spec.md→load_skill(name: "agentfs-setup/references/design-spec.md")references/filesystem-integrity.md→load_skill(name: "agentfs-setup/references/filesystem-integrity.md")
KGM Integration (optional)
When the goose-kgm skill is installed and KGM is enabled in Goose
config, post-edit.sh automatically reindexes the KGM JSONL from
OKF knowledge bundles. This keeps the KGM search index in sync with
knowledge content changes. See load_skill(name: "goose-kgm") for
lifecycle management.
Upgrade AgentFS (Static Record: Quality + Operable-build)
When the user says “upgrade agentfs”, run the static evaluation of the
base skill (AGENTS.md + SOUL.md + referenced scripts/hooks) and address
identified gaps. This skill owns the static record
(artifacts/agents-md/scores.yaml). Runtime adherence is NOT evaluated
here: it is the compliance campaign (agentfs-eval), derived from
compliance-profile.yaml. A static score never claims adherence.
Methodology: ~/.agents/knowledge/agentfs-engineering-evolution/evaluation-methodology.md §3–§5.
Check staleness first:
bash ~/.agents/skills/agentfs-setup/scripts/static-sheet-status.sh
STATIC_SHEET=CURRENT → report and stop unless the user asks for a
re-score. STALE or INVALID → continue to Step 1.
Evidence Architecture
QOO evaluation uses a two-stage pipeline:
| Stage | Actor | Role | Strength |
|---|---|---|---|
| 1a | gather-skill-state.sh (bash) |
Extract structural facts | Reproducible, cheap: line counts, file refs, section counts |
| 1b | Frontier model (you, the agent) | Extract semantic evidence | Comprehension: intent, coupling, complexity, concern boundaries |
| 2 | SDM (SystemOne API on 14B) | Quantitative scoring | Reproducible bounded judgments, avoids frontier stochasticity |
Stage 1a handles what regex can reliably count. Stage 1b handles what requires reading comprehension — the frontier model reads the artifact and produces per-dimension evidence statements. Stage 2 turns those evidence statements into reproducible numeric scores via SDM.
Step 1 — Gather Structural Facts
Run the deterministic fact extraction:
bash ~/.agents/scripts/gather-skill-state.sh --target agents-md ./AGENTS.md > /tmp/agents-md-facts.txt
Read the output. It contains per-rule structural metrics (lines, words, script references) and BMBT readiness indicators.
Step 2 — Extract Semantic Evidence
Read the quality schema:
cat ~/.agents/skills/schemas/quality-agents-md.yaml
Read the project’s AGENTS.md. For each dimension in the schema:
- Read the
questionfield — it describes what to measure. - Read the AGENTS.md content with that question in mind.
- Write a concise evidence statement (1-3 sentences) answering the question with specific references to rules.
Write all evidence statements to /tmp/agents-md-evidence.txt in
this format:
=== Structural Facts ===
<paste contents of /tmp/agents-md-facts.txt>
=== Semantic Evidence ===
rule_self_containment: <your evidence statement>
rule_action_density: <your evidence statement>
concern_count: <your evidence statement>
trigger_clarity: <your evidence statement>
cross_rule_dependency: <your evidence statement>
item_overlap: <your evidence statement>
=== Semantic Evidence (Build) ===
has_bones: <your evidence statement>
has_muscle: <your evidence statement>
has_brain: <your evidence statement>
has_harness: <your evidence statement>
The Build section answers the phase: build dimensions of
~/.agents/skills/schemas/operable-agents-md.yaml (read it). Cite
specific rules and scripts.
Be precise and factual. Cite specific rule numbers and content.
Do NOT editorialize or score — SDM handles scoring in Step 3.
Keep the evidence: copy it to
~/.agents/skills/agentfs-setup/artifacts/agents-md/evidence/<version>.txt
so a later re-score (SDM or T4) grades the same input.
Step 3 — SDM Scoring
Pass the composed evidence to SDM for quantitative evaluation:
bash ~/.agents/scripts/sdm-evaluate.sh ./AGENTS.md \
~/.agents/skills/schemas/quality-agents-md.yaml \
--evidence /tmp/agents-md-evidence.txt
bash ~/.agents/scripts/sdm-evaluate.sh ./AGENTS.md \
~/.agents/skills/schemas/operable-agents-md.yaml \
--evidence /tmp/agents-md-evidence.txt --phase build
Never score phase: runtime dimensions with SDM.
If the output contains "band": "SDM_UNAVAILABLE", use the calibrated
T4 scorer. Contract: ~/.agents/skills/schemas/sdm-endpoint.md →
“Exception — Base-Skill Static Record”.
- Calibrate. Run
bash ~/.agents/scripts/t4-static-score.shwith--calibrate <score>on the template version and schema of the last SDM quality score (scores.yamlhistory), using evidence you extract from that template as in Step 2. - If the last line is
T4_CALIBRATION=FAIL: report the T4 scores labelled “T4-fallback (, not persisted)". Skip Step 4. - If
T4_CALIBRATION=PASS: runt4-static-score.shtwice on/tmp/agents-md-evidence.txt(the quality schema, then the operable schema with--phase build). Use therecordof each output in Step 4.
Read the output. It contains per-dimension scores and an aggregate Quality score with band classification.
Step 4 — Persist Scores
Update ~/.agents/skills/agentfs-setup/artifacts/agents-md/scores.yaml
(edit in place; do NOT rewrite the file):
version→ the template version (metadata.versionabove), andtemplate_hash→{rules, soul}frombash ~/.agents/skills/agentfs-setup/scripts/template-hash.sh. Setquality.evidenceandoperable.build.evidencetoevidence/<version>.txt.quality→ aggregate_score, band, dimensions,evaluatedfrom the Quality SDM JSON.operable.build→ dimensions andevaluatedfrom the build SDM JSON.operable.runtime→ leave the stateless reference (derived_from,computed_by) untouched. Never add pass, date, score or note.history→ append one entry (date, typestatic, one-line note).
With T4 scores (calibration PASS): also set quality.scorer and
operable.build.scorer to t4-fallback:<model>, write
quality.calibration, use agreement instead of confidence, and add
scorer to the history entry. With SDM scores: remove those keys.
Run post-write.sh after writing, then re-run static-sheet-status.sh;
it must print STATIC_SHEET=CURRENT.
Step 5 — Address Gaps
For each dimension scoring below 75 (Tunable threshold):
- Identify the specific rules contributing to the low score.
- Propose concrete edits to
seed-agents-md.sh(the source template). - Present proposals to the user for approval.
- Apply approved changes via
seed-agents-md.shedit →sync-agents-md.sh. - Re-run Steps 1-4 to verify improvement.
Do NOT edit AGENTS.md directly. Always edit the seed template source.
Companion Skills
goose-kgm— KG Memory extension lifecycle (setup/teardown/enable/disable/reindex)agentfs-profile— Create named agent profiles under.agents/profiles/goose-agentfs-setup— Configure Goose’sCONTEXT_FILE_NAMESfor cross-agent context file discoveryhermes-agentfs-setup— Configure Hermes’sskills.external_dirsfor AgentFS skill discovery
Changelog
See CHANGELOG.md for version history.