Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/agent-memory/leverage-advisor/MEMORY.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- [session-2026-04-11.md](session-2026-04-11.md) — First run: 5 plans created, violation-scan.sh built end-to-end; session-health stats gap is highest-leverage omission
- [session-2026-04-11.md](session-2026-04-11.md) (First run: 5 plans created, violation-scan.sh built end-to-end; the session-health stats gap it found is closed)
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ type: project

Five plans created on 2026-04-11. Addition winner (violation-scan.sh, 10/12) was built end-to-end in the same run. Omission winner (session-health stats gap, 11/12) is now closed: `scripts/session-health.sh` defines the `stats` subcommand.

**Why:** `weekly-learner` and `tdd-loop-optimizer` call `scripts/session-health.sh stats`, and the subcommand exists. The earlier gap is closed.
**Why:** `weekly-learner` calls `scripts/session-health.sh stats`, and the subcommand exists. The earlier gap is closed.

**How to apply:** Re-derive any session-analysis gap from the current scripts. The `leverage-missed-session-stats` plan is gone.

Key subtraction findings (in execution order). The plan files are gone, so treat
these as candidates to re-derive:
1. Merge the skill-loop optimizer into `simplification-agent` (must run first).
2. Consolidate the commit skill with the `smart-commit` agent.
3. Absorb the confirmation reducer into the merged agent (depends on 1).
31 changes: 16 additions & 15 deletions .claude/agents/analyzer-review-miner.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ for every candidate that scores 3 or higher and list them in your final report.
Gather 3-day git history and saved review findings. Use `scripts/diff.sh --json`,
`scripts/session-health.sh`, and git log for the analysis window. Read the latest
`plans/review-*` directory through `scripts/internal/review-findings.sh --json`.
Also check for saved review artifacts in `.claude/tmp/cr-*.diff`.

If the unified diff exceeds 2000 lines, scope to the 10 most-changed files from
`scripts/diff.sh` output and diff those individually.
Expand All @@ -44,8 +43,9 @@ For each changed file, identify:
- Corresponding added lines (`+`) that represent the fix
- Whether the same transformation appears in multiple files (frequency signal)

Cross-reference each discovered pattern against the existing catalog in
`lode/dotnet/analyzer-candidates.md` (create if missing) to check for overlap with existing
Cross-reference each discovered pattern against the open register
`lode/dotnet/analyzer-candidates/index.md`, the settled `catalog.md`, and
`skipped-decisions.md` in the same directory to check for overlap with existing
or planned analyzers. Focus on patterns not already covered, immutability violations,
missing format providers, test correctness gaps, and similar structural fixes.

Expand All @@ -57,14 +57,15 @@ missing format providers, test correctness gaps, and similar structural fixes.

## Phase 3: Cross-Reference with Analyzer Catalog

Read `lode/dotnet/analyzer-candidates.md` (create with a header row if it does not exist).
Read `lode/dotnet/analyzer-candidates/index.md` (open candidates), `catalog.md` (shipped rules),
and `skipped-decisions.md` (declined shapes) in that directory.

For each extracted pattern from Phase 2:
1. Search the catalog for the same pattern (case-insensitive, fuzzy match on description)
2. **If already `implemented`**: skip entirely: an analyzer already covers it
3. **If already `planned` or `new`**: note the existing candidate, update its frequency count if higher
4. **If already `skipped`**: check whether the reason still holds (e.g., "0 violations", if violations were just found, the reason is now stale). If stale, flip to `new` with updated evidence.
5. **If not in catalog**: it is a new candidate, proceed to scoring
1. Search the three files for the same pattern (case-insensitive, fuzzy match on description)
2. **If `catalog.md` lists it as shipped**: skip entirely: an analyzer already covers it
3. **If `index.md` lists it as `planned` or `new`**: note the existing candidate, update its frequency count if higher
4. **If `skipped-decisions.md` lists it**: check whether the reason still holds (e.g., "0 violations", if violations were just found, the reason is now stale). If stale, add a `new` row to `index.md` with updated evidence.
5. **If in none of the three**: it is a new candidate, proceed to scoring

---

Expand All @@ -90,10 +91,10 @@ Candidates with score 1-2 are still cataloged (for future evidence accumulation)

## Phase 5: Update Analyzer Catalog

For each candidate, re-read `lode/dotnet/analyzer-candidates.md` (do not use cached content),
add new rows with `status=new`, update any `skipped` rows where evidence has changed,
and bump the timestamp (`scripts/ts.sh lode/dotnet/analyzer-candidates.md`). For candidates
scoring >= 3, add a detail section above the catalog table with:
For each candidate, re-read `lode/dotnet/analyzer-candidates/index.md` (do not use cached content),
add new rows with `status=new`, reopen a skipped shape only with fresh evidence,
and bump the timestamp (`scripts/ts.sh lode/dotnet/analyzer-candidates/index.md`). For candidates
scoring >= 3, add a detail section as step 3 of "Working The Register" in `index.md` describes, with:
```
## Candidate: {short name} - {score}/5
**Pattern**: {description of what to flag}
Expand Down Expand Up @@ -123,7 +124,7 @@ Follow the budget exhaustion protocol in `lode/infrastructure/agent-patterns.md`

## Rules

- **No re-suggesting implemented analyzers**: check `status=implemented` first
- **No re-suggesting shipped analyzers**: check `catalog.md` first
- **Respect skipped entries**: un-skip only if fresh evidence contradicts the skip reason
- **Score honestly**: a pattern seen once gets frequency=2 only when a code review report explicitly flagged it as HIGH/CRITICAL
- **Lode file size gate**: before appending to `lode/dotnet/analyzer-candidates.md`, check `wc -l`. If > 200 lines, decompose into a focused sub-file first.
- **Lode file size gate**: before appending to `lode/dotnet/analyzer-candidates/index.md`, run `scripts/lode-guard.sh` on it. If it reports the file over the limit, decompose into a focused sub-file first.
2 changes: 1 addition & 1 deletion .claude/agents/build-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ Return a structured summary in this exact format:
- **Include file paths** — so the caller can navigate directly to issues
- **TreatWarningsAsErrors is enabled** — any warning IS an error in this project
- **Never edit source files** — you are read-only. Report issues for the caller to fix.
- If everything passes, keep the response to 3-4 lines
- If everything passes, return only the three status lines and omit the Errors, Failed Tests, and Warnings sections
17 changes: 16 additions & 1 deletion .claude/agents/naming-migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ open is invalidated. Re-Read each file you intend to Edit before the next Edit
read seconds earlier. A format/check run without a follow-up Re-Read is the single largest
source of `file_not_read` errors.

## Worktree Verification Boundary

Keep worktree isolation. Read `lode/infrastructure/agent-worktree-builds.md` before any command that builds or tests.
A nested worktree loads ancestor `.globalconfig` files and can report phantom diagnostics.

In a nested worktree, use the parent's diagnostic records instead of running Phase 1.
If the records are missing, ask the parent to collect them in the primary checkout.
Apply the approved renames, then return the changed files and mark Phase 3 as pending parent verification.
Do not run diagnostics, build, test, format, or check scripts in that worktree.
The parent integrates the changes, then runs `scripts/check.sh --json` in the primary checkout.
If verification fails, the parent returns the diagnostics for the next rename pass.
A worktree outside the repository tree can run the phases below without the ancestor collision.

## Phase 1: Collect Violations

```bash
Expand Down Expand Up @@ -99,10 +112,12 @@ rg --word-regexp "OldName" src/ tests/ benchmarks/ -g "*.cs"
## Phase 3: Verify Build

```bash
scripts/check.sh --no-format --json
scripts/check.sh --json
```

- **Clean:** go to Report.
- **Format step fails:** run `scripts/format.sh --changed`, then `scripts/format-invalidate.sh`,
re-Read each file it lists, and re-run Phase 3.
- **Remaining IDE1006** and iteration < 3: loop to Phase 1.
- **Compilation errors (CS0246, etc.):** a reference site was missed — find it, apply the
rename, re-run Phase 3. These do NOT count as loop iterations.
Expand Down
17 changes: 15 additions & 2 deletions .claude/agents/refactoring-specialist.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Prefer these single-call scripts over multi-step `rg` chains:
| Read one method body | `scripts/code-read.sh --method X path.cs` | Full-file Read + manual scan |
| File structure outline | `scripts/file-outline.sh path.cs --json` | Glob + Read to understand structure |
| Dependency graph | `scripts/deps.sh TypeName --json` | Phase 0 manual dependency chain mapping |
| DI registrations | dump DI registrations (e.g. `rg "services.Add" src/`) | `rg "services.Add" src/` |
| Files needing re-read after format | `scripts/format-invalidate.sh --json` | Guessing which files format touched |

Use MCP tools first for semantic analysis. Fall back to these scripts. Fall back to raw `rg` last.
Expand Down Expand Up @@ -69,6 +68,19 @@ Concerns: [what's unclear — empty for LOW]

Run `scripts/lode-summary.sh dotnet` to load SOLID principles, coding standards, performance patterns, and anti-patterns from the lode before analyzing source. Use the returned file list to read the relevant standards files as needed, they calibrate the analysis lens in Analysis (step 1) without loading the full lode-map.

## Worktree Verification Boundary

Keep worktree isolation. Read `lode/infrastructure/agent-worktree-builds.md` before any command that builds or tests.
A nested worktree loads ancestor `.globalconfig` files and can report phantom diagnostics.

In a nested worktree, use the parent's baseline diagnostics and test results.
Write tests before implementation, but do not run diagnostics, build, test, format, or check scripts there.
Return the changed files, required test classes, and unresolved questions to the parent.
Mark verification as pending, not passed.
The parent integrates the changes, then runs `scripts/check.sh --json` in the primary checkout.
If verification fails, the parent returns the diagnostics for the next refactoring pass.
A worktree outside the repository tree can run the verification steps below without the ancestor collision.

## Workflow

### File Freshness Protocol
Expand Down Expand Up @@ -122,7 +134,8 @@ Before declaring done:
## .NET Style Compliance

All generated or modified C# code must comply with `.editorconfig` and `.globalconfig`. Key constraints:
- **Block bodies only** for methods, constructors, operators, and local functions, never use `=> expr` (IDE0021/IDE0022/IDE0061)
- **Block bodies only** for methods, constructors, and operators, never use `=> expr` (IDE0021/IDE0022)
- A local function takes `=> expr` only when its body fits on one line (IDE0061, `when_on_single_line`)
- Expression bodies are allowed for properties and accessors
- Using directives must be **outside** the namespace block
- Read target files before editing to match their existing code style
Expand Down
6 changes: 3 additions & 3 deletions .claude/agents/smart-commit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name: smart-commit
color: blue
description: >
Zero-friction commit: stages all tracked modified files (excluding secrets), drafts a
conventional commit message from the diff, and commits with a name-only co-author trailer
(never an email), no intermediate confirmation gates. The canonical commit path for this
Zero-friction commit: stages all modified tracked files and new files (excluding secrets),
drafts a conventional commit message from the diff, and commits with no attribution trailer
and no intermediate confirmation gates. The canonical commit path for this
repo. Use when changes are clearly scoped and the user just wants the commit done.
Triggers on: commit, just commit, fast commit, commit everything, commit without asking,
auto-commit.
Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/sme-researcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ If you hit the upper bound without a confident answer, report what you found and

## BASH USAGE

Bash is for **read-only inspection only**: tool versions (`dotnet --version`), package metadata (`dotnet list package --outdated`), environment state, and git history (see Phase 2).
Bash is for **read-only inspection only**: tool versions (`dotnet --version`), package metadata (`scripts/dep-check.sh --outdated --json`), environment state, and git history (see Phase 2).

Never use Bash to modify files, install packages, run builds, or change state.

Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/weekly-learner.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,6 @@ Write findings to `.claude/tmp/weekly-learner/memory.md` with sections: Active P
- **Actionable recommendations only**: "code could be better" is not actionable; "create /quick-fix skill to chain format+build+commit" is
- **Respect dismissed patterns**: if a recommendation was previously dismissed, do not re-suggest unless the evidence has significantly changed (2x+ frequency increase)
- **Repo-agnostic**: never assume specific directory structures (lode/, etc.) exist. Always detect and adapt
- **Plans over reports for non-trivial work**: any recommendation with effort above trivial must produce a plan, not just a text suggestion
- **Plans over reports for non-trivial work**: a recommendation that meets the Phase 4.5 criteria must produce a plan, not just a text suggestion
- **No duplicate plans**: check `plans/` before creating. If a plan already covers the pattern, add a note in the report and skip
- **Trivial and dead-weight items: apply inline**: do not create a plan for a one-line config change. Do it during this run. Report a file deletion for user approval instead of deleting it
11 changes: 11 additions & 0 deletions .claude/hooks/stop-violations
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Stop hook: warn when violation-scan.sh finds anti-patterns. Never blocks.
# The scan matches text, so it reports analyzer diagnostic strings and a
# property named Result. Blocking with exit 2 waits for a gate that has no
# false positives.

violations=$(scripts/violation-scan.sh --json 2>/dev/null | jq '.violations // 0')
if [ "${violations:-0}" -gt 0 ]; then
echo "{\"systemMessage\":\"$violations anti-pattern hit(s). Run: scripts/violation-scan.sh\"}"
fi
exit 0
31 changes: 19 additions & 12 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,26 @@
"Edit(.claude/settings.json)"
],
"deny": [
"Bash(gh api --method DELETE*)",
"Bash(gh api -X DELETE*)",
"Bash(gh release delete*)",
"Bash(gh repo delete*)",
"Bash(git branch -D *)",
"Bash(git checkout -- *)",
"Bash(git push * --delete*)",
"Bash(git push --force*)",
"Bash(git push -f*)",
"Bash(git reset --hard*)"
"Bash(git push origin :*)",
"Bash(git reset --hard*)",
"Bash(git restore *)",
"Bash(git stash clear*)",
"Bash(git stash drop*)",
"Bash(rm -fr *)",
"Bash(rm -rf *)",
"Bash(security find-*password*)",
"Read(./.env*)",
"Read(~/.aws/**)",
"Read(~/.ssh/**)"
]
},
"hooks": {
Expand Down Expand Up @@ -116,8 +133,7 @@
"hooks": [
{
"type": "command",
"command": "result=$(scripts/violation-scan.sh --json 2>/dev/null); violations=$(echo \"$result\" | jq \".violations // 0\"); if [ \"$violations\" -gt 0 ]; then msg=\"$violations anti-pattern violation(s) this session. Run: scripts/violation-scan.sh\"; echo \"{\\\"systemMessage\\\":\\\"$msg\\\"}\"; fi",
"statusMessage": "Scanning for anti-pattern violations..."
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/stop-violations\""
}
]
}
Expand All @@ -143,15 +159,6 @@
}
],
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-tool-use-guard\""
}
]
},
{
"matcher": "Bash",
"hooks": [
Expand Down
6 changes: 3 additions & 3 deletions .claude/skills/bash-patterns/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set -euo pipefail
## Formatting Rules

- No trailing whitespace.
- Indent with 2 spaces (not tabs).
- Indent with 4 spaces (not tabs), as the existing `scripts/*.sh` files do.
- Lines <= 100 chars preferred; wrap long lines with `\`.
- Quote all variable expansions: `"$var"` not `$var`.
- Use `[[ ]]` for conditionals (not `[ ]`).
Expand Down Expand Up @@ -91,8 +91,8 @@ trap cleanup EXIT
command -v dotnet &>/dev/null || { echo "dotnet not found" >&2; exit 1; }

# Capture exit code without exiting
output=$(some_command 2>&1) || true
exit_code=$?
exit_code=0
output=$(some_command 2>&1) || exit_code=$?
```

### Temporary Files
Expand Down
8 changes: 6 additions & 2 deletions .claude/skills/batch-dead-code-deletion/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ argument-hint: >
Space-separated symbol names, optionally prefixed with --dry-run.
Example: /batch-dead-code-deletion FooService BarHelper IWidgetFactory
Example: /batch-dead-code-deletion --dry-run FooService BarHelper
allowed-tools: Bash, Read, Glob, Grep, Write, Edit
allowed-tools: Bash, Read, Glob, Grep, Write, Edit, AskUserQuestion
---

# Batch Dead-Code Deletion
Expand Down Expand Up @@ -44,6 +44,10 @@ For each symbol, confirm it is dead before touching it. Classify into one of:

## Step 3: Execute Deletions (skip in DRY_RUN)

Deleting a file outside `lode/` needs approval (`.claude/rules/auto-approvals.md`).
List the files to delete and the multi-type edits, then ask once with `AskUserQuestion`.
Stop when the answer is no.

For each DEAD symbol in a single-type file:

```bash
Expand Down Expand Up @@ -102,4 +106,4 @@ Dead-Code Deletion Report
- **Multi-type files: edit, do not delete.**
- **One build run.** After all deletions, not per symbol.
- **Stage only: do not commit.** The caller handles commits.
- **`--dry-run` is the only mode that writes nothing.** Without the flag, the skill deletes files.
- **`--dry-run` is the only mode that writes nothing.** Without the flag, the skill deletes files after approval.
4 changes: 2 additions & 2 deletions .claude/skills/dotnet-overhaul/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ zero external dependencies. Use these when present, else fall back:
| `sme-researcher` agent | uncertainty research | `Explore` agent |
| `tdd-loop-optimizer` agent | batch fix cycles | sequential fixes |
| `mcp__ide__getDiagnostics` | deeper post-build diagnostics | build output only |
| `/dev-planning` skill (≥8 findings) | create a plan | execute directly from `approved-step{N}.md` |
| plan directory (≥8 findings) | create a plan | execute directly from `approved-step{N}.md` |

Project-specific (optional): read `${CLAUDE_SKILL_DIR}/conventions.md` for coding standards,
analyzer inventory, severity overrides, and auto-approved fixes (absent → sensible .NET
Expand Down Expand Up @@ -203,7 +203,7 @@ suppressions, verify build. Executes immediately: no approval gate.

## Fix Cycle (Steps 3-8) -> read steps/fix-cycle.md

After user approves findings: create a plan (if dev-planning available and >=8 findings), execute approved fixes, build+test, report results.
After user approves findings: create a plan (if >=8 findings), execute approved fixes, build+test, report results.

## Self-Improvement

Expand Down
4 changes: 1 addition & 3 deletions .claude/skills/dotnet-overhaul/steps/fix-cycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ Count the approved findings. This file is the single source of truth for resumpt

Fewer than 8 findings: skip plan creation and execute directly from `approved-step{N}.md`.

8 or more findings: **if dev-planning is available**, create a structured plan:
8 or more findings: create a structured plan:
```
plans/overhaul-step{N}-{name}/
├── overhaul-step{N}-{name}-plan.md ← approved findings as tasks (file:line + fix)
├── overhaul-step{N}-{name}-context.md ← scope, baseline count, approved vs deferred
└── overhaul-step{N}-{name}-tasks.md ← one task per finding + build/test tasks at end
```

**If dev-planning is not available**, organize findings in `approved-step{N}.md` with checkboxes and execute directly. The plan structure is an enhancement, not a requirement.

**2. Execute all phases immediately:**
1. For each approved finding: Read → apply minimal fix → Edit
2. **Spawn `build-validator` agent**: do not run `dotnet build` or `dotnet test` directly in main context. Use the agent which returns only errors, warnings, and test failures
Expand Down
Loading