🚚 export: 16 files (moves)

M .gitignore
M docs/windows-powershell-utf8.md
M plugins/bevy/README.md
M plugins/orbit/README.md
M plugins/orbit/skills/orbit/references/review-recipes.md
M plugins/project-uv/README.md
M plugins/spire/CLAUDE.md
R plugins/spire/agents/attacker.md -> plugins/spire/agents/advocate.md
M plugins/spire/agents/igor.md
M plugins/spire/agents/zathras.md
M plugins/spire/skills/adepts/roster.sh
M plugins/spire/skills/implementation/references/models.md
A plugins/spire/skills/quire/tests/test_roster.py
R plugins/spire/skills/workpad/SKILL.md -> plugins/spire/skills/quire/SKILL.md
R plugins/spire/skills/workpad/tests/test_workpad.py -> plugins/spire/skills/quire/tests/test_quire.py
R plugins/spire/skills/workpad/workpad.py -> plugins/spire/skills/quire/quire.py
This commit is contained in:
2026-11-25 01:52:10 +01:00
parent e562ac6294
commit 4400de7eb2
16 changed files with 212 additions and 71 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
Spire is an agent orchestration plugin: work gets dispatched, knowledge accumulates, and the system maintains itself. See README.md for component overview.
Condense or rewrite passes over Spire text: keep each line in `docs/workpad/specs/spire-stance-lines.md` verbatim, or flag the drop in the report.
Condense or rewrite passes over Spire text: keep each line in `docs/quire/specs/spire-stance-lines.md` verbatim, or flag the drop in the report.
@@ -1,7 +1,7 @@
---
name: attacker
name: advocate
description: >
Attacks a finished plan against the code and reshapes it into a build plan,
Castigates (alias: attack) a finished plan against the code and reshapes it into a build plan,
pinned to Opus 5.5. Never the plan's author. Dispatched by Igor before the
Athanor builds.
model: claude-opus-5-5[1m]
@@ -10,18 +10,18 @@ skills:
- spire:project
---
You attack the plan, then reshape it. You did not write it and you will not build it. The brief names the plan, the goal and the output path.
You castigate the plan, then reshape it. You did not write it and you will not build it. The brief names the plan, the goal and the output path.
## Attack
## Castigate
Test the plan adversarially against the code as it is now:
- Blockers: things the plan assumes that the code does not allow.
- Design errors and wrong root causes.
- Design errors, wrong root causes, and rebuilding what a library, the inventory or the architecture already gives.
- Consumers of changed semantics the plan missed: every direct reader or caller of what the change touches (other readers, stats, migrations, callers in other crates or packages), and further only where the changed meaning is passed on.
- Staleness: a plan written before earlier phases landed may no longer fit. Read the previous phase's run log and review only when something is off.
- Missing function: something a goal box needs that the plan does not deliver, such as a planned thing that does nothing, a path with no way back (onboarding without offboarding), or the error handling and security that box implies.
- A function no box needs is not missing: propose it as a default taken (not built), with a one-line reason, instead of adding it to the build plan.
- Missing function: something a goal box needs that the plan does not deliver, such as a planned thing that does nothing, a path with no way back (onboarding without offboarding), the error handling and security that box implies, and what comes with it at the `Scope:` level (`spire:project`).
- Anything beyond that is not missing: propose it as a default taken (not built), with a one-line reason, instead of adding it to the build plan.
## Reshape
@@ -29,13 +29,13 @@ Write a new build plan; the original stays as written.
- Phases that each end in a testable state; blocks that one owner can finish.
- Per block: owner (a gremlin for a complex block, a fresh Sonnet or Haiku agent for a mechanical one), gate, what may stay broken until the next block (defaults from `spire:project` `## Build`). Cheap gate between blocks, tests once per phase. Review points, at most one per phase, each with a one-line reason: Opus 5.5 complex-block owners get one review for the whole build plus a point per risk area (auth, file access, deletion, rendering, security); Sonnet or Haiku owners up to one per phase.
- Carry over the plan's code structure (signatures included) and per-module size estimate, adjusted where the attack changes them.
- Scope cut back to the goal: each block traces to a box, and cutting never removes a failure path or a test a box names. Code in the plan only where its exact form is the decision.
- Carry over the plan's code structure (signatures included) and per-module size estimate, adjusted where the castigation changes them.
- Scope fitted to the goal at its `Scope:` level: each block traces to a box; size alone never drops a capability item, a failure path or a test a box names. Code in the plan only where its exact form is the decision.
- Decisions: defaults taken (the build takes them unless the user overrides) and blocking decisions (no acceptable default).
- A risk list for the build. It is not the reviewer's scope.
## Rules
- Stamp the model id you ran on in the build plan's header.
- Stamp the model id you ran on and the `Scope:` level in the build plan's header.
- Write only the build plan file. Do not touch code.
- Your final message: the build plan's path, what the attack found (blockers first), the defaults taken and the blocking decisions.
- Your final message: the build plan's path, what the castigation found (blockers first), the defaults taken and the blocking decisions.
+1 -1
View File
@@ -11,7 +11,7 @@ memory: project
skills:
- spire:project
- spire:igor
- spire:workpad
- spire:quire
- spire:adepts
---
+1 -1
View File
@@ -11,7 +11,7 @@ memory: project
skills:
- spire:project
- spire:zathras
- spire:workpad
- spire:quire
- spire:adepts
---
+17 -9
View File
@@ -6,19 +6,27 @@
# script reads frontmatter declared once and journal filenames that already
# exist. No adept ever maintains an index, a counter, or a timestamp by hand.
# Resolve workpad — same chain as spire:workpad, minus interactive steps.
WP="${WORKPAD_FOLDER:-$(just workpad-folder 2>/dev/null)}"
if [ -z "$WP" ]; then
# Try .claude/spire/project.md for an explicit Workpad: line
if [ -f .claude/spire/project.md ]; then
WP=$(sed -n 's/^- \*\*Workpad\*\*: *`\{0,1\}\([^` ]*\).*/\1/p' .claude/spire/project.md | head -1)
fi
# Resolve the quire — same chain as spire:quire, minus interactive steps.
# "workpad" is the old name; it stays only as a fallback.
WP="${QUIRE_FOLDER:-$(just quire-folder 2>/dev/null)}"
[ -z "$WP" ] && WP="${WORKPAD_FOLDER:-$(just workpad-folder 2>/dev/null)}"
if [ -z "$WP" ] && [ -f .claude/spire/project.md ]; then
# Explicit Quire: (or old Workpad:) line in .claude/spire/project.md
WP=$(sed -nE 's/^- \*\*(Quire|Workpad)\*\*: *`?([^` ]*).*/\2/p' .claude/spire/project.md | head -1)
fi
[ -z "$WP" ] && { [ -d docs/workpad ] && WP=docs/workpad || WP=.workpad; }
if [ -z "$WP" ]; then
for c in docs/quire docs/workpad .quire .workpad; do
[ -d "$c" ] && { WP=$c; break; }
done
fi
[ -z "$WP" ] && WP=docs/quire
NOTE=""
[ "$WP" = docs/quire ] && [ -d docs/workpad ] && NOTE="Note: docs/workpad/ also exists; using docs/quire/."
TPL="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/templates/"
[ -d "$WP/adepts" ] || { echo "## Adept roster — none (no $WP/adepts/)"; echo "Founding templates: $TPL"; exit 0; }
[ -d "$WP/adepts" ] || { echo "## Adept roster — none (no $WP/adepts/)"; [ -n "$NOTE" ] && echo "$NOTE"; echo "Founding templates: $TPL"; exit 0; }
echo "## Adept roster — $WP/adepts/ ($(date +%F))"
[ -n "$NOTE" ] && echo "$NOTE"
for dir in "$WP"/adepts/*/; do
[ -d "$dir" ] || continue
slug=$(basename "$dir")
@@ -4,17 +4,17 @@ Observations about models in Spire work. They are dated and sourced, and they ar
Context figures are **guesstimates** from Claude Code experience. Agents cannot see their own token count, and orchestrators cannot yet look into a running subagent's usage.
Sources: dirigent `docs/workpad/reports/2026-10-01-lean-process-report.md` (+ 2026-10-05 addendum); spacecraft `docs/workpad/reports/2026-09-27-13-strategy-mvp-retrospective/report.md`, `docs/workpad/reports/2026-09-29-13-orchestration-overhead-attribution.md` and `docs/workpad/brainstorm/the_assistants_mindset.md`; reliquary journal `docs/workpad/journals/2026-10-05-21-athanor.md` (user direction).
Sources: dirigent `docs/workpad/reports/2026-10-01-lean-process-report.md` (+ 2026-10-05 addendum); spacecraft `docs/workpad/reports/2026-09-27-13-strategy-mvp-retrospective/report.md`, `docs/workpad/reports/2026-09-29-13-orchestration-overhead-attribution.md` and `docs/workpad/brainstorm/the_assistants_mindset.md`; reliquary journal `docs/quire/journals/2026-10-05-21-athanor.md` (user direction).
## Defaults (2026-10-05)
Opus 5.5 for the Athanor, planning, attacking plans and review (user direction). Owner models for blocks come from the build plan; a common split is Opus 5.5 for hotspot blocks (state, concurrency, formats, read-path precedence) and Sonnet for mechanical ones (field sweeps, wiring, docs). Housekeeping (test runs, commits) on Haiku.
Opus 5.5 for the Athanor, planning, castigating plans and review (user direction). Owner models for blocks come from the build plan; a common split is Opus 5.5 for hotspot blocks (state, concurrency, formats, read-path precedence) and Sonnet for mechanical ones (field sweeps, wiring, docs). Housekeeping (test runs, commits) on Haiku.
## Opus 5.5 — `claude-opus-5-5`
- Catches more, decides boldly. Can replace frequent small reviews, especially in Rust. (user, 2026-10-05)
- Can take the user's word as holy, or reverse 100% when corrected. Relay user remarks with their weight: a passing thought is not a rule. (user, 2026-10-05)
- Plans are thorough and long. A 5.5 plan traced a root cause in code that a 4.6 plan on the same scope missed (dirigent, 2026-10-01). 5.5 plans ran about 11× larger than earlier plans and drove scope (spacecraft, 2026-09-27). The attack step trims scope. Dirigent reports properly sized plans since (user, 2026-10-05).
- Plans are thorough and long. A 5.5 plan traced a root cause in code that a 4.6 plan on the same scope missed (dirigent, 2026-10-01). 5.5 plans ran about 11× larger than earlier plans and drove scope (spacecraft, 2026-09-27). The castigation step trims scope. Dirigent reports properly sized plans since (user, 2026-10-05).
- An independent 5.5 review found 6 Important issues in about 20 min where an in-furnace review had passed; one 5.5 fix pass cleared them in 33 min (dirigent, 2026-10-01).
- Context: comfortable to about 600k (guesstimate, user, 2026-10-05).
@@ -1,23 +1,26 @@
---
name: workpad
description: Decides WHERE and WHEN to put working documents — reports, plans, goals, brainstorms, designs, journals, research, specs, tickets, bug notes. Use this skill whenever the user asks you to write a "report", "plan", "goal", "brainstorm", "design", "journal", "research note", "spec", or anything "in the workpad" — and also when another skill is about to drop a markdown file somewhere ad-hoc (e.g. a plugin's own `docs/<plugin>/` subdirectory, the repo root, `/tmp`, or alongside source code). If a workpad exists, the workpad wins for documents. Non-document output (raw state, streams, gate output) goes to scratch. This skill steers other skills toward one predictable place for markdown documents.
name: quire
description: Decides WHERE and WHEN to put working documents — reports, plans, goals, brainstorms, designs, journals, research, specs, tickets, bug notes. Use this skill whenever the user asks you to write a "report", "plan", "goal", "brainstorm", "design", "journal", "research note", "spec", or anything "in the quire" (formerly "workpad"; the old word still applies) — and also when another skill is about to drop a markdown file somewhere ad-hoc (e.g. a plugin's own `docs/<plugin>/` subdirectory, the repo root, `/tmp`, or alongside source code). If a quire exists, the quire wins for documents. Non-document output (raw state, streams, gate output) goes to scratch. This skill steers other skills toward one predictable place for markdown documents.
allowed-tools: Bash(uv:*)
---
# Workpad
# Quire
Scope: markdown *about* the work (reports, plans, brainstorms, post-mortems). Decides **where** a document goes and **which kind** it is, not its contents. Wins over any other skill's folder (plugin-named folder, sibling `notes/`, repo root).
## Where the workpad lives
## Where the quire lives
First hit wins:
1. **Explicit user instruction** in this conversation.
2. **`WORKPAD_FOLDER`.** Subshells may not inherit it: try `just workpad-folder` (or an equivalent recipe; `just` loads `.env`), then `printenv WORKPAD_FOLDER`. Non-empty path = base.
3. **External tickets folder** outside the repo (e.g. `../<repo>-tickets/`, or `GITEA_TICKETS_DIR`), if configured: base `<tickets-folder>/workpad/`; tickets beside it as `<tickets-folder>/<id>/`. Unsure one exists: ask.
4. **`/docs/workpad`** at the project root, if `/docs` exists.
5. **`/.workpad`**.
6. **Else ask** where; confirm before creating folders.
2. **`QUIRE_FOLDER`.** Subshells may not inherit it: try `just quire-folder` (or an equivalent recipe; `just` loads `.env`), then `printenv QUIRE_FOLDER`. Non-empty path = base.
3. **`WORKPAD_FOLDER`** (old name, fallback): same way, `just workpad-folder`, then `printenv WORKPAD_FOLDER`.
4. **External tickets folder** outside the repo (e.g. `../<repo>-tickets/`, or `GITEA_TICKETS_DIR`), if configured: base `<tickets-folder>/quire/`, or `<tickets-folder>/workpad/` if only that exists; tickets beside it as `<tickets-folder>/<id>/`. Unsure one exists: ask.
5. **`/docs/quire`** at the project root, if it exists. If `docs/workpad/` also exists, use `docs/quire/` and say once that the old folder is there too.
6. **`/docs/workpad`**, if it exists.
7. **`/.quire`**, if it exists.
8. **`/.workpad`**, if it exists.
9. **Else ask** where, offering `docs/quire/` (or `.quire/` without `/docs`); confirm before creating folders. Non-interactive agents (Athanor, gremlins, reviewer, other closed-door agents) take the offer and flag it.
## Folder structure
@@ -30,32 +33,32 @@ Create an on-demand folder when needed, never speculatively. Unknown folders are
## Tiers
- `reports/`: lasting reports, handoffs included. Tracked.
- `logs/<YYYY-MM-DD-hh>-<slug>/`: readable record of one build: `run.md`, `trunk-notes.md`, `review-<scope>.md`, `recheck-<scope>.md`, `brief-<block>.md`. Git-ignored by the guard below. Stays in the main workpad under an active ticket context.
- `logs/<YYYY-MM-DD-hh>-<slug>/`: readable record of one build: `run.md`, `trunk-notes.md`, `review-<scope>.md`, `recheck-<scope>.md`, `brief-<block>.md`. Git-ignored by the guard below. Stays in the main quire under an active ticket context.
- **scratch**: `<repo>/.spire/scratch/<run-slug>/<agent-or-job>/`: raw state (streams, gate output, job files). Git-ignored. `<repo>` = the run log's checkout; run log in another repo or none: the cwd's. Override: `SPIRE_SCRATCH` (gremlins: `--scratch`).
- Git-ignored (`logs/`, scratch, trash): Grep and Glob skip them; use the explicit path or `ls`.
- `W` = `uv run --script "${CLAUDE_SKILL_DIR}/workpad.py"`: any OS or shell, no POSIX snippets, JSON out; `--run <run log>` sets `<repo>`. Briefs to other agents: its absolute path.
- `W` = `uv run --script "${CLAUDE_SKILL_DIR}/quire.py"`: any OS or shell, no POSIX snippets, JSON out; `--run <run log>` sets `<repo>`. Briefs to other agents: its absolute path. If `${CLAUDE_SKILL_DIR}` appears literally, it is this SKILL.md's own folder; resolve it there and do not search elsewhere.
- **Trash**: at build close Igor moves the run dir to `<repo>/.spire/trash/<YYYY-MM-DD>/`, also when `SPIRE_SCRATCH` is set: `W trash <dir>…`. Ignored by the guard; the user empties it.
- **7-day sweep**: run dirs with no file modified in 7 days and no `keep` file: `W sweep --move` (scratch root).
- **Ignore guard** (fallback: `/spire:init` writes `/.spire/` and `<workpad>/logs/` to the root `.gitignore`, or `.git/info/exclude`). Before the first write to `logs/` or `.spire/`, the dispatcher starting the run runs it itself (the Athanor at build start; Igor or Zathras before a dispatch writing there). Never overwrites; `.spire/.gitignore` covers scratch and trash: `W guard <workpad>`.
- **Ignore guard** (fallback: `/spire:init` writes `/.spire/` and `<quire>/logs/` to the root `.gitignore`, or `.git/info/exclude`). Before the first write to `logs/` or `.spire/`, the dispatcher starting the run runs it itself (the Athanor at build start; Igor or Zathras before a dispatch writing there). Never overwrites; `.spire/.gitignore` covers scratch and trash: `W guard <quire>`.
**Never commit:** scratch, `logs/`, gremlin state, Playwright or browser auth state, walker and probe scripts, briefs, real-data dumps, `__pycache__`.
- Browser state and walker or probe scripts live in the run's scratch dir. Promote a script to `scripts/` or tests only by explicit decision.
- During a build the Athanor commits code plus the files its brief names. Igor commits other workpad files after a hand-back, by explicit paths, never while an Athanor commits in the same checkout.
- During a build the Athanor commits code plus the files its brief names. Igor commits other quire files after a hand-back, by explicit paths, never while an Athanor commits in the same checkout.
- A link into scratch or `logs/` is a pointer only: the claim stands on the quoted line.
## Ticket context
**Ticket folder**: `<workpad>/tickets/<id>/` (or `<tickets-folder>/<id>/`), created on demand once the id is known.
**Ticket folder**: `<quire>/tickets/<id>/` (or `<tickets-folder>/<id>/`), created on demand once the id is known.
**Active** only when: the user named the ticket this session ("we're on #42"), a ticket skill opened or created its folder this conversation, or the user asked for a file in the ticket. A folder existing or a number in the branch name does not count. Ticket-shaped but unnamed: ask once, keep the answer. The most recently named ticket stays active until the user switches. Reply names the ticket beside the path.
Routing while active:
- **Ticket folder:** `plans/`, `designs/`, `brainstorm/`, `reports/`, `bugs/`.
- **Main workpad:** `journals/`, `logs/`, `goals/`.
- **`research/`, `specs/`:** main workpad if another ticket would want it, else the ticket folder; a spec outliving the ticket is promoted to the main workpad on close.
- **Main quire:** `journals/`, `logs/`, `goals/`.
- **`research/`, `specs/`:** main quire if another ticket would want it, else the ticket folder; a spec outliving the ticket is promoted to the main quire on close.
Ticket folder: same kind subfolders, naming and subfolder rules; root holds only ticket-level files (`context.md`), never loose plans or reports. Main-workpad files written under a ticket context carry the id in the slug (`2026-05-05-14-42-auth-token-leak.md`).
Ticket folder: same kind subfolders, naming and subfolder rules; root holds only ticket-level files (`context.md`), never loose plans or reports. Main-quire files written under a ticket context carry the id in the slug (`2026-05-05-14-42-auth-token-leak.md`).
## File naming
@@ -2,7 +2,7 @@
# requires-python = ">=3.12"
# dependencies = []
# ///
"""spire:workpad helper: ignore guard, stale-run sweep, trash move. See SKILL.md (Tiers).
"""spire:quire helper: ignore guard, stale-run sweep, trash move. See SKILL.md (Tiers).
Stdlib only, no shell-outs, so it runs the same on Linux, macOS and Windows. Each command prints
one JSON object. Exit 0 ok, 1 when some move failed, 2 refused or a usage error.
@@ -152,7 +152,7 @@ def newest_mtime(d: Path) -> float:
def cmd_guard(args) -> dict:
repo = repo_of(args)
written, present = [], []
for d in (_abs(args.workpad) / "logs", repo / ".spire"):
for d in (_abs(args.quire) / "logs", repo / ".spire"):
(written if ensure_ignore(d) else present).append(str(d / ".gitignore"))
return {"written": written, "present": present}
@@ -201,14 +201,14 @@ def cmd_trash(args) -> dict:
def _parser() -> argparse.ArgumentParser:
p = _Parser(prog="workpad.py", description=__doc__.splitlines()[0])
p = _Parser(prog="quire.py", description=__doc__.splitlines()[0])
sub = p.add_subparsers(dest="cmd", required=True, parser_class=_Parser)
common = _Parser(add_help=False)
common.add_argument("--run", help="the run log; <repo> follows gremlins' scratch rule")
common.add_argument("--repo", help="checkout root (default: from --run, else the cwd's checkout)")
g = sub.add_parser("guard", parents=[common], help="write `*` .gitignore files in <workpad>/logs "
g = sub.add_parser("guard", parents=[common], help="write `*` .gitignore files in <quire>/logs "
"and <repo>/.spire; never overwrite")
g.add_argument("workpad", help="the workpad base dir")
g.add_argument("quire", help="the quire base dir")
s = sub.add_parser("sweep", parents=[common], help="list run dirs under the scratch root with no "
"entry modified in --days and no `keep` file")
s.add_argument("root", nargs="?", help="scratch root (default: $SPIRE_SCRATCH, else "
@@ -16,13 +16,13 @@ SKILL = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(SKILL))
sys.path.insert(0, str(SKILL.parent / "gremlins"))
import workpad # noqa: E402
import quire # noqa: E402
from grm import store # noqa: E402
DAY = 86400
class WorkpadTest(unittest.TestCase):
class QuireTest(unittest.TestCase):
def setUp(self):
self.tmp = Path(tempfile.mkdtemp()).resolve()
self.addCleanup(shutil.rmtree, self.tmp, True)
@@ -32,14 +32,14 @@ class WorkpadTest(unittest.TestCase):
os.environ.pop("SPIRE_SCRATCH", None)
self.repo = self.tmp / "repo"
(self.repo / ".git").mkdir(parents=True)
self.wp = self.repo / "docs" / "workpad"
self.wp = self.repo / "docs" / "quire"
self.scratch = self.repo / ".spire" / "scratch"
self.trash = self.repo / ".spire" / "trash" / datetime.date.today().isoformat()
def w(self, *args, code=0, repo=True):
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
rc = workpad.main([*args, "--repo", str(self.repo)] if repo else list(args))
rc = quire.main([*args, "--repo", str(self.repo)] if repo else list(args))
lines = buf.getvalue().splitlines()
self.assertEqual(len(lines), 1, lines)
out = json.loads(lines[0])
@@ -91,9 +91,16 @@ class WorkpadTest(unittest.TestCase):
self.addCleanup(os.chdir, cwd)
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
self.assertEqual(workpad.main(["guard", str(self.wp)]), 0)
self.assertEqual(quire.main(["guard", str(self.wp)]), 0)
self.assertTrue((self.repo / ".spire" / ".gitignore").exists())
def test_guard_honours_both_base_names(self):
# Regression guard against a future hard-coded folder name in cmd_guard, not a behaviour proof.
for name in ("quire", "workpad"):
base = self.repo / "docs" / name
self.w("guard", str(base))
self.assertEqual((base / "logs" / ".gitignore").read_bytes(), b"*\n")
def test_no_repo_is_refused(self):
# review R2 m5: a checkout above the cwd (here self.repo; on a host, maybe $HOME) is not
# found past GIT_CEILING_DIRECTORIES, as with git
@@ -117,7 +124,7 @@ class WorkpadTest(unittest.TestCase):
self.git("commit", "-q", "--no-verify", "--allow-empty", "-m", "i", cwd=main)
self.git("worktree", "add", "-q", str(self.tmp / "wt"), cwd=main)
wt = self.tmp / "wt"
log = lambda top: top / "docs" / "workpad" / "logs" / "x" / "run.md" # dir not created
log = lambda top: top / "docs" / "quire" / "logs" / "x" / "run.md" # dir not created
cases = [(wt, main, main), (main, wt, wt), (other, main, other), (bare, main, main),
(wt / "src", bare, wt), (bare, bare, None)]
(wt / "src").mkdir()
@@ -139,7 +146,7 @@ class WorkpadTest(unittest.TestCase):
wt.mkdir()
(wt / ".git").write_text("gitdir: %s\n" % (main / ".git" / "worktrees" / "wt"), encoding="utf-8")
self.chdir(wt)
run = main / "docs" / "workpad" / "logs" / "x" / "run.md"
run = main / "docs" / "quire" / "logs" / "x" / "run.md"
self.assertEqual(self.w("sweep", "--run", str(run), repo=False)["root"],
str(main / ".spire" / "scratch"))
src = wt / "run-dir"
@@ -282,7 +289,7 @@ class WorkpadTest(unittest.TestCase):
# entry point
def test_script_runs_standalone(self):
r = subprocess.run([sys.executable, str(SKILL / "workpad.py"), "guard", str(self.wp),
r = subprocess.run([sys.executable, str(SKILL / "quire.py"), "guard", str(self.wp),
"--repo", str(self.repo)], capture_output=True, text=True, timeout=60)
self.assertEqual(r.returncode, 0, r.stderr)
self.assertEqual(len(json.loads(r.stdout)["written"]), 2)
@@ -290,7 +297,7 @@ class WorkpadTest(unittest.TestCase):
def test_usage_error_is_json(self):
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
self.assertEqual(workpad.main(["sweep", "--days", "x"]), 2)
self.assertEqual(quire.main(["sweep", "--days", "x"]), 2)
self.assertEqual(json.loads(buf.getvalue())["error"], "usage")
@@ -0,0 +1,122 @@
"""Tests for spire:adepts roster.sh base-folder resolution (quire, with workpad fallbacks)."""
import os
import shutil
import subprocess
import tempfile
import unittest
from pathlib import Path
ROSTER = Path(__file__).resolve().parents[2] / "adepts" / "roster.sh"
class RosterTest(unittest.TestCase):
def setUp(self):
self.tmp = Path(tempfile.mkdtemp(prefix="roster-"))
self.addCleanup(shutil.rmtree, self.tmp, True)
self.cwd = self.tmp / "proj"
self.cwd.mkdir()
bindir = self.tmp / "bin"
bindir.mkdir()
stub = bindir / "just"
stub.write_text("#!/bin/sh\nexit 1\n", encoding="utf-8") # prints nothing, fails
stub.chmod(0o755)
self.bindir = bindir
def adept(self, base):
d = self.cwd / base / "adepts" / "foo"
d.mkdir(parents=True)
(d / "CLAUDE.md").write_text("---\nsummary: test adept\nstatus: active\n---\n", encoding="utf-8")
def project_md(self, label, base):
(self.cwd / ".claude" / "spire").mkdir(parents=True)
(self.cwd / ".claude" / "spire" / "project.md").write_text(
f"- **{label}**: `{base}`\n", encoding="utf-8")
def run_roster(self, **env):
e = {k: v for k, v in os.environ.items() if k not in ("QUIRE_FOLDER", "WORKPAD_FOLDER")}
e["PATH"] = f"{self.bindir}{os.pathsep}{e['PATH']}"
e.update(env)
r = subprocess.run(["bash", str(ROSTER)], cwd=self.cwd, env=e, capture_output=True, text=True)
self.assertEqual(r.returncode, 0, r.stderr)
return r.stdout
def test_quire_alone(self):
self.adept("docs/quire")
out = self.run_roster()
self.assertIn("docs/quire/adepts/", out)
self.assertIn("**foo**", out)
def test_workpad_alone(self):
self.adept("docs/workpad")
out = self.run_roster()
self.assertIn("docs/workpad/adepts/", out)
self.assertIn("**foo**", out)
def test_both_quire_wins_with_note(self):
self.adept("docs/quire")
self.adept("docs/workpad")
out = self.run_roster()
self.assertIn("## Adept roster — docs/quire/adepts/", out)
self.assertIn("docs/workpad", out.replace("## Adept roster — docs/quire/adepts/", ""))
self.assertIn("also exists", out)
def test_quire_label(self):
self.adept("custom/q")
self.project_md("Quire", "custom/q")
self.assertIn("custom/q/adepts/", self.run_roster())
def test_workpad_label(self):
self.adept("custom/w")
self.project_md("Workpad", "custom/w")
self.assertIn("custom/w/adepts/", self.run_roster())
def test_quire_folder_over_workpad_folder(self):
self.adept("qf")
self.adept("wf")
out = self.run_roster(QUIRE_FOLDER="qf", WORKPAD_FOLDER="wf")
self.assertIn("## Adept roster — qf/adepts/", out)
def test_just_quire_folder_recipe(self):
# the stub answers only `just quire-folder`; docs/quire exists so the recipe must beat detection
(self.bindir / "just").write_text(
'#!/bin/sh\n[ "$1" = quire-folder ] && { echo qf; exit 0; }\nexit 1\n', encoding="utf-8")
self.adept("qf")
self.adept("docs/quire")
out = self.run_roster()
self.assertIn("## Adept roster — qf/adepts/", out)
def test_workpad_folder_alone(self):
# docs/quire exists so the fallback must beat folder detection
self.adept("wf")
self.adept("docs/quire")
out = self.run_roster(WORKPAD_FOLDER="wf")
self.assertIn("## Adept roster — wf/adepts/", out)
def test_quire_folder_beats_existing_workpad_dir(self):
self.adept("qf")
self.adept("docs/workpad")
out = self.run_roster(QUIRE_FOLDER="qf")
self.assertIn("## Adept roster — qf/adepts/", out)
def test_label_beats_folder_detection(self):
self.adept("custom/q")
self.adept("docs/quire")
self.project_md("Quire", "custom/q")
self.assertIn("## Adept roster — custom/q/adepts/", self.run_roster())
def test_dot_quire_beats_dot_workpad(self):
self.adept(".quire")
self.adept(".workpad")
self.assertIn("## Adept roster — .quire/adepts/", self.run_roster())
def test_dot_workpad_found_alone(self):
self.adept(".workpad")
self.assertIn("## Adept roster — .workpad/adepts/", self.run_roster())
def test_none_found_names_docs_quire(self):
out = self.run_roster()
self.assertIn("none (no docs/quire/adepts/)", out)
if __name__ == "__main__":
unittest.main()