aiknowsys 0.5.0 → 0.7.0
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 +195 -28
- package/bin/cli.js +5 -1
- package/lib/commands/audit.js +197 -80
- package/lib/commands/check.js +84 -50
- package/lib/commands/init/constants.js +111 -0
- package/lib/commands/init/display.js +202 -0
- package/lib/commands/init/index.js +36 -0
- package/lib/commands/init/openspec.js +85 -0
- package/lib/commands/init/prompts.js +277 -0
- package/lib/commands/init/templates.js +227 -0
- package/lib/commands/init.js +288 -973
- package/lib/commands/install-agents.js +39 -26
- package/lib/commands/install-skills.js +56 -24
- package/lib/commands/migrate.js +108 -79
- package/lib/commands/scan.js +57 -43
- package/lib/commands/sync.js +35 -52
- package/lib/commands/update.js +129 -127
- package/lib/error-helpers.js +178 -0
- package/lib/logger.js +187 -0
- package/lib/sanitize.js +284 -0
- package/lib/skill-mapping.js +215 -0
- package/lib/utils.js +153 -25
- package/package.json +9 -2
- package/templates/AGENTS.template.md +30 -125
- package/templates/agents/architect.agent.template.md +142 -39
- package/templates/agents/developer.agent.template.md +90 -19
- package/templates/agents/planner.agent.template.md +351 -0
- package/templates/aiknowsys-structure/PENDING_REVIEW.template.md +87 -0
- package/templates/skills/validation-troubleshooting/SKILL.md +486 -0
- package/templates/workflows/tdd-compliance.yml +47 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AIKnowSys - Knowledge System Template
|
|
2
2
|
|
|
3
3
|
**AI-Powered Development Workflow for Consistent, High-Quality Code**
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ A battle-tested knowledge management system that enables AI-assisted development
|
|
|
13
13
|
A structured workflow system consisting of:
|
|
14
14
|
|
|
15
15
|
1. **CODEBASE_ESSENTIALS.md** - Single source of truth for patterns, conventions, and invariants
|
|
16
|
-
2. **Custom Agents** (Developer
|
|
16
|
+
2. **Custom Agents** (Planner → Developer → Architect) - Three-agent workflow with automated code review enforcing KISS/DRY/SOLID/YAGNI
|
|
17
17
|
3. **Skills System** - Domain-specific how-to guides for common tasks
|
|
18
18
|
4. **Changelog** - Session-by-session validation and learning history
|
|
19
19
|
5. **Validation Matrix** - Mandatory test running before completion
|
|
@@ -52,17 +52,17 @@ From production use in gnwebsite:
|
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
# For new projects - interactive setup
|
|
55
|
-
npx
|
|
55
|
+
npx init
|
|
56
56
|
|
|
57
57
|
# For new projects with pre-built stack template
|
|
58
|
-
npx
|
|
58
|
+
npx init --stack nextjs
|
|
59
59
|
|
|
60
60
|
# For existing projects - auto-detect and migrate
|
|
61
|
-
npx
|
|
61
|
+
npx migrate
|
|
62
62
|
|
|
63
63
|
# Or install globally
|
|
64
|
-
npm install -g
|
|
65
|
-
|
|
64
|
+
npm install -g
|
|
65
|
+
init
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
**🚀 Pre-built Stack Templates:**
|
|
@@ -71,13 +71,13 @@ Skip most customization work with production-ready stack templates:
|
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
# List available stacks
|
|
74
|
-
npx
|
|
74
|
+
npx init --list-stacks
|
|
75
75
|
|
|
76
76
|
# Initialize with Next.js stack
|
|
77
|
-
npx
|
|
77
|
+
npx init --stack nextjs
|
|
78
78
|
|
|
79
79
|
# Initialize with Vue + Express full-stack monorepo
|
|
80
|
-
npx
|
|
80
|
+
npx init --stack vue-express
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
**Available stacks:**
|
|
@@ -98,29 +98,101 @@ Each stack template includes:
|
|
|
98
98
|
|
|
99
99
|
| Command | Description | Auto-installs agents/skills? |
|
|
100
100
|
|---------|-------------|------------------------------|
|
|
101
|
-
| `npx
|
|
102
|
-
| `npx
|
|
103
|
-
| `npx
|
|
104
|
-
| `npx
|
|
101
|
+
| `npx init` | Initialize for a new project | ✅ Yes |
|
|
102
|
+
| `npx migrate` | Full migration for existing projects | ✅ Yes |
|
|
103
|
+
| `npx scan` | Scan codebase and generate draft ESSENTIALS | ❌ No (run install-agents after) |
|
|
104
|
+
| `npx update` | Update agents, skills, and workflow to latest version | N/A (updates existing) |
|
|
105
105
|
| `npx aiknowsys check` | Validate knowledge system setup and configuration | N/A (validation) |
|
|
106
106
|
| `npx aiknowsys sync` | Sync AGENTS.md validation reference with ESSENTIALS.md | N/A (maintenance) |
|
|
107
107
|
| `npx aiknowsys audit` | Find common issues and pattern violations | N/A (analysis) |
|
|
108
|
-
| `npx aiknowsys install-agents` | Install Developer + Architect agents | N/A (standalone) |
|
|
108
|
+
| `npx aiknowsys install-agents` | Install Planner + Developer + Architect agents | N/A (standalone) |
|
|
109
109
|
| `npx aiknowsys install-skills` | Install universal skills | N/A (standalone) |
|
|
110
110
|
|
|
111
|
+
**🤔 `init` vs `migrate` - Which Should I Use?**
|
|
112
|
+
|
|
113
|
+
- **`init`** → Recommended for everyone (new OR existing projects)
|
|
114
|
+
- Detects your situation and offers appropriate options
|
|
115
|
+
- For existing projects: choose "🔍 Scan Codebase" → runs migrate workflow
|
|
116
|
+
- More user-friendly with guided choices
|
|
117
|
+
|
|
118
|
+
- **`migrate`** → Direct path for existing projects only
|
|
119
|
+
- Skips the setup menu, goes straight to scanning
|
|
120
|
+
- Same result as `init` → "Scan Codebase"
|
|
121
|
+
- Use if you prefer fewer prompts
|
|
122
|
+
|
|
123
|
+
**TL;DR:** Both do the same thing for existing code. `init` with "Scan Codebase" literally calls `migrate` internally. Just use `init` unless you want to skip the setup mode selection.
|
|
124
|
+
|
|
111
125
|
**💡 AI-Assisted Completion:** When using `init` in AI-guided mode, `migrate`, or `scan`, you'll receive a ready-to-copy prompt that you can paste to your AI assistant (Claude, GPT-4, Copilot Chat, etc.) to automatically complete the TODO sections based on your actual codebase. Manual mode lets you fill sections yourself, but you can always use AI later.
|
|
112
126
|
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### 🎯 Advanced: Custom Essentials Filename
|
|
130
|
+
|
|
131
|
+
All commands support the `--essentials` (or `-e`) flag to use a custom filename instead of `CODEBASE_ESSENTIALS.md`:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Initialize with custom filename
|
|
135
|
+
npx aiknowsys init --essentials ARCHITECTURE.md
|
|
136
|
+
|
|
137
|
+
# All other commands work with the same flag
|
|
138
|
+
npx aiknowsys check --essentials ARCHITECTURE.md
|
|
139
|
+
npx aiknowsys sync --essentials ARCHITECTURE.md
|
|
140
|
+
npx aiknowsys audit --essentials ARCHITECTURE.md
|
|
141
|
+
npx aiknowsys update --essentials ARCHITECTURE.md
|
|
142
|
+
npx aiknowsys migrate --essentials ARCHITECTURE.md
|
|
143
|
+
npx aiknowsys install-agents --essentials ARCHITECTURE.md
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Common Use Cases:**
|
|
147
|
+
|
|
148
|
+
1. **Corporate Naming Standards**
|
|
149
|
+
```bash
|
|
150
|
+
# Your company requires "ENGINEERING_GUIDE.md"
|
|
151
|
+
npx aiknowsys init --essentials ENGINEERING_GUIDE.md
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
2. **Monorepo Organization**
|
|
155
|
+
```bash
|
|
156
|
+
# Different essentials per package
|
|
157
|
+
cd packages/backend
|
|
158
|
+
npx aiknowsys init --essentials BACKEND_ESSENTIALS.md
|
|
159
|
+
|
|
160
|
+
cd packages/frontend
|
|
161
|
+
npx aiknowsys init --essentials FRONTEND_ESSENTIALS.md
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
3. **Localization**
|
|
165
|
+
```bash
|
|
166
|
+
# Non-English teams
|
|
167
|
+
npx aiknowsys init --essentials CODEBASE_ESSENTIALS_FR.md
|
|
168
|
+
npx aiknowsys init --essentials コードベース要点.md
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
4. **Legacy Project Migration**
|
|
172
|
+
```bash
|
|
173
|
+
# You already have "CONTRIBUTING.md" or "ARCHITECTURE.md"
|
|
174
|
+
npx aiknowsys init --essentials ARCHITECTURE.md
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Important Notes:**
|
|
178
|
+
- Custom agents will automatically reference your custom filename
|
|
179
|
+
- All validation and maintenance commands work seamlessly
|
|
180
|
+
- The system defaults to `CODEBASE_ESSENTIALS.md` if flag not provided
|
|
181
|
+
- Backwards compatible - existing projects continue working without changes
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
113
185
|
**📋 Template Options:**
|
|
114
186
|
|
|
115
187
|
- **Minimal Template** (10 sections): For learning projects, prototypes, and simple tools
|
|
116
188
|
```bash
|
|
117
|
-
npx
|
|
189
|
+
npx init --template minimal
|
|
118
190
|
```
|
|
119
191
|
Includes: Tech Stack, Validation Matrix, Structure, Patterns, Invariants, Gotchas, Testing, Architecture, Change Management, Workflow
|
|
120
192
|
|
|
121
193
|
- **Full Template** (13+ sections): For production projects and complex systems (default)
|
|
122
194
|
```bash
|
|
123
|
-
npx
|
|
195
|
+
npx init --template full # or just: npx init
|
|
124
196
|
```
|
|
125
197
|
Includes all minimal sections + Security, Performance, Accessibility
|
|
126
198
|
|
|
@@ -146,18 +218,18 @@ New commands to validate and maintain your knowledge system:
|
|
|
146
218
|
|
|
147
219
|
```bash
|
|
148
220
|
# Validate your setup
|
|
149
|
-
npx
|
|
221
|
+
npx check
|
|
150
222
|
# ✓ Checks required files exist
|
|
151
223
|
# ✓ Verifies agents and skills installed
|
|
152
224
|
# ✓ Detects unfilled placeholders
|
|
153
225
|
# ✓ Validates validation matrix
|
|
154
226
|
|
|
155
227
|
# Fix redundancy (sync validation matrix reference)
|
|
156
|
-
npx
|
|
228
|
+
npx sync
|
|
157
229
|
# Updates AGENTS.md to reference ESSENTIALS.md (DRY principle)
|
|
158
230
|
|
|
159
231
|
# Find issues and violations
|
|
160
|
-
npx
|
|
232
|
+
npx audit
|
|
161
233
|
# ⚠️ Detects validation matrix duplication
|
|
162
234
|
# ⚠️ Finds generic placeholder values
|
|
163
235
|
# ⚠️ Checks file size bloat
|
|
@@ -216,7 +288,7 @@ Example: How do you create API instances? Base URL configuration?
|
|
|
216
288
|
|
|
217
289
|
**Workflow:**
|
|
218
290
|
1. Read example to understand format and level of detail
|
|
219
|
-
2. Run `npx
|
|
291
|
+
2. Run `npx scan` to generate draft for your project
|
|
220
292
|
3. Use example as reference while filling TODOs
|
|
221
293
|
4. Copy structure, not content (write your own patterns!)
|
|
222
294
|
|
|
@@ -394,8 +466,8 @@ Stay tuned for updates!
|
|
|
394
466
|
|
|
395
467
|
```bash
|
|
396
468
|
# Clone the template
|
|
397
|
-
git clone https://github.com/YOUR_ORG
|
|
398
|
-
cd
|
|
469
|
+
git clone https://github.com/YOUR_ORG/.git
|
|
470
|
+
cd
|
|
399
471
|
|
|
400
472
|
# Run interactive setup
|
|
401
473
|
./scripts/setup.sh
|
|
@@ -408,7 +480,7 @@ cd aiknowsys
|
|
|
408
480
|
|
|
409
481
|
```bash
|
|
410
482
|
# Clone into your project
|
|
411
|
-
git clone https://github.com/YOUR_ORG
|
|
483
|
+
git clone https://github.com/YOUR_ORG/.git temp-template
|
|
412
484
|
cp -r temp-template/scripts ./
|
|
413
485
|
cp -r temp-template/templates ./
|
|
414
486
|
|
|
@@ -432,7 +504,87 @@ cp -r temp-template/templates ./
|
|
|
432
504
|
|
|
433
505
|
## Core Components
|
|
434
506
|
|
|
435
|
-
### 1.
|
|
507
|
+
### 1. AI Knowledge System (.aiknowsys/)
|
|
508
|
+
|
|
509
|
+
**Purpose:** Structured memory and continuous learning for AI assistants.
|
|
510
|
+
|
|
511
|
+
When you run `init`, AIKnowSys creates a `.aiknowsys/` directory that enables AI assistants to maintain context across sessions and accumulate project-specific knowledge over time.
|
|
512
|
+
|
|
513
|
+
**Directory Structure:**
|
|
514
|
+
```
|
|
515
|
+
.aiknowsys/
|
|
516
|
+
├── sessions/ # 🚫 Gitignored - Temporary session working memory
|
|
517
|
+
│ ├── README.md # ✅ Committed - Explains purpose
|
|
518
|
+
│ └── YYYY-MM-DD-session.md # 🚫 Daily session notes (not committed)
|
|
519
|
+
├── learned/ # ✅ Committed - Permanent project-specific patterns
|
|
520
|
+
│ ├── README.md # ✅ Committed - Explains pattern format
|
|
521
|
+
│ └── *.md # ✅ Committed - Discovered patterns
|
|
522
|
+
└── PENDING_REVIEW.md # 🚫 Gitignored - Temporary architect reviews
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### Session Files (Temporary)
|
|
526
|
+
|
|
527
|
+
**What they are:**
|
|
528
|
+
- Working memory for a single AI conversation
|
|
529
|
+
- Created/updated during complex multi-step work
|
|
530
|
+
- Automatically loaded by AI agents at session start
|
|
531
|
+
|
|
532
|
+
**Why gitignored:**
|
|
533
|
+
- Session-specific context (like IDE workspace files)
|
|
534
|
+
- Not useful to other developers or other AI sessions
|
|
535
|
+
- Prevents git history clutter
|
|
536
|
+
|
|
537
|
+
**Benefits:**
|
|
538
|
+
- ✅ Context continuity across messages in same session
|
|
539
|
+
- ✅ AI remembers what you worked on last time
|
|
540
|
+
- ✅ Complex multi-step work doesn't lose progress
|
|
541
|
+
|
|
542
|
+
#### Learned Patterns (Permanent)
|
|
543
|
+
|
|
544
|
+
**What they are:**
|
|
545
|
+
- Discovered patterns applicable to whole project
|
|
546
|
+
- Reusable across all AI assistants and team members
|
|
547
|
+
- Examples: Custom validation rules, debugging techniques, library-specific gotchas
|
|
548
|
+
|
|
549
|
+
**Why committed:**
|
|
550
|
+
- Valuable team knowledge
|
|
551
|
+
- Helps onboard new developers
|
|
552
|
+
- AI assistants get smarter with each session
|
|
553
|
+
- Project knowledge accumulates over time
|
|
554
|
+
|
|
555
|
+
**Benefits:**
|
|
556
|
+
- ✅ Reduced repeated explanations
|
|
557
|
+
- ✅ Team-wide pattern sharing
|
|
558
|
+
- ✅ AI learns from mistakes and successes
|
|
559
|
+
|
|
560
|
+
#### Review Files (Ephemeral)
|
|
561
|
+
|
|
562
|
+
**What they are:**
|
|
563
|
+
- Detailed code reviews created by Architect agent
|
|
564
|
+
- Deleted after Developer addresses issues
|
|
565
|
+
- Temporary handoff mechanism between agents
|
|
566
|
+
|
|
567
|
+
**Example workflow:**
|
|
568
|
+
1. Developer implements feature
|
|
569
|
+
2. Architect writes review to `PENDING_REVIEW.md`
|
|
570
|
+
3. Developer reads review and fixes issues
|
|
571
|
+
4. Developer deletes `PENDING_REVIEW.md`
|
|
572
|
+
|
|
573
|
+
#### Gitignore Configuration
|
|
574
|
+
|
|
575
|
+
The init command automatically adds:
|
|
576
|
+
|
|
577
|
+
```gitignore
|
|
578
|
+
# Session-specific AI memory (temporary, not committed)
|
|
579
|
+
.aiknowsys/sessions/*.md
|
|
580
|
+
!.aiknowsys/sessions/README.md
|
|
581
|
+
.aiknowsys/PENDING_REVIEW.md
|
|
582
|
+
# Note: .aiknowsys/learned/ IS committed (project-specific patterns)
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
**Validation:** Run `npx aiknowsys audit` to check if gitignore is configured correctly.
|
|
586
|
+
|
|
587
|
+
### 2. CODEBASE_ESSENTIALS.md
|
|
436
588
|
|
|
437
589
|
**Purpose:** Single-source reference for architecture, patterns, and critical invariants.
|
|
438
590
|
|
|
@@ -450,17 +602,32 @@ cp -r temp-template/templates ./
|
|
|
450
602
|
|
|
451
603
|
**Why it matters:** AI reads this at session start, ensuring all suggestions align with your architecture.
|
|
452
604
|
|
|
453
|
-
### 2. Custom Agents (Developer
|
|
605
|
+
### 2. Custom Agents (Planner → Developer → Architect)
|
|
454
606
|
|
|
455
|
-
**Purpose:**
|
|
607
|
+
**Purpose:** Three-agent workflow with automated quality gates enforcing documented patterns.
|
|
456
608
|
|
|
457
609
|
**Platform:** GitHub Copilot in VS Code (other AI tools: see [AI Tool Compatibility](#ai-tool-compatibility))
|
|
458
610
|
|
|
459
611
|
**Workflow:**
|
|
460
612
|
```
|
|
461
|
-
User → @
|
|
613
|
+
User → @Planner → Creates implementation plan → Writes to .aiknowsys/CURRENT_PLAN.md →
|
|
614
|
+
@Developer → Reads plan → Implements feature → Auto-handoff →
|
|
615
|
+
@SeniorArchitect → Reviews against ESSENTIALS → Writes to .aiknowsys/PENDING_REVIEW.md → ✅ Approve or 🔄 Refactor
|
|
462
616
|
```
|
|
463
617
|
|
|
618
|
+
**What Planner does:**
|
|
619
|
+
- Breaks down complex features into actionable steps
|
|
620
|
+
- Identifies architectural concerns and dependencies
|
|
621
|
+
- Documents implementation plan in `.aiknowsys/CURRENT_PLAN.md`
|
|
622
|
+
- Ensures proper sequencing and risk mitigation
|
|
623
|
+
|
|
624
|
+
**What Developer does:**
|
|
625
|
+
- Reads implementation plan from `.aiknowsys/CURRENT_PLAN.md`
|
|
626
|
+
- Implements features following project patterns
|
|
627
|
+
- Writes tests (TDD if enabled, coverage testing otherwise)
|
|
628
|
+
- Validates all changes before handoff
|
|
629
|
+
- Auto-calls Architect for code review
|
|
630
|
+
|
|
464
631
|
**What Architect checks:**
|
|
465
632
|
- KISS (Keep It Simple) - No unnecessary complexity
|
|
466
633
|
- DRY (Don't Repeat Yourself) - Proper abstraction
|
package/bin/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ try {
|
|
|
24
24
|
packageJson = JSON.parse(
|
|
25
25
|
readFileSync(join(__dirname, '../package.json'), 'utf-8')
|
|
26
26
|
);
|
|
27
|
-
} catch (
|
|
27
|
+
} catch (_error) {
|
|
28
28
|
console.error(chalk.red('Error: Could not read package.json'));
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
@@ -77,6 +77,7 @@ program
|
|
|
77
77
|
.command('update')
|
|
78
78
|
.description('Update agents, skills, and workflow to latest version')
|
|
79
79
|
.option('-d, --dir <directory>', 'Project directory', '.')
|
|
80
|
+
.option('-e, --essentials <file>', 'ESSENTIALS file name', 'CODEBASE_ESSENTIALS.md')
|
|
80
81
|
.option('-y, --yes', 'Update all components without prompting')
|
|
81
82
|
.option('-f, --force', 'Force update even if already up to date')
|
|
82
83
|
.action(update);
|
|
@@ -85,18 +86,21 @@ program
|
|
|
85
86
|
.command('check')
|
|
86
87
|
.description('Validate knowledge system setup and configuration')
|
|
87
88
|
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
89
|
+
.option('-e, --essentials <file>', 'ESSENTIALS file name', 'CODEBASE_ESSENTIALS.md')
|
|
88
90
|
.action(check);
|
|
89
91
|
|
|
90
92
|
program
|
|
91
93
|
.command('sync')
|
|
92
94
|
.description('Sync AGENTS.md validation reference with CODEBASE_ESSENTIALS.md')
|
|
93
95
|
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
96
|
+
.option('-e, --essentials <file>', 'ESSENTIALS file name', 'CODEBASE_ESSENTIALS.md')
|
|
94
97
|
.action(sync);
|
|
95
98
|
|
|
96
99
|
program
|
|
97
100
|
.command('audit')
|
|
98
101
|
.description('Find common issues and pattern violations in knowledge system')
|
|
99
102
|
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
103
|
+
.option('-e, --essentials <file>', 'ESSENTIALS file name', 'CODEBASE_ESSENTIALS.md')
|
|
100
104
|
.action(audit);
|
|
101
105
|
|
|
102
106
|
// Default command - show help with styled banner
|