AGENT SKILL

repo-organization

Canonical repo organization for Steadfaste Fleet — structure, naming, consolidation, symlinks, and audit procedures.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 4
Forks
1

01 前言 Front Matter

name
repo-organization
author
Steadfaste Fleet
license
MIT
version
1.1.0
metadata
{ "hermes": { "tags": [ "repo-organization", "structure", "naming", "conventions", "audit", "cleanup" ], "related_skills": [ "code-review", "project-map", "hermes-agent-skill-authoring" ] } }
platforms
[ "linux", "macos" ]
description
Canonical repo organization for Steadfaste Fleet — structure, naming, consolidation, symlinks, and audit procedures.

02 资源文件 1

03 SKILL.md 正文

Steadfaste Fleet — Repo Organization Standard

This skill defines the canonical structure for Steadfaste Fleet repos. Use it when:

  • Setting up a new Steadfaste Fleet installation
  • Auditing an existing repo for structural issues
  • Deciding where a new file should live
  • Renaming or consolidating scattered data

1. Core Principle: Three-Layer Model

Steadfaste Fleet uses three distinct layers, each with a clear purpose:

Layer Path Purpose Backed up?
Repo ~/steadfaste-fleet/ Public source code, skills, docs, installer ✅ Git (GitHub)
Consumer overlay <project>/.steadfaste-fleet/ Per-PROJECT agent data (sessions, memory, skills) for consumer projects seeded by seed-project.sh. The fleet repo itself must NOT carry one (removed 2026-10-07) — fleet-update.sh skips it when the repo is the fleet repo. ✅ Git (in that project)
Hermes Config ~/.hermes/ Hermes Agent runtime (config, logs, cache, DBs) ❌ Machine-local

Rule: Never put agent-generated data in the repo root. Never put source code in ~/.hermes/. Never put logs in the repo.


2. Canonical Directory Structure

This is the ACTUAL layout (measured 2026-11-14). The repo follows a layer-separation model fixed by src/→ops/ (commits f51df21a, 7e8a8eac, 05f6ff68; P0a b416ed5c, P0d 0e5be574). src/ was deliberately retired and does not exist anywhere. config/ and profiles/ are near-empty stragglers, consolidation candidates that fold into ops/ (see § Consolidation).

steadfaste-fleet/
├── AGENTS.md                  # Agent guidelines — orients every agent on entry
├── CLAUDE.md                  # Claude Code auto-loads this — thin pointer to AGENTS.md
├── README.md / CONTRIBUTING.md / LICENSE / VERSION / skills.yaml / pytest.ini
├── ops/                       # ALL operational source — the big tree
│   ├── scripts/               #   runnable scripts (fleet/, fleet_gateway/, fleet_lib/, …)
│   ├── services/              #   service packages (fleet-bus server, dashboard, mycortex-mem)
│   ├── install/               #   installers (install-crons, install-orch-crons, seed-project, …)
│   ├── offline/               #   offline knowledge corpus
│   ├── deploy/                #   nginx + env templates
│   └── evidence/              #   repo-only evidence/verify scripts (never deployed)
├── core/                      # server/library source: fleet_bus (bus server) + governance
├── skills/                    # Canonical skill library (organized by domain)
├── docs/                      # Documentation (incl. older/ = archived, evidence/ = records)
├── tests/                     # Test suite
├── plugins/                   # Hermes plugins (governance-enforcer, mycortex-*, prompt-guard)
├── mcp-servers/               # MCP server implementations (fleet-bus, loop-gov, tasks, executor)
├── tools/                     # fleet-search (Rust) + auto-remediation-scan
├── evals/                     # regression golden + suites
├── config/                    # near-empty (consolidation candidate → ops/config)
└── profiles/                  # near-empty (consolidation candidate → docs/reference)

3. Naming Conventions

Files and Directories

Pattern Example When to use
kebab-case system-alert-watchdog.py, service-recovery.py Source files, scripts, configs — default
snake_case loop_scorer.py, score_cycle.py Python modules (PEP 8). Only for importable modules
PascalCase — Never in file names. Only for Python classes inside files
Descriptive names orch-fleet-watchdog.py Describe WHAT the file does, not how. Human-readable
No abbreviations product-requirements/ not prd/ Every new name must be understandable without context

Cron Jobs

Prefix Example When to use
agent-* agent-system-alert-watchdog, agent-daily-bible-reading Runs on every agent — both LLM-driven crons and no_agent script crons. agent- means "fleet-wide", not "LLM-driven".
orch-* orch-bus-audit-watchdog, orch-fleet-watchdog Runs only on orchestrator agents (Moses, Esther). Registered in install-orch-crons.sh and register_orch in fleet-update.sh.

Skills

Pattern Example Meaning
kebab-case code-review, change-test-loop Skill directory name = name: in SKILL.md frontmatter
local-* local-<name> (e.g. host-managed copies of deploy-load-verification) Host-managed skill — created per-host, NOT in repo installers. Doctor silently excludes it (no orphan warning), fleet-update.sh never prunes it, but agent-collect-skills.sh still reports it so orch-skill-evaluate can score it for fleet promotion (evaluated at LOW priority — DEFER by default, promote only if it generalizes). Sync the deployed copy to skills/ if you want it fleet-wide, then drop the local- prefix. Never commit the local-* copy to the repo when the plain-named version exists — keep exactly one canonical SKILL.md (2026-08-17 consolidation).

4. Consolidation Rules

What goes where

This belongs in the repo (ops/ + core/) This belongs in ~/.steadfaste-fleet/ This stays in ~/.hermes/
Runable scripts Session state Agent config (config.yaml)
Skill source code Agent memory (MEMORY.md, USER.md) Runtime DBs (loop-governance.db)
Templates Per-user project skills Logs
Installers Cron output LLM caches
MCP servers — Agent registry (local copy)
Dashboards — Cron jobs.json

Consolidation Procedure

When you find data in the wrong place:

  1. Move it to the correct location
  2. Symlink from the old location if any tool or cron references the old path
  3. Update all references to point to the new canonical path
  4. Document the change in AGENTS.md and the relevant SKILL.md

Moving a script or launcher

A move changes what a path MEANS, so the risky parts are resolution and references — not the copy.

  • git mv needs the DESTINATION's parent directory to exist, and it reports the failure against the SOURCE: fatal: renaming '<src>' failed: No such file or directory when <newdir>/ is absent. mkdir -p the parent, then git mv. Do not go hunting for a missing source file — it is there, and the message names the source while meaning the destination.
  • A script that resolves a collaborator from its OWN directory breaks silently on a move. A launcher doing MODULE="${SCRIPT_DIR}/thing.py" keeps working one level down only by falling through to its hardcoded "known paths" list — which can hand the run to a DIFFERENT tree's module, and the run looks identical. Resolve both layouts explicitly (beside it, and one level up), say which one was used when it was not the primary, and exit with the could-not-verify code naming what it looked for. The generic failure code is wrong here: it reads as "this tool is broken" rather than "this host cannot resolve a collaborator".
  • Never give an executable a path that is a DIRECTORY named after the command. A directory at ops/scripts/<cmd> makes bash ops/scripts/<cmd> answer Is a directory for every caller who guesses the obvious path. Keep launchers in a bin/ beside the module.
  • Sweeping references includes strings that are PRINTED as fix commands. A check that tells the operator to run python3 <deploy>/scripts/manage/<tool>.py is a reference like any other, and a printed path that does not resolve is worse than silence — the operator follows it and lands on a dead command. Verify each printed path resolves. Do not "tidy" its neighbours that are already correct: a deployed layout is often genuinely mixed (some tools flat, some under manage/).
  • Committed evidence that quotes the old path is a RECORD, not a reference. Leave it alone: rewriting it falsifies what was run at that revision and breaks the artifact's checksum. Say so in the commit message, so a reviewer does not read the survivors as references you missed.

5. Symlink Strategy

Use symlinks ONLY when:

  • A tool/cron expects a file at a specific path AND
  • The canonical location is different AND
  • You can't update all the references yet

Auditable symlinks: Keep a manifest at scripts/symlink-audit.sh that lists every symlink and its target. Run scripts/symlink-audit.sh --check to verify all links are valid.

What NOT to symlink:

  • Config files — use references or imports instead
  • Secrets — never symlink across boundaries
  • Agent memory — it's per-user and should stay in ~/.steadfaste-fleet/memory/ (a consumer project keeps its own repo-local overlay instead)

6. Audit Checklist

Run this checklist when auditing the repo:

[ ] No source code in ~/.hermes/
[ ] No agent data in ~/steadfaste-fleet/ root
[ ] All cron names follow `agent-*` (fleet-wide) or `orch-*` (orchestrator-only) convention
[ ] All skill directory names match name: field in SKILL.md
[ ] No stale .cron-version markers in git tracking
[ ] AGENTS.md under 20K bytes
[ ] All scripts referenced by crons exist
[ ] All symlinks point to valid targets
[ ] No duplicate files (same content, different locations)
[ ] .gitignore covers all generated files
[ ] VERSION is single source of truth

7. Quick-Fix Script

Run this to check the most common issues:

# Check for name mismatch in skills
for d in skills/software-development/*/; do
  name=$(basename "$d")
  yaml_name=$(grep "^name:" "$d/SKILL.md" 2>/dev/null | head -1 | cut -d: -f2- | tr -d ' ')
  if [ "$yaml_name" != "$name" ]; then
    echo "MISMATCH: $name vs $yaml_name"
  fi
done

# Check no .cron-version in git
git ls-files | grep "\.cron-version" && echo "ERROR: .cron-version tracked in git"

# Check AGENTS.md size
if [ $(wc -c < AGENTS.md) -gt 20000 ]; then
  echo "AGENTS.md too large ($(wc -c < AGENTS.md) bytes)"
fi

# Check all symlinks
find . -type l ! -path './.git/*' | while read link; do
  if [ ! -e "$link" ]; then
    echo "BROKEN: $link"
  fi
done

8. Migration Checklist (from Old Layout)

When migrating an existing install to this standard:

  1. Rename crons: cron-* → agent-* to indicate fleet-wide scope (both LLM-driven and no_agent script crons)
  2. Consolidate skills: Move skill content from ~/.hermes/skills/ to skills/ if it belongs in the repo
  3. Fix skill names: Ensure name: in SKILL.md matches the directory name
  4. Audit symlinks: Replace hard copies with symlinks where files must exist in multiple locations
  5. Clean .gitignore: Add generated files (.cron-version, *.db, IMPROVEMENTS.md)
  6. Update AGENTS.md: Keep it under 20K by trimming verbose sections
  7. Test install: bash install.sh --check must pass, pytest must pass

9. Governed Plan Review

When the operator directs "review this plan with pro" (Luke's standing rule for design/reorg/governance changes), drive the governed adversarial reviewer, not a chat call. See references/pro-review-grounding.md for the full loop: writing a self-contained material file, pinning every factual claim to a reproducible command, and grounding unverified-claim/fabrication findings to a CLEAN verdict.

04 同仓库更多 Skills