The Problem
AI agents write code fast, but speed comes at a cost. Literally - tokens cost money. And figuratively - code quality degrades without oversight.
I hit three problems at once:
- Architecture degrades - agents write working code that violates layer boundaries, creates circular dependencies and god classes
- Costs grow - complex prompts go to Opus at $15/1M tokens when Haiku at $0.80 would suffice
- Content isn’t filtered - production prompts contain things that shouldn’t be there
Each problem has its own tool. But when the tools work together, they amplify each other.
The Pipeline
Every request passes through a chain of linters, each responsible for its domain:
- seclint - checks content safety (6+/12+/16+/18+ ratings)
- promptlint - scores complexity, picks the model
- Agent - executes the task on the selected model
- archlint - validates the result for architecture violations
- costlint - records cost, tracks cache hit rate
If archlint rejects the result, the task escalates to a more powerful model. costlint records the escalation cost.
The Tools
archlint - Architecture Linter
Scans Go projects for structural violations.
| |
What it finds:
- Layer violations (handler calls repository directly)
- God classes (>20 methods or >15 dependencies)
- Circular dependencies
- Interface Segregation violations (interfaces >5 methods)
Metrics: fan-out, coupling (Ca/Ce), component and link counts.
GitHub: mshogin/archlint
promptlint - Complexity-Based Router
Scores prompt complexity and picks the model. No LLM, pure metrics, <10ms.
| |
Signals: length, sentence count, domain keywords, action type (fix/create/refactor), code presence.
Integrates with ccproxy for real Claude Code request routing through a proxy.
GitHub: mikeshogin/promptlint
costlint - Token Cost Analysis
Tracks spending, analyzes caching, runs A/B tests between models.
| |
| |
Cache metrics: hit rate, block reuse, content entropy, Jaccard similarity. A/B testing: 30/30/40 traffic split, per-group cost and quality metrics.
GitHub: mikeshogin/costlint
seclint / promptsec - Content Filter
Age ratings for prompts: 6+, 12+, 16+, 18+.
| |
Considers educational context - explaining SQL injection for a security course gets 16+ instead of 18+.
GitHub: mikeshogin/seclint / mikeshogin/promptsec
Shared Principles
All tools follow the same rules:
- Go - single stack, single build
- No LLM - pure metrics, regex, keyword matching. <10ms per request
- CLI + HTTP - each tool works as a command and as a server
- JSONL telemetry - unified log format for analysis
- Pipeline-friendly - exit codes, stdout, pipes
Numbers
On test workload (342 requests over a week):
| Metric | Before | After |
|---|---|---|
| Token spending | $19.54 | $8.20 |
| Architecture violations | 63 | 12 |
| Requests to expensive model | 100% opus | 14% opus |
| Routing latency | - | <10ms |
58% cost savings without quality loss - simple tasks go to Haiku, architecture tasks stay on Opus.
Orchestration
The tools work autonomously, but deliver maximum impact together. For orchestration we use myhome - daemon-based AI agent management with workflow stages and scheduled tasks.
The stack:
- myhome launches agents
- promptlint picks the model (pre-route hook)
- archlint validates output (quality gate stage)
- costlint tracks cost (telemetry consumer)
- seclint filters incoming prompts (pre-filter)
Get Started
| |
Links
- archlint - architecture linter
- promptlint - complexity router
- costlint - cost analysis
- seclint / promptsec - content filter
- myhome - agent orchestration
- ECOSYSTEM.md - integration map