@whitehatd/crag 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -120
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,31 +72,28 @@ The same universal skills — written once, never modified per project — disco
|
|
|
72
72
|
|
|
73
73
|
## The Architecture
|
|
74
74
|
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
style GENERATED fill:#3a2a1a,stroke:#ffbb33,color:#eee
|
|
98
|
-
style GOV fill:#3a2a1a,stroke:#ffbb33,color:#eee
|
|
99
|
-
style ALSO fill:#0f3460,stroke:#00d2ff,color:#eee
|
|
75
|
+
```
|
|
76
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
77
|
+
│ Ships with crag (universal — same for every project) │
|
|
78
|
+
│ │
|
|
79
|
+
│ ┌──────────────────────┐ ┌──────────────────────┐ │
|
|
80
|
+
│ │ pre-start skill │ │ post-start skill │ │
|
|
81
|
+
│ │ discovers ANY │ │ validates using │ │
|
|
82
|
+
│ │ project │ │ YOUR gates │ │
|
|
83
|
+
│ └──────────┬───────────┘ └──────────┬───────────┘ │
|
|
84
|
+
└─────────────┼───────────────────────────────┼───────────────┘
|
|
85
|
+
│ │
|
|
86
|
+
│ reads at runtime │ reads at runtime
|
|
87
|
+
▼ ▼
|
|
88
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
89
|
+
│ Generated from interview or analyze (project-specific) │
|
|
90
|
+
│ │
|
|
91
|
+
│ ┌────────────────────────────────────────────┐ │
|
|
92
|
+
│ │ governance.md — 20-30 lines of YOUR rules │ │
|
|
93
|
+
│ └────────────────────────────────────────────┘ │
|
|
94
|
+
│ │
|
|
95
|
+
│ Also generated: hooks/ agents/ settings │
|
|
96
|
+
└──────────────────────────────────────────────────────────────┘
|
|
100
97
|
```
|
|
101
98
|
|
|
102
99
|
The skills ship once and work forever. They don't know your stack — they discover it. They don't know your gates — they read them from governance.md. Add a service, change your CI, switch frameworks — the skills adapt. Nothing to update.
|
|
@@ -565,41 +562,31 @@ crag compile # Or list targets interactively
|
|
|
565
562
|
|
|
566
563
|
The compiler parses your gates, auto-detects runtimes from the commands (Node, Rust, Python, Java, Go, Docker), and generates the right setup steps with proper version inference from your project files (not hardcoded defaults). Human-readable `Verify X contains Y` gates are compiled to `grep` commands automatically (with shell-injection-safe escaping). All 12 targets write atomically (temp file + rename) so partial failures leave the old state intact.
|
|
567
564
|
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
GOV --> CI
|
|
594
|
-
GOV --> NATIVE
|
|
595
|
-
GOV --> EXTRAS
|
|
596
|
-
GOV -->|"read at runtime"| SKILL["Universal skills"]
|
|
597
|
-
|
|
598
|
-
style GOV fill:#3a2a1a,stroke:#ffbb33,color:#eee
|
|
599
|
-
style CI fill:#0f3460,stroke:#00d2ff,color:#eee
|
|
600
|
-
style NATIVE fill:#1a3a1a,stroke:#00ff88,color:#eee
|
|
601
|
-
style EXTRAS fill:#2a1a3a,stroke:#bb86fc,color:#eee
|
|
602
|
-
style SKILL fill:#1a3a1a,stroke:#00ff88,color:#eee
|
|
565
|
+
```
|
|
566
|
+
┌────────────────────┐
|
|
567
|
+
│ governance.md │
|
|
568
|
+
│ (one file) │
|
|
569
|
+
└──────────┬─────────┘
|
|
570
|
+
│
|
|
571
|
+
crag compile --target all
|
|
572
|
+
│
|
|
573
|
+
┌─────────────────────────┼─────────────────────────┐
|
|
574
|
+
│ │ │
|
|
575
|
+
▼ ▼ ▼
|
|
576
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
577
|
+
│ CI / hooks │ │ AI native │ │ AI extras │
|
|
578
|
+
├─────────────┤ ├─────────────┤ ├─────────────┤
|
|
579
|
+
│ gates.yml │ │ AGENTS.md │ │ Copilot │
|
|
580
|
+
│ husky │ │ Cursor MDC │ │ Cline │
|
|
581
|
+
│ pre-commit │ │ GEMINI.md │ │ Continue │
|
|
582
|
+
└─────────────┘ └─────────────┘ │ Windsurf │
|
|
583
|
+
│ Zed │
|
|
584
|
+
│ Cody │
|
|
585
|
+
└─────────────┘
|
|
586
|
+
|
|
587
|
+
+ read at runtime by
|
|
588
|
+
universal skills
|
|
589
|
+
(pre-start / post-start)
|
|
603
590
|
```
|
|
604
591
|
|
|
605
592
|
Governance-as-config that compiles to agent behavior, CI/CD pipelines, and **9 different AI coding tool configs** from a single 20-line file.
|
|
@@ -674,71 +661,58 @@ The update checker queries the npm registry (cached for 24 hours, 3s timeout, gr
|
|
|
674
661
|
|
|
675
662
|
## Why Everything Else Is Static
|
|
676
663
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
subgraph RUNTIME["crag"]
|
|
686
|
-
U["Universal skills\nDiscover at runtime\nWork for any stack\nNever go stale"]
|
|
687
|
-
G["governance.md\n20-30 lines\nYour rules only\nHuman-controlled"]
|
|
688
|
-
end
|
|
689
|
-
|
|
690
|
-
T -->|"manual updates required"| STALE["Stale instructions"]
|
|
691
|
-
C -->|"wrong skill for new stack"| MISMATCH["Stack mismatch"]
|
|
692
|
-
I -->|"facts change"| ROT["Template rot"]
|
|
693
|
-
U -->|"reads filesystem every session"| FRESH["Always current"]
|
|
694
|
-
G -->|"changes only when you decide"| STABLE["Your standards"]
|
|
695
|
-
|
|
696
|
-
style STATIC fill:#3a1a1a,stroke:#ff6b6b,color:#eee
|
|
697
|
-
style RUNTIME fill:#1a3a1a,stroke:#00ff88,color:#eee
|
|
698
|
-
style STALE fill:#3a1a1a,stroke:#ff6b6b,color:#eee
|
|
699
|
-
style MISMATCH fill:#3a1a1a,stroke:#ff6b6b,color:#eee
|
|
700
|
-
style ROT fill:#3a1a1a,stroke:#ff6b6b,color:#eee
|
|
701
|
-
style FRESH fill:#1a3a1a,stroke:#00ff88,color:#eee
|
|
702
|
-
style STABLE fill:#3a2a1a,stroke:#ffbb33,color:#eee
|
|
703
|
-
```
|
|
664
|
+
| Current ecosystem | Why it rots | crag's approach |
|
|
665
|
+
|-------------------------------------------|--------------------------------------|------------------------------------------------|
|
|
666
|
+
| **CLAUDE.md / AGENTS.md** static files | Hardcode project facts; manual edits | **Universal skills** read filesystem every session — always current |
|
|
667
|
+
| **Skill collections** (1,234+ skills) | Pick-per-project; stack mismatch | **One engine** that works for any stack |
|
|
668
|
+
| **Per-framework templates** | One stack per template; rot on change | **`governance.md`** — 20–30 lines of YOUR rules only, human-controlled |
|
|
669
|
+
|
|
670
|
+
**The difference:** everything else tries to pack facts INTO config files. crag reads facts FROM the filesystem at runtime. The skills don't know your stack — they discover it. The governance doesn't know your paths — it holds your rules.
|
|
704
671
|
|
|
705
672
|
---
|
|
706
673
|
|
|
707
674
|
## The Session Loop
|
|
708
675
|
|
|
709
|
-
```
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
676
|
+
```
|
|
677
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
678
|
+
│ PRE-START (universal skill — runs before every task) │
|
|
679
|
+
│ │
|
|
680
|
+
│ Warm start? Intent? Cache valid? │
|
|
681
|
+
│ .session-state.json → classify → .discovery-cache.json │
|
|
682
|
+
│ │ │ │ │
|
|
683
|
+
│ │ │ ┌───────┴───────┐ │
|
|
684
|
+
│ │ │ ▼ ▼ │
|
|
685
|
+
│ │ │ Fast path Full discovery │
|
|
686
|
+
│ │ │ (skip 80%) (detect stack, │
|
|
687
|
+
│ │ │ │ load memory) │
|
|
688
|
+
│ └────────────────┴──────────┴───────────────┘ │
|
|
689
|
+
│ │ │
|
|
690
|
+
│ ▼ │
|
|
691
|
+
│ Read governance.md │
|
|
692
|
+
└───────────────────────────────┬────────────────────────────────┘
|
|
693
|
+
│
|
|
694
|
+
▼
|
|
695
|
+
┌──────────────────┐
|
|
696
|
+
│ YOUR TASK │
|
|
697
|
+
│ (code changes) │
|
|
698
|
+
└────────┬─────────┘
|
|
699
|
+
│
|
|
700
|
+
▼
|
|
701
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
702
|
+
│ POST-START (universal skill — runs after every task) │
|
|
703
|
+
│ │
|
|
704
|
+
│ Detect changes → Run gates → (fail?) → Auto-fix → retry │
|
|
705
|
+
│ │ │
|
|
706
|
+
│ pass │
|
|
707
|
+
│ ▼ │
|
|
708
|
+
│ Security review → Capture knowledge │
|
|
709
|
+
│ │ │
|
|
710
|
+
│ ▼ │
|
|
711
|
+
│ Write session state · Commit │
|
|
712
|
+
└────────────────────────────────┬───────────────────────────────┘
|
|
713
|
+
│
|
|
714
|
+
│ cache + state + knowledge
|
|
715
|
+
└─────► feeds next session
|
|
742
716
|
```
|
|
743
717
|
|
|
744
718
|
### What makes this loop tight
|