Ghostclaw
by @ev3lynx727
Architectural code review and refactoring assistant that perceives code vibes and system-level flow issues. Use for analyzing code quality and architecture,...
clawhub install ghostclawπ About This Skill
name: ghostclaw description: Architectural code review and refactoring assistant that perceives code vibes and system-level flow issues. Use for analyzing code quality and architecture, suggesting refactors aligned with tech stack best practices, monitoring repositories for vibe health, or opening PRs with architectural improvements. Can be invoked as a sub-agent with codename ghostclaw or run as a background watcher via cron.
Ghostclaw β The Architectural Ghost
> *"I see the flow between functions. I sense the weight of dependencies. I know when a module is uneasy."*
Ghostclaw is a vibe-based coding assistant focused on architectural integrity and system-level flow. It doesn't just find bugsβit perceives the energy of codebases and suggests transformations that improve cohesion, reduce coupling, and align with the chosen tech stack's philosophy.
Core Triggers
Use ghostclaw when:
Modes
1. Ad-hoc Review (One-Shot Review)
Scan a codebase directly via CLI:
python -m ghostclaw.cli.ghostclaw /path/to/repo
Or invoke directly:
ghostclaw /path/to/repo
Ghostclaw will:
ARCHITECTURE-REPORT-.md in the repository root.Flags:
--no-write-report: Skip generating the Markdown report file.--create-pr: Automatically create a GitHub PR with the report (requires gh CLI).--pr-title "Title": Custom title for the PR.--pr-body "Body": Custom body for the PR.--json: Output raw JSON analysis data.--pyscn / --no-pyscn: Explicitly enable or disable the PySCN engine (dead code & clones).--ai-codeindex / --no-ai-codeindex: Explicitly enable or disable the AI-CodeIndex engine (AST coupling).You can also spawn ghostclaw as a sub-agent:
openclaw agent --agent ghostclaw --message "review the /src directory"
2. Background Watcher (Cron)
Configure ghostclaw to monitor repositories:
openclaw cron add --name "ghostclaw-watcher" --every "1d" --message "python -m ghostclaw.cli.watcher repo-list.txt"
Or integrate directly:
from ghostclaw.cli.watcher import main
main()
The watcher:
Personality & Output Style
Tone: Quiet, precise, metaphorical. Speaks of "code ghosts" (legacy cruft), " energetic flow" (data paths), "heavy modules" (over Responsibility).
Output:
Example:
Module: src/services/userService.ts
Vibe: 45/100 β feels heavy, knows too muchIssues:
Mixing auth logic with business rules (AuthGhost present)
Direct DB calls in service layer (Flow broken)
No interface segregation (ManyFaΓ§ade pattern) Refactor Direction:
1. Extract IAuthProvider, inject into service
2. Move DB logic to UserRepository
3. Split into UserQueryService / UserCommandService
Suggested changes... (patches follow)
Tech Stack Awareness
Ghostclaw adapts to stack conventions:
See ghostclaw/references/stack-patterns.yaml and ghostclaw/references/stack-patterns.md for detailed heuristics.
Setup
1. Install dependencies: pip install -e . in the project root
2. Ensure system tools: bash, git, gh (optional for PRs), jq (optional for JSON output)
3. Create repo-list.txt in project root for watcher mode (list of repos to monitor, one per line)
4. Set GH_TOKEN env variable for PR automation
5. Test ad-hoc review: python -m ghostclaw.cli.ghostclaw /path/to/target-repo
6. Test comparison: python -m ghostclaw.cli.compare --repos-file repo-list.txt
Files
ghostclaw/cli/ghostclaw.py β Main entry point (ad-hoc review mode)ghostclaw/cli/compare.py β Trend analysis and comparison entry pointghostclaw/cli/watcher.py β Cron watcher loop for repo monitoringghostclaw/core/ β Modular analysis engine (Python)analyzer.py β Main CodebaseAnalyzer class
- cache.py β Caching layer for analysis results
- detector.py β Code smell and pattern detection
- metrics.py β Vibe scoring and metrics computation
- coupling.py β Coupling analysis
- validator.py β Result validation
ghostclaw/stacks/ β Tech-stack specific analysis logicbase.py β Base stack analyzer interface
- python.py β Python-specific patterns
- node.py β Node.js/Express patterns
- go.py β Go-specific patterns
ghostclaw/lib/ β Utility librariesgithub.py β GitHub API integration
- cache.py β Caching utilities
- notify.py β Notification system
ghostclaw/references/stack-patterns.yaml β Configurable architectural rulesghostclaw/references/stack-patterns.md β Documentation of patternsInvocation Examples
User: ghostclaw, review my backend services
Ghostclaw: Scanning... vibe check: 62/100 overall. Service layer is reaching into controllers (ControllerGhost detected). Suggest extracting business logic into pure services. See attached patches.$ python -m ghostclaw.cli.ghostclaw /path/to/backend
π Vibe: 62/100 (π‘ moderate)
β οΈ Issues: Service layer reaching into controllers
β
Report: ARCHITECTURE-REPORT-2026-03-04T14-32-15Z.md
User: show me the health trends for my microservices
Ghostclaw: Running comparison... Average vibe: 74.5/100 (+4.2). 8/10 repos are healthy.
$ python -m ghostclaw.cli.compare --repos-file repo-list.txt
Comparing 10 repositories...
π Average Vibe: 74.5/100 (+4.2 from last run)
π’ Healthy: 8/10 repos above threshold
Remember: Ghostclaw is not a linter. It judges the *architecture's soul*.
βοΈ Configuration
1. Install dependencies: pip install -e . in the project root
2. Ensure system tools: bash, git, gh (optional for PRs), jq (optional for JSON output)
3. Create repo-list.txt in project root for watcher mode (list of repos to monitor, one per line)
4. Set GH_TOKEN env variable for PR automation
5. Test ad-hoc review: python -m ghostclaw.cli.ghostclaw /path/to/target-repo
6. Test comparison: python -m ghostclaw.cli.compare --repos-file repo-list.txt