advise
Critical thinking analysis - validates alignment, challenges assumptions, identifies risks
Analyze recent sessions to detect intent evolution, drift, and propose alignment updates
$ npx -y skills add akaszubski/autonomous-dev --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/retrospectiveContext preview
What this command does when you run it.
Analyze recent sessions to detect intent evolution, drift, and propose alignment updates
name: retrospective description: "Analyze recent sessions to detect intent evolution, drift, and propose alignment updates" argument-hint: "[--sessions N] [--dry-run] [--auto-file] [--date YYYY-MM-DD]" allowed-tools: [Task, Read, Bash, Glob, Grep] user-invocable: true user_facing: true
Analyze recent session activity to detect intent evolution, repeated corrections, config drift, and stale memory entries. Produces tiered findings (IMMEDIATE/REVIEW/ARCHIVE) with proposed alignment edits.
# Analyze last 20 sessions (default) /retrospective # Analyze more sessions /retrospective --sessions 40 # Dry run — compute findings without launching agent /retrospective --dry-run # Also create GitHub issues for findings /retrospective --auto-file # Analyze sessions from a specific date /retrospective --date 2026-03-15
Extract flags from the user's input:
Use the `retrospective_analyzer.py` library to load session data:
cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" && python3 -c "
import sys, json, os as _os
for _p in ('.claude/lib', 'plugins/autonomous-dev/lib', _os.path.expanduser('~/.claude/lib')):
if _os.path.isdir(_p):
sys.path.insert(0, _p)
break
from retrospective_analyzer import load_session_summaries, RetrospectiveConfig
from pathlib import Path
logs_dir = Path('.claude/logs/activity')
if not logs_dir.exists():
print(json.dumps({'error': 'No activity logs found at .claude/logs/activity/'}))
sys.exit(0)
config = RetrospectiveConfig(max_sessions=${MAX_SESSIONS:-20})
summaries = load_session_summaries(logs_dir, max_sessions=config.max_sessions)
result = []
for s in summaries:
result.append({
'session_id': s.session_id,
'date': s.date,
'stop_messages': s.stop_messages[:5],
'commands_used': s.commands_used,
'corrections': s.corrections[:10],
})
print(json.dumps(result, indent=2))
"If `--date` is specified, filter summaries to that date.
If no logs found, report: "No activity logs found. The session_activity_logger hook must be active to generate logs."
Read current alignment documents:
1. **PROJECT.md**: Read `.claude/PROJECT.md` — extract goals and scope 2. **CLAUDE.md**: Read `CLAUDE.md` — extract critical rules and commands 3. **Memory files**: Read `.claude/memory/MEMORY.md` if it exists (check both project and global locations)
Run all three detection functions:
cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" && python3 -c "
import sys, json, os as _os
for _p in ('.claude/lib', 'plugins/autonomous-dev/lib', _os.path.expanduser('~/.claude/lib')):
if _os.path.isdir(_p):
sys.path.insert(0, _p)
break
from retrospective_analyzer import (
load_session_summaries, detect_repeated_corrections,
detect_config_drift, detect_memory_rot, format_as_unified_diff,
RetrospectiveConfig
)
from pathlib import Path
logs_dir = Path('.claude/logs/activity')
summaries = load_session_summaries(logs_dir, max_sessions=${MAX_SESSIONS:-20})
# 1. Repeated corrections
corrections = detect_repeated_corrections(summaries, min_threshold=${MIN_THRESHOLD:-3})
# 2. Config drift
config_drift = detect_config_drift(Path('.'), baseline_commits=20)
# 3. Memory rot
memory_dir = Path('.claude/memory')
memory_rot = detect_memory_rot(memory_dir, summaries, decay_days=90) if memory_dir.exists() else []
# Format output
findings = []
for f in corrections + config_drift + memory_rot:
entry = {
'category': f.category.value,
'severity': f.severity.value,
'description': f.description,
'evidence': f.evidence,
}
if f.proposed_edit:
entry['proposed_diff'] = format_as_unified_diff(f.proposed_edit)
findings.append(entry)
print(json.dumps(findings, indent=2))
"**If `--dry-run`**: Present findings directly in three tiers (IMMEDIATE, REVIEW, ARCHIVE) without agent analysis.
**Otherwise**: Launch the `retrospective-analyst` agent (Task tool, subagent_type: retrospective-analyst) with: 1. Session summaries from STEP 2 2. Drift findings from STEP 4 3. Alignment context from STEP 3 4. Instructions to categorize, analyze intent shifts, and propose edits
Present the analysis report:
RETROSPECTIVE ANALYSIS ====================== Period: [earliest date] to [latest date] Sessions analyzed: [N] IMMEDIATE (requires action now): [findings with proposed diffs] REVIEW (investigate when convenient): [findings with evidence] ARCHIVE (safe to remove/archive): [findings with proposed diffs]
If `--auto-file` flag is set, file issues for IMMEDIATE findings only:
1. REQUIRED: Verify no duplicate issues exist before creating new ones:
gh issue list -R akaszubski/autonomous-dev --label retrospective --state open
2. **Prior-call ordering contract (Issue #1203)**: the PreToolUse hook evaluates each Bash invocation BEFORE it runs. **FORBIDDEN: Do NOT bundle the context write and `gh issue create` into one Bash tool call** — the hook would not see the context at evaluation time and would block (see #1203). The context-file WRITE MUST be a separate Bash tool call PRECEDING any `gh issue create`; the cleanup MAY (and SHOULD) chain onto
A harness that wraps Claude Code with enforcement, specialist agents, and alignment gates to deliver consistent, production-grade software engineering outcomes.
Repo: akaszubski/autonomous-dev
Critical thinking analysis - validates alignment, challenges assumptions, identifies risks
Comprehensive quality audit - code quality, documentation, coverage, security
Autonomous experiment loop — hypothesize, modify, benchmark, commit or revert
Create GitHub issue with automated research (--quick for fast mode)
Autonomous queue drainer — picks the top /triage cluster, applies safety gates, drains via /implement --issues, pushes, deploys.