/citadel:experimentfrom citadel
Runs metric-driven optimization experiments in isolated worktrees, measuring changes against a fixed baseline with convergence detection.
Ships in citadel. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Coordinate bounded metric-driven experiments in isolated checkouts, retaining candidates locally until the declared verification and independent review pass.
The user provides three things:
node tools/bundle-bytes.cjs)Ask only for missing inputs that cannot be resolved from the request or project. The metric MUST exit successfully and output a single finite number to stdout.
Run commands from the intended isolated checkout. Bind CLAUDE_PROJECT_DIR for
each child process to that checkout so timeout/telemetry helpers cannot write into
the user's source checkout. Use the installed timeout helper (in Citadel itself,
node scripts/run-with-timeout.js 300 <command> [args...]).
For each iteration (up to budget):
Promotion is separate from KEEP. Only after all gates pass may an already authorized local integration proceed into a safe, clean destination. Recheck the resulting integration subject with the declared checks and independent review if its content differs. Otherwise leave the candidate local and report the held gate. Never push, publish, or overwrite dirty work as part of the optimization loop.
After each iteration, check:
Calculate diminishing returns against the previous retained best. Keep reporting overall improvement against the original baseline; never replace that baseline. For a zero baseline, report absolute delta instead of dividing by zero.
Create and update .planning/research/experiment-{unique-slug}.md in the isolated
run checkout; do not overwrite another run's report. Include the frozen plan and
identities from Step 1, followed by:
# Experiment: {Description}
> Metric: `{command}`
> Direction: {lower|higher} is better
> Scope: {glob pattern}
> Budget: {N iterations}
> Date: {ISO date}
> Original incumbent: {commit and evaluator hashes}
> Checks: {commands, acceptance conditions, repeat/noise policy}
## Results
| Iteration / Commit | Value | Delta from original / best | Verdict | Checks / Review / Evidence |
|--------------------|-------|----------------------------|---------|----------------------------|
| baseline / {sha} | {N} | — | — | {paths} |
| 1 / {sha} | {N} | {+/-} / {+/-} | KEEP | {paths} |
| 2 / {sha} | {N} | {+/-} / {+/-} | HELD | {reason and paths} |
## Outcome
- **Start**: {baseline}
- **Best verified local candidate**: {value and commit, or none}
- **Improvement**: {percentage}
- **Iterations**: {kept}/{total}; held: {N}
- **Stop reason**: {convergence|diminishing|budget|held gate}
- **Integration**: {not attempted|held with reason|verified target commit}
- **Source checkout preservation**: {before/after dirty-file hashes and index/status comparison}
## Retained Local Changes
{Changes, commit hashes, checkout paths, and any unresolved gates}
Log the run through the existing integrity-aware telemetry writer, with the
isolated run checkout as CLAUDE_PROJECT_DIR:
node .citadel/scripts/telemetry-log.cjs --event agent-complete --agent experiment --session {slug} --status {success|partial|failed}
In Citadel itself use scripts/telemetry-log.cjs. Put detailed results in the
report; use partial for held gates. The writer supplies _hash and _hash_v: 1.
If unavailable, report that limitation; never append raw JSONL or fabricate hashes.
| Goal | Numeric output from the project metric command |
|---|---|
| Reduce bundle size | Built bundle bytes; a failed build is a failed measurement |
| Increase throughput | Operations per second under the fixed workload |
| Reduce latency | A predeclared percentile in milliseconds |
| Reduce file/line count | Count within a fixed scope, with behavioral checks retained |
Disclosure: "Running isolated experiment on [target] from [commit], with metric [command] and checks [plan]. Budget: [N]. Verified candidates remain local until integration gates pass." Reversibility: amber — experiment-owned local commits/checkouts are retained with evidence; the source checkout stays intact. Trust gates:
Metric outputs nothing, non-numeric text, NaN/infinity, or exits nonzero: Invalid measurement. Resolve the baseline command before starting; discard a candidate measurement failure. Pipelines must preserve the measured command's failure status rather than hiding it behind a successful text filter.
No worktree support: Use a separate clean local clone at the recorded commit. A branch in the same checkout is not isolation. If neither is possible, stop as held and provide the plan; do not edit the source checkout.
If .planning/research/ does not exist: Create it before writing the experiment report. If .planning/ itself doesn't exist, create the full path or output the report inline.
Budget exhausted with zero kept iterations: Report outcome as "no improvement found". This is a valid result — do not continue past the budget.
---HANDOFF---
- Experiment: {description}
- Result: {original baseline} → {best verified local value}; retained {N}/{total}
- Gates / integration: {passed, held or failed; target commit if integrated}
- Stop reason / report: {reason}; {isolated report path}
- Preservation / recovery: {source hashes unchanged or observed discrepancy}; {retained local commits and paths}
---
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sethgammon/citadel --plugin citadel48 skills in this plugin
/architectGiven a PRD, produces an implementation architecture: file tree, component breakdown, data model, and a phased build plan with end conditions that Archon can execute directly. Multi-candidate evaluation for key decisions./archonAutonomous multi-session campaign agent. Decomposes large work into phases, delegates to sub-agents, reviews output, and maintains campaign state across context windows. Use for work that spans multiple sessions and needs persistent state, quality judgment, and strategic decomposition./ascii-diagramGenerate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.Other plugins' skills for the same job