/session-orchestrator:evolve [analyze|review|list|dialectic [--apply]]from session-orchestrator
Extracts session patterns into reusable learnings. Three modes: analyze (extract from session history), review (edit/manage existing learnings), list (display active learnings). Manages .orchestrator/metrics/learnings.jsonl.
Ships in session-orchestrator. 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.
Platform Note: State files use the platform's native directory:
.claude/(Claude Code),.codex/(Codex CLI), or.cursor/(Cursor IDE). Shared metrics live in.orchestrator/metrics/(v2) with fallback to<state-dir>/metrics/for pre-v2.0 legacy data. Seeskills/_shared/platform-tools.md.
Plugin root:
${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
Invoked as /evolve [analyze|review|list|dialectic [--apply]] with mode: $ARGUMENTS (if empty, default to analyze — parsed in Step 1.3).
Analyze session history for patterns, review existing learnings, list active intelligence, or derive USER.md/AGENT.md peer-card updates via the dialectic mode. Every learning must be confirmed by the user before persisting. Evidence before assertions.
Read skills/_shared/bootstrap-gate.md and execute the gate check. If the gate is CLOSED, invoke skills/bootstrap/SKILL.md and wait for completion before proceeding. If the gate is OPEN, continue to Phase 1.
Telemetry start marker (#1200): note the current wall-clock time before Step 1.1 runs (e.g. date +%s%3N, or the coordinator's own turn-start instant). Every orchestrator.evolve.completed emit in Phase 1 / Phase 3 below reports duration_ms (placeholder DURATION_MS) as the elapsed milliseconds since this marker — same in-memory-value convention as CT/AC/ASK/DROP in skills/session-end/SKILL.md's orchestrator.handover.gated emits.
Read and parse Session Config per skills/_shared/config-reading.md. Store result as $CONFIG.
Extract persistence from $CONFIG. If persistence is false, abort with message:
"Learnings require persistence to be enabled in Session Config. Add
persistence: trueto your Session Config block (CLAUDE.md for Claude Code, AGENTS.md for Codex CLI)."
Telemetry on abort (#1200, #1206): before stopping, emit the abort form of the run-completion event. Kept as a minimal emit-event.mjs call, not routed through scripts/sweep-expired-learnings.mjs — no store-write CLI has run yet at this gate (it fires before Step 1.4 even reads learnings.jsonl), so there is no mechanical pipeline call site to fold this emit into, unlike the Step 3.5(5)/(6) success path below:
node "${CLAUDE_PLUGIN_ROOT}/scripts/emit-event.mjs" --type orchestrator.evolve.completed --payload \
"$(node -e "process.stdout.write(JSON.stringify({aborted: 'persistence-disabled', reason: 'Learnings require persistence to be enabled in Session Config.'.slice(0,300), duration_ms: DURATION_MS}))")"
Read mode from $ARGUMENTS:
analyzeanalyze, review, list, dialecticLazy-create defensive (#185): If .orchestrator/metrics/learnings.jsonl does not exist (pre-#185 repo or bootstrap skipped), create an empty file and emit an info log — do NOT hard-fail:
LEARNINGS_FILE=".orchestrator/metrics/learnings.jsonl"
if [[ ! -f "$LEARNINGS_FILE" ]]; then
mkdir -p "$(dirname "$LEARNINGS_FILE")"
: > "$LEARNINGS_FILE"
echo "info(#185): auto-created $LEARNINGS_FILE (was missing)" >&2
fi
This defensive step is idempotent and cheap — it ensures /evolve analyze|review|list never fails because of a missing artifact file.
.orchestrator/metrics/sessions.jsonl (session history). If it does not exist, check <state-dir>/metrics/sessions.jsonl as a legacy fallback (where <state-dir> is .claude/, .codex/, or .cursor/ per platform). If neither exists, warn: "No session history found. Run at least one session first.".orchestrator/metrics/learnings.jsonl if it exists. If not found, check <state-dir>/metrics/learnings.jsonl as a legacy fallback.expires_at < current date (expired)Route based on mode:
analyze → Phase 3review → Phase 4list → Phase 5dialectic → Phase 6Extracts learnings from session history: pattern extraction across the 9 built-in analyzer types plus evolve.extra-sources, deduplication, relation judgment (#1016), the AskUserQuestion confirmation gate, and the archive-safe write pipeline (through the C2 auto-repair feeder). See references/evolve-analyze-mode.md. Read WHEN: Phase 2's Mode Dispatch routes to analyze (the default mode).
Agent-usage census (#1617). Before extraction, run node "${CLAUDE_PLUGIN_ROOT}/scripts/agent-usage-census.mjs" --days 14 (read-only over ~/.claude/projects subagent transcripts, ~20 s for 14 days). Report the model shares and the top agent types (runs, turns/run, output/run, cache rebuilds, start context) in the analyze summary, and quote malformed_lines. It is an observation, not a learning source: nothing is written from it, and a shift (a type moving model, a new dominant type) goes to the operator as a finding. Housekeeping step 4 runs /evolve analyze, so the weekly maintenance loop carries the census without a second entry.
Interactive management of existing learnings.
.orchestrator/metrics/learnings.jsonl. If not found, check <state-dir>/metrics/learnings.jsonl as a legacy fallback./evolve analyze first."Present a formatted table grouped by type. Include the Effective column — the recency-decayed surfacing score (#670) — so stale high-confidence entries are visible as decay candidates next to their static confidence:
## Active Learnings
| # | Type | Subject | Confidence | Effective | Expires | Insight |
|---|------|---------|------------|-----------|---------|---------|
| 1 | fragile-file | src/lib/auth.ts | 0.80 | 0.78 | 2026-07-05 | Changed in 4 of last 5 sessions |
| 2 | effective-sizing | feature-session-sizing | 0.65 | 0.61 | 2026-06-20 | Feature sessions work well with 3 agents/wave |
| ... | ... | ... | ... | ... | ... | ... |
Summary: N active learnings (M high confidence, K expiring soon)
Effective (decayed) score — #670. Retrieval/surfacing ranks by an
effectiveScore = max(confidence × 0.5^(ageDays / halfLifeDays), confidence × floorFactor)blend, NOT raw confidence.ageDaysderives fromlast_reinforced/last_accessed/updated_atwhen present, elsecreated_at. So a stale high-confidence learning ranks below a fresh mid-confidence one, while thefloorFactor(default 0.1) guarantees a durable learning never collapses to ~0. Tuned under the existingevolve:Session Config block (decay-enabled: true,decay-half-life-days: 90,decay-floor-factor: 0.1— all conservative defaults; setdecay-enabled: falseto restore pure-confidence ordering). Implemented inscripts/lib/learnings/surface.mjs(effectiveScore+surfaceTopN). The confidence FILTER (> 0.3) is unchanged — decay re-ranks survivors, it does not change eligibility.
Use AskUserQuestion with options:
On Codex CLI where AskUserQuestion is unavailable, present as a numbered Markdown list.
AskUserQuestion({
questions: [{
question: "What would you like to do with your learnings?",
header: "Learnings",
options: [
{ label: "Confidence ändern", description: "Pick the learnings, then the direction: +0.15 or -0.2. Cheapest fix when a learning is merely mis-weighted." },
{ label: "Ablauf verlängern", description: "Keeps a still-useful learning alive: its expiry date moves to today plus the configured window. Confidence is untouched." },
{ label: "Delete specific learnings", description: "Takes the selected learnings out of the store. They are archived rather than shredded, but they stop influencing anything." },
{ label: "Done — no changes", description: "Leaves the store exactly as it is and ends the review. Nothing is written." }
]
}]
})
If user selects "Confidence ändern", "Ablauf verlängern", or "Delete specific learnings", present a follow-up AskUserQuestion with multiSelect: true listing all learnings by # | type | subject so the user can select which ones to modify. For "Confidence ändern" the same follow-up also asks for the direction — Boost (+0.15) or Reduce (-0.2). Both operations are unchanged; only the point at which the direction is chosen moved, because a single AskUserQuestion accepts at most 4 options and the previous list had 5.
On Codex CLI where AskUserQuestion is unavailable, present as a numbered Markdown list.
Use the same archive-safe pipeline as Phase 3, Step 3.5 — never a hand-rolled > rewrite (#1017):
--prune --snapshot,
with the same --file / --archive the apply will use) and work on the sidecar, never on a
separate read of learnings.jsonl (#1486). A snapshot exit 1 (a malformed store line, or a
PATH that would replace a ledger) wrote nothing: surface it and stopderiveExpiresAt(now, type) (per-type TTL, scripts/lib/learnings/schema.mjs)pruneLearnings() detects every record that left the store — reconciled by id, or by a
content fingerprint when a record carries no usable id — and archives it with
_archive_reason: "pruned", so a learning-id referenced by a rendered rule stays resolvable.deriveExpiresAt(now, type) — learning-expiry-days is parsed but read by no script (skills/_shared/config-reading.md § Learning Expiry Semantics)pruneLearnings() — run the
exact Step 3.5(5) invocation, writing the post-operation entry set to the --entries
sidecar below its line-1 _store_generation header. Exit 1 or 2: surface the error and
stop (1 includes a sidecar snapshotted from another store than --file). Exit 3 means the
store changed after the snapshot and nothing was written: snapshot into a FRESH path,
re-apply the selected operations to the records in that file, and apply it once more — a
second consecutive 3: stop and report. Never move the fresh header onto the old sidecar's
records, whose missing peer change the prune would archive pruned (Step 3.5(5) carries the
full exit-code rule). It prunes
(expires_at < now → expired; confidence <= 0.0 → pruned), consolidates duplicates
(same type + non-empty subject, highest confidence wins, loser archived superseded with
_superseded_by; null-subject entries preserved individually per #284), and rewrites through
rewriteLearnings() with its .bak-<ISO> snapshot.Report: "Updated N learnings. Total active: K. Archived: A ()."
Simple read-only display.
.orchestrator/metrics/learnings.jsonl. If not found, check <state-dir>/metrics/learnings.jsonl as a legacy fallback./evolve analyze to extract patterns from session history."Display a formatted table grouped by type:
## Active Learnings
### fragile-file
| Subject | Confidence | Expires | Insight |
|---------|------------|---------|---------|
| ... | ... | ... | ... |
### effective-sizing
| Subject | Confidence | Expires | Insight |
|---------|------------|---------|---------|
| ... | ... | ... | ... |
(repeat for each type that has entries)
Display summary line:
N active learnings (M high confidence, K expiring soon)
Single-pass LLM derivation of USER.md + AGENT.md (peer cards) updates from current learnings + sessions + steering files, dry-run-default per #506 EARS contract. See references/evolve-dialectic-mode.md. Read WHEN: Phase 2's Mode Dispatch routes to dialectic.
learnings.jsonl without reading it first — race condition preventionuuidgen or equivalent bash command)expires_at; otherwise derive it from LEARNING_TTL_DAYS[type] via deriveExpiresAt() rather than hard-coding learning-expiry-dayspruneLearnings() / rewriteLearnings() — never a shell
> rewrite and never an append >>. Those helpers own the schema validation, the .bak-<ISO>
snapshot, and the atomic tmp+rename; a hand-rolled redirect owns none of them (#721, #1017)learnings-archive.jsonl — a record may leave the STORE,
but it may never leave the CORPUS. Rendered .claude/rules/*.md cite learning-id as provenance;
a hard delete turns that citation into a dangling pointer (#1017 measured 11 of 13 dead)learnings.jsonl with >>, and DO NOT rewrite it with > — call
pruneLearnings() (Step 3.5(5)); a shell redirect bypasses validation, backup, and the archive_archive_reason (expired | pruned | superseded | merged) and, for the last two, a
_superseded_by / _merged_into tombstone naming its replacementWhat SKILL.md sets; muted values are Claude Code's defaults
sonnetThree short reads, in order
npx claudepluginhub kanevry/session-orchestrator --plugin session-orchestrator55 skills in this plugin
/architectureUse when the user asks to improve architecture, find refactoring opportunities, surface deepening opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable. Surfaces shallow modules and hypothetical seams using a precise vocabulary (Module / Interface / Implementation / Depth / Seam / Adapter / Leverage / Locality from LANGUAGE.md)./autopilotUse this skill when running an autonomous session-orchestration loop. Chains session-start → session-plan → wave-executor → session-end for N iterations with all 10 kill-switches (SPIRAL, FAILED wave, carryover > 50%, max-hours, max-sessions, resource-overload, token-budget, stall-timeout, sub-threshold confidence, user-abort). Reads Mode-Selector output (Phase B) to decide auto-execute vs. fallback. Writes one autopilot.jsonl record per loop run. Phase C scaffold (issue #277); implementation lives in scripts/lib/autopilot.mjs (Phase C-1 follow-up).
/backlogUse when a repository's issue backlog needs refinement so agents can start work without asking back. Measures the tracker with scripts/backlog-refine.mjs (labels, readiness of status:ready issues, size, dependencies, epics, closed-issue hygiene), then proposes splits, epics, merges, fills and closings for approval and applies them through gitlab-ops. Triggered by /backlog [repo], "refine the backlog", "is the backlog ready for agents", "Backlog aufräumen". Not for finding code defects (use discovery), not for cross-repo dashboards (use portfolio), and not for creating issues from scratch./bootstrapUse this skill when scaffolding the minimum repository structure required by session-orchestrator. Invoked automatically by the Bootstrap Gate when CLAUDE.md, Session Config, or bootstrap.lock is missing. Also available as /bootstrap for manual invocation. Three intensity tiers: fast (demos/spikes), standard (MVPs), deep (production/team).
/brainstormUse when you have a feature idea but the scope or UX is still ambiguous — runs a lightweight Socratic design dialogue (3-5 AUQ rounds) and writes a spec markdown file. Use BEFORE /plan feature when product intent needs validation; skip to /plan feature when scope is already clear. HARD-GATE prevents any code work until the design is user-approved./claude-md-drift-checkUse when detecting drift between CLAUDE.md (or AGENTS.md, the Codex CLI alias) / _meta narrative and live repository state. Ten checks: absolute-path resolution, 01-projects/ count claims, issue-reference freshness, session-file existence, command-count sync, session-config-parity (mandatory template keys = error, opt-in gaps = note, unknown local keys = warning), vault-dir-parity (CLAUDE.md vs AGENTS.md), generated-rule-staleness (WARN-only), rule-scoping (paths:/globs: frontmatter defects, dangling rule citations, zero-match globs), and docs-parity (docs/components.md count-claims vs on-disk counts, template-vs-reference config-key parity, stale .claude/metrics/ paths). Full per-check spec in the body table. Invoked as an opt-in session-end phase; mirrors vault-sync's lean JSON+exit-code contract.
Other plugins' skills for the same job