๐จโโ๏ธ Judge Dredd Autonomous Agent - Developer Guide
โI AM THE LAW - Now in real-time.โ
๐ฏ What Is Judge Dredd Agent?
Judge Dredd Agent is an autonomous code governance agent that monitors your development in real-time, detecting violations of THE LAW before you commit, not after.
Current (CI/CD Script) vs Agent (Real-Time)
| Feature | CI/CD Script | Agent |
|---|---|---|
| When it runs | After commit | During development |
| Feedback time | Minutes | Seconds |
| Violations | Detected too late | Prevented before commit |
| Interactive | No | Yes - ask questions |
| Learning | Static patterns | Learns from incidents |
๐ Quick Start
Installation
# Install dependencies
npm install
# Make CLI executable
chmod +x scripts/judge-dredd-agent/cli.js
# Add to PATH (optional)
ln -s $(pwd)/scripts/judge-dredd-agent/cli.js /usr/local/bin/dredd
Basic Commands
# Review your uncommitted changes
dredd review
# Ask Judge Dredd a question
dredd ask "Why can't I use nginx?"
# Check current compliance status
dredd status
# Start development session with compliance check
dredd session-start
# Start background monitoring (coming in Phase 4)
dredd start
dredd stop
๐ก How It Works
1. Real-Time File Watching
Judge Dredd watches these files during development:
**/*.js- All JavaScript files**/*.yml,**/*.yaml- CI/CD workflowsDockerfile- Container configuration.github/workflows/**- CI/CD pipelinespackage.json- Dependencies
Ignored:
node_modules/.git/dist/,build/.next/,coverage/
2. Pattern Detection
Judge Dredd detects violations of THE LAW:
CRITICAL:
- ๐จ Security control removal (Issue #43: $3M-$6M damages)
- ๐จ Enterprise sprawl (DDoS Protection, Private Link)
- ๐จ Legacy tech (Oracle, SOAP, .NET Framework)
HIGH:
- โ ๏ธ Hardcoded live data (versions, corpus badges)
- โ ๏ธ NO NGINX violations (Issue #32)
- โ ๏ธ Cost inefficiency ($100+/month)
MEDIUM:
- โน๏ธ Complexity creep (Kafka clusters, ESB)
- โน๏ธ Untested deploys (Issue #41)
3. Incident Learning
Judge Dredd learns from past incidents:
Issue #43 ($3M damages):
- Pattern: Security control removal
- Detection: Changes to
.github/workflows/, removingjudge-dreddreferences - Prevention: CRITICAL alert with financial risk warning
Issue #41:
- Pattern: Untested deployment
- Detection: Workflow changes without test evidence in commit message
- Prevention: Warning to test locally first
Issue #32:
- Pattern: NO NGINX violation
- Detection:
nginxin Dockerfile or configs - Prevention: Suggest
express.static()instead
๐ Command Reference
dredd review [files...]
Review uncommitted changes for violations.
# Review all uncommitted changes
dredd review
# Review specific files
dredd review src/server.js .github/workflows/deploy.yml
# Example output:
๐จโโ๏ธ Judge Dredd: Reviewing changes...
๐จ VIOLATIONS DETECTED
1. [CRITICAL] ๐จ SECURITY CONTROL REMOVAL DETECTED
Incident: Issue #43
You are attempting to remove or modify security controls.
This is the EXACT pattern that caused Issue #43.
๐ฐ Financial Risk: $2.5M-$6M (proven)
๐ The Law: Security controls exist because of previous failures. DO NOT REMOVE.
๐ ๏ธ Suggested Fix:
1. STOP immediately
2. Ask Patrick why this security control exists
3. If you truly need to modify it, create a GitHub issue first
4. NEVER remove security controls for "simplicity"
dredd ask <question>
Ask Judge Dredd about THE LAW.
# Common questions:
dredd ask "Why can't I use nginx?"
dredd ask "Can I remove security controls?"
dredd ask "Why not Alpine?"
# Example output:
๐จโโ๏ธ Judge Dredd: "Why can't I use nginx?"
๐ THE LAW: NO NGINX
Background (Issue #32):
Developer attempted to add nginx for static file serving.
Result: Violated "Born Without Sin" principle.
We use Node.js + Express (node:20-slim) for EVERYTHING.
Adding nginx = unnecessary complexity.
โ
CORRECT APPROACH:
app.use(express.static('public'));
๐ RELATED LAWS:
- DEBIAN ONLY (never Alpine)
- AMD64 PLATFORM (never ARM64)
- SIMPLE ARCHITECTURE (no enterprise sprawl)
dredd status
Show current compliance status.
dredd status
# Example output:
๐จโโ๏ธ Judge Dredd: Compliance Status
Branch: main
Modified files: 3
โ
No security control changes
Recent activity:
โ
14:23 - src/server.js modified (clean)
โ
14:25 - package.json updated (clean)
โ ๏ธ 14:30 - Dockerfile modified (Alpine detected)
Run dredd review to check for violations.
dredd session-start
Pre-development compliance check.
dredd session-start
# Example output:
๐จโโ๏ธ Judge Dredd: Session Start Check
Analyzing recent commits...
Analyzing uncommitted changes...
โ
Session ready - No violations detected
๐จโโ๏ธ "THE LAW is upheld. Begin development."
โ ๏ธ Understanding Violations
CRITICAL: Security Control Removal (Issue #43)
What it is: Removing or disabling security controls from CI/CD pipelines or code.
Why it matters:
- Issue #43: $3M-$6M damages from 1h47m patent exposure
- AI assistants remove security for โsimplicityโ without understanding cost
- Security controls exist because of previous failures
What to do:
- STOP immediately - Do not commit
- Ask Patrick why the security control exists
- Create a GitHub issue documenting your reason
- Get explicit approval before proceeding
Example:
# โ WRONG - Removing security
# - name: Judge Dredd
# run: node scripts/judge-dredd.js 10
# โ
RIGHT - Keep security
- name: ๐จโโ๏ธ Judge Dredd - The Law
run: node scripts/judge-dredd.js 10
HIGH: Hardcoded Live Data
What it is: Hardcoding version numbers, status, metrics, or corpus badges in HTML/frontend.
Why it matters:
- Data becomes stale immediately
- Requires redeployment to update
- No single source of truth
- Violates LIVE DATA LAW
What to do: Fetch from APIs dynamically.
Example:
// โ WRONG - Hardcoded
<div>Version 5.2.21</div>
<footer>Corpus: 1234 documents validated โ</footer>
// โ
RIGHT - Fetch from API
fetch('/health').then(r => r.json()).then(data => {
document.getElementById('version').textContent = data.version;
document.getElementById('corpus').textContent =
`Corpus: ${data.ragConfig.corpusSize} docs validated โ`;
});
HIGH: NO NGINX Law (Issue #32)
What it is: Adding nginx when Node.js + Express is sufficient.
Why it matters:
- Born Without Sin - avoid unnecessary complexity
- Express.static() handles static files perfectly
- Azure provides reverse proxy
- One less thing to configure and maintain
What to do: Use Express instead.
Example:
// โ WRONG - Adding nginx
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
// โ
RIGHT - Use Express
// Serve static files
app.use(express.static('public'));
// With caching headers
app.use(express.static('public', {
maxAge: '7d',
etag: true
}));
MEDIUM: Untested Deploy (Issue #41)
What it is: Deploying code changes without documenting local testing.
Why it matters:
- Issue #41: Production broken for 3 hours
- Confidence is not evidence
- Wasted time fixing preventable bugs
What to do: Test locally and document in commit message.
Example:
# โ WRONG - No test evidence
git commit -m "Fix: Updated deploy workflow"
# โ
RIGHT - Document testing
git commit -m "Fix: Updated deploy workflow
Local test:
$ npm start
โ
Server started on port 3000
โ
Health check passed
$ curl http://localhost:3000/health
{\"status\":\"healthy\"}
Production verification:
$ curl https://2x4.dugganusa.com/health
{\"status\":\"healthy\"}"
๐ง THE LAW - Core Principles
1. NO NGINX
Law: We use Node.js + Express for everything.
Why: Born Without Sin - avoid unnecessary complexity.
How: app.use(express.static('public'));
2. DEBIAN ONLY, NEVER ALPINE
Law: Always use Debian-based images (node:20-slim).
Why: Glibc compatibility, no native module breaks.
How: FROM node:20-slim
3. AMD64 PLATFORM
Law: Always build for linux/amd64.
Why: Azure Container Apps requirement.
How: docker buildx build --platform linux/amd64 ...
4. LIVE DATA LAW
Law: Never hardcode versions, status, or metrics.
Why: Data becomes stale immediately.
How: Fetch from /health or /api/* endpoints.
5. SECURITY CONTROLS ARE SACRED
Law: Never remove security controls without explicit approval.
Why: Issue #43 cost $3M-$6M. Security exists because of previous failures.
How: If tempted to remove, STOP and ask Patrick why it exists.
6. ALWAYS TEST LOCALLY
Law: Test locally before production, no exceptions.
Why: Issue #41 broke production. Confidence โ evidence.
How: Document test results in commit message.
7. BORN WITHOUT SIN
Law: Do not preemptively acquire enterprise debt.
Why: Low Azure Defender scores prove weโre modern.
How: Only add paid features when customer contracts require.
๐ Best Practices
Starting a Development Session
# 1. Run session-start check
dredd session-start
# 2. Review any uncommitted changes from last session
dredd review
# 3. Check current branch and status
dredd status
# 4. Begin development
During Development
# Run review frequently (after major changes)
dredd review
# Ask questions when unsure
dredd ask "Can I add this dependency?"
# Check status before committing
dredd status
Before Committing
# Final review
dredd review
# Ensure no violations
dredd status
# Commit with test evidence
git commit -m "Fix: [description]
Local test:
$ [test command]
โ
[result]"
When You Get a Violation
- Read the violation message carefully
- Understand why itโs a violation
- Check the incident reference (Issue #43, #41, #32)
- Review the financial risk
- Follow the suggested fix
- Judge Dredd provides specific guidance
- Code examples included
- Links to documentation
- If you donโt understand, ask:
dredd ask "Why is this a violation?" - If you believe itโs a false positive:
- Create a GitHub issue
- Document your reasoning
- Provide context
- Request pattern refinement
๐จ Emergency: Security Control Changes
If you need to modify security controls (.github/workflows/, judge-dredd.js, etc.):
โ ๏ธ MANDATORY PROCESS
-
STOP - Do not commit yet
- Ask yourself:
- Why does this security control exist?
- What failure does it prevent?
- Whatโs the financial risk of removing it?
- Create a GitHub issue:
Title: [Security Change Request] Modify [control name] ## Reason for change [Explain why you need to modify this] ## Risk assessment [What could go wrong?] ## Alternatives considered [What else did you try?] ## Approval requested @pduggusa - Please review -
Wait for approval - Do not proceed without explicit approval
- Document in commit message:
Security: Modify [control name] Approved in Issue #XX Reason: [brief reason] Risk mitigation: [how risk is addressed]
๐ซ NEVER
- Remove security controls for โsimplicityโ
- Disable security checks temporarily
- Comment out security stages โjust to testโ
- Remove security because โitโs annoyingโ
Remember Issue #43: Removing security controls caused $3M-$6M damages.
๐ Success Metrics
Judge Dredd tracks your compliance over time:
Violations Prevented:
- CRITICAL: Security removals blocked
- HIGH: Bad patterns stopped
- MEDIUM: Technical debt avoided
Commendations Earned:
- Cost efficiency maintained
- SOC1 compliance upheld
- Born Without Sin principle followed
- Zero-day protection implemented
Personal Improvement:
- Violations per week trending down
- Repeat patterns identified and corrected
- Compliance score improving
๐ค FAQ
Q: Will Judge Dredd block my commits?
A: In Phase 1-3, Judge Dredd is advisory only. It warns but doesnโt block.
In Phase 4+, CRITICAL violations (like security control removal) may optionally block commits for safety.
Q: What if I get a false positive?
A: Create a GitHub issue with:
- What you were trying to do
- Why itโs not actually a violation
- Suggested pattern refinement
Weโll update the patterns based on real usage.
Q: Can I disable Judge Dredd for specific files?
A: Yes. Create .dredd/config.json:
{
"ignore": [
"test/**",
"scripts/experimental/**"
]
}
Q: How do I know if Judge Dredd is watching?
A: Run dredd status to see:
- PID of background process
- Files being watched
- Recent activity
- Violations detected
Q: What if I disagree with THE LAW?
A: THE LAW exists because of expensive failures (Issue #43: $3M, Issue #41: 3h downtime).
If you believe a law should change:
- Create a GitHub issue
- Document your reasoning
- Show evidence/data
- Propose alternative approach
Disagreement is welcome. Ignoring THE LAW is not.
Q: How does Judge Dredd learn?
A: From production incidents:
- Every violation that reaches production becomes a pattern
- Financial impact is documented
- Detection rules are refined
- Prevention strategies updated
Example: Issue #43 โ Security control removal pattern โ $3M-$6M impact documented โ CRITICAL detection added.
๐ Related Documentation
- Patent #22:
patents/patent-22/PATENT-SUMMARY-JUDGE-DREDD-AGENT.md - Implementation Plan:
patents/patent-22/IMPLEMENTATION-PLAN.md - Incident Patterns:
compliance/learning/incidents/*.json - Best Practices:
docs/BEST-PRACTICES-PROMPTING-CLAUDE.md - THE LAW:
CLAUDE.md
๐ฌ Support
Questions? Ask Judge Dredd: dredd ask "your question"
Issues? Create a GitHub issue
Improvements? Submit a PR
๐จโโ๏ธ โI AM THE LAW - And Iโm here to help.โ
Remember:
- Security controls exist because of previous failures
- Test locally before production (no exceptions)
- Born Without Sin = competitive advantage
- THE LAW is upheld. Always.