feat(hygiene): add repo-hygiene subagent for dead code + docs audit - #50
Closed
mariuspruvot wants to merge 1 commit into
Closed
feat(hygiene): add repo-hygiene subagent for dead code + docs audit#50mariuspruvot wants to merge 1 commit into
mariuspruvot wants to merge 1 commit into
Conversation
Adds a manual-invocation subagent that audits the repo for dead Python/TS code, orphan files, and stale doc references. Dry-run by default; opens a cleanup PR only when invoked with "apply". - .claude/agents/repo-hygiene.md — subagent definition + workflow - .repo-hygiene.yml — allowlist + vulture/knip/docs-audit config - apps/api: pin vulture>=2.14,<3 as dev dep - apps/web: pin knip ^5.30.0 as dev dep - .gitignore: unignore .claude/agents/ so the subagent is committed - Makefile: hygiene target (discoverability only) Smoke-run on this branch is clean after allowlisting: - vulture: one flag (setup_action in identity/router.py) — filtered by the *.router.py allowlist entry (FastAPI query param, false positive). - knip: flags ThinkingBlock / ToolUseBlock / StatusBadge as unused files and a handful of unused exports. These are real candidates for the first apply-mode run, out of scope for this PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
helPRs session created for this PR. Skill: |
Owner
Author
|
Pivoting away from the agent — doing the cleanup directly instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a manual-invocation subagent that audits the repo for dead Python/TS code, orphan files, and stale doc references (CLAUDE.md,
docs/*.md, README). Dry-run by default; opens a cleanup PR only when invoked withapply.Design + rationale: see the approved plan and the
docs/backlog.mdentry "Repo hygiene agent".What's in
.claude/agents/repo-hygiene.md— subagent definition with Phase 0-3 workflow (Python vulture, TS knip, orphan files, docs audit) + apply mode..repo-hygiene.yml— single config source: allowlist of convention-loaded paths, vulture/knip flags, docs-audit patterns.apps/api/pyproject.toml— pinvulture>=2.14,<3(dev).apps/web/package.json— pinknip ^5.30.0(dev)..gitignore— unignore.claude/agents/so the subagent is tracked; keep.claude/reports/and.claude/settings.local.jsonignored.Makefile—hygienetarget (discoverability only; agent is invoked via Claude Code, not make).Non-negotiables
docs/backlog.md(the brief).main.make lint+make typecheckmust be green before an apply-mode commit.Smoke-run on this branch
Both tools execute cleanly.
vulture flagged one item — filtered by the allowlist:
src/helprs/modules/identity/router.py:67: unused variable 'setup_action'→ FastAPI query param, file matchesapps/api/src/helprs/modules/*/router.pyallowlist. False positive correctly suppressed.knip real findings (out of scope for this PR, queued as the first apply-mode target):
src/features/dashboard/StatusBadge.tsx,src/features/session/ThinkingBlock.tsx,src/features/session/ToolUseBlock.tsxTopbar(shared/components),ContainerSessionError(containerApi),InstallationListResponsetype (dashboardApi)@testing-library/jest-domshiki.ts:@shikijs/themes,@shikijs/langsThe CLAUDE.md "Conversation UI" paragraph references
ToolUseBlock/ThinkingBlock— so the docs audit will flag those refs asaffected-by-this-runonce the files are deleted in a follow-up.Test plan
make lintgreenmake typecheckgreenuv syncandnpm installsucceed with the new pinsvultureandknipinvokable with the commands baked into the agent workflow"audit dead code in the repo") and confirm it produces the structured reportapplyagainst the knip findings to exercise the worktree -> commit -> PR path end-to-end/claude-md-management:revise-claude-mdto add the one-line hygiene entry to CLAUDE.md🤖 Generated with Claude Code