@vodailoc/kilo-kit-mcp 1.3.0 → 1.3.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 +200 -361
- package/mcp/README.md +26 -5
- package/mcp/dist/init.js +217 -0
- package/mcp/dist/orchestrator.js +2 -2
- package/mcp/dist/server.js +46 -2
- package/mcp/dist/smoke.js +14 -0
- package/mcp/package.json +6 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,450 +1,289 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="assets/social-preview.png" alt="Kilo-Kit social preview" width="100%">
|
|
3
|
-
</p>
|
|
1
|
+
# Kilo-Kit
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
<a href="https://github.com/VoDaiLocz/KILO-KIT/stargazers"><img src="https://img.shields.io/github/stars/VoDaiLocz/KILO-KIT?style=for-the-badge&logo=github&label=Stars&color=18181b&labelColor=0f172a" alt="GitHub stars"></a>
|
|
7
|
-
<a href="https://github.com/VoDaiLocz/KILO-KIT/commits/main"><img src="https://img.shields.io/github/last-commit/VoDaiLocz/KILO-KIT?style=for-the-badge&logo=git&label=Last%20commit&color=22c55e&labelColor=0f172a" alt="Last commit"></a>
|
|
8
|
-
<a href="https://github.com/VoDaiLocz/KILO-KIT/graphs/contributors"><img src="https://img.shields.io/github/contributors/VoDaiLocz/KILO-KIT?style=for-the-badge&logo=github&label=Contributors&color=f97316&labelColor=0f172a" alt="Contributors"></a>
|
|
9
|
-
<a href="https://github.com/VoDaiLocz/KILO-KIT/actions/workflows/publish.yml"><img src="https://img.shields.io/github/actions/workflow/status/VoDaiLocz/KILO-KIT/publish.yml?style=for-the-badge&logo=githubactions&label=Publish&color=22c55e&labelColor=0f172a" alt="Publish workflow"></a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/@vodailoc/kilo-kit-mcp"><img src="https://img.shields.io/npm/v/@vodailoc/kilo-kit-mcp?style=for-the-badge&logo=npm&label=npm&color=ef4444&labelColor=0f172a" alt="npm version"></a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@vodailoc/kilo-kit-mcp"><img src="https://img.shields.io/npm/dm/@vodailoc/kilo-kit-mcp?style=for-the-badge&logo=npm&label=downloads&color=0284c7&labelColor=0f172a" alt="npm downloads"></a>
|
|
12
|
-
<a href="LICENSE"><img src="https://img.shields.io/github/license/VoDaiLocz/KILO-KIT?style=for-the-badge&label=License&color=64748b&labelColor=0f172a" alt="License"></a>
|
|
13
|
-
</p>
|
|
3
|
+
Kilo-Kit is a local-first skill and orchestration framework for MCP-capable coding agents.
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
<img src="https://img.shields.io/badge/skills-134-06b6d4?style=for-the-badge&labelColor=0f172a" alt="134 skills">
|
|
17
|
-
<img src="https://img.shields.io/badge/MCP-ready-14b8a6?style=for-the-badge&logo=modelcontextprotocol&labelColor=0f172a" alt="MCP ready">
|
|
18
|
-
<img src="https://img.shields.io/badge/Codex-ready-111827?style=for-the-badge&logo=openai&labelColor=0f172a" alt="Codex ready">
|
|
19
|
-
<img src="https://img.shields.io/badge/Trusted%20Publishing-OIDC-8b5cf6?style=for-the-badge&logo=githubactions&labelColor=0f172a" alt="Trusted publishing">
|
|
20
|
-
<img src="https://img.shields.io/badge/Node-%3E%3D20-339933?style=for-the-badge&logo=nodedotjs&labelColor=0f172a" alt="Node >=20">
|
|
21
|
-
<img src="https://img.shields.io/badge/TypeScript-5.9-3178c6?style=for-the-badge&logo=typescript&labelColor=0f172a" alt="TypeScript 5.9">
|
|
22
|
-
</p>
|
|
5
|
+
It packages a curated `skills/` library, an MCP server, and a C4 orchestration gate that turns a user request into an auditable workflow:
|
|
23
6
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
> **Version:** 1.3.0
|
|
27
|
-
> **Author:** Kilo-Kit Team
|
|
28
|
-
> **License:** Apache 2.0
|
|
29
|
-
|
|
30
|
-
## 🎯 What is Kilo-Kit?
|
|
31
|
-
|
|
32
|
-
**Kilo-Kit** is a comprehensive, modular framework for building and managing AI agent systems at scale (kilo-code = thousands of lines, hundreds of files). It introduces a revolutionary **Cognitive Flow Architecture (CFA)** that treats AI interactions as continuous flows rather than discrete events.
|
|
33
|
-
|
|
34
|
-
### Core Philosophy
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
🧠 "Anticipate needs before they arise"
|
|
38
|
-
🔄 "Learn from every interaction"
|
|
39
|
-
📐 "Modularity enables scalability"
|
|
40
|
-
🎯 "Quality over quantity in every token"
|
|
41
|
-
💰 "Cost-aware intelligence"
|
|
7
|
+
```text
|
|
8
|
+
request -> route -> brainstorming gate -> memory confirmation -> workflow release -> verification gate
|
|
42
9
|
```
|
|
43
10
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| Innovation | Description |
|
|
47
|
-
|------------|-------------|
|
|
48
|
-
| **Predictive Context Engine (PCE)** | Pre-loads context before you need it |
|
|
49
|
-
| **Composable Behavior Units (CBU)** | Build workflows from micro-behaviors |
|
|
50
|
-
| **Token Economy Manager (TEM)** | Smart budgeting for cost/quality balance |
|
|
51
|
-
| **Decision Audit Trail (DAT)** | Full explainability for all decisions |
|
|
52
|
-
| **Skill Effectiveness Tracker (SET)** | Self-improving skill system |
|
|
53
|
-
| **Adaptive Routing** | Learns optimal skill selection over time |
|
|
11
|
+
The published package is `@vodailoc/kilo-kit-mcp`.
|
|
54
12
|
|
|
55
|
-
##
|
|
13
|
+
## What It Provides
|
|
56
14
|
|
|
57
|
-
|
|
|
58
|
-
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
| **Security First** | Input validation, parameterized queries, no hardcoded secrets |
|
|
66
|
-
| **Multi-Stack Support** | TypeScript, Python, .NET, Go ready |
|
|
15
|
+
| Area | Purpose |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Skill library | Installable `SKILL.md` workflows grouped by engineering, productivity, debugging, design, operations, docs, and more. |
|
|
18
|
+
| MCP server | stdio server exposing routing, skill loading, validation, C4 orchestration, memory, and route reports. |
|
|
19
|
+
| C4 gate | A closed-loop workflow gate that blocks substantive work until the real brainstorming skill has been followed and approved. |
|
|
20
|
+
| Memory | Optional SQLite-backed facts, decisions, sessions, and workflow outcomes. |
|
|
21
|
+
| Audit | Optional JSONL trail for C4 state transitions and route decisions. |
|
|
22
|
+
| Verification | A returned verification gate that agents must satisfy before claiming completion. |
|
|
67
23
|
|
|
68
|
-
##
|
|
24
|
+
## Install In Two Steps
|
|
69
25
|
|
|
70
|
-
|
|
26
|
+
Step 1: install the MCP server in your client.
|
|
71
27
|
|
|
72
|
-
|
|
73
|
-
|-------|---------|
|
|
74
|
-
| `skills/kilo-kit/` | Core Kilo-Kit framework skills and Hard-Gate workflows |
|
|
75
|
-
| `skills/<category>/<skill>/` | Expanded skill library organized by execution domain |
|
|
76
|
-
| `skills/README.md` | Human-facing catalog with category summaries and install commands |
|
|
77
|
-
| `skills/SKILLS_INDEX.md` | Lightweight agent index for Predictive Context Engine prefetching |
|
|
28
|
+
Use the published package in any MCP-capable host:
|
|
78
29
|
|
|
79
|
-
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"kilo-kit": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["-y", "@vodailoc/kilo-kit-mcp"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
80
40
|
|
|
81
|
-
|
|
41
|
+
Step 2: bootstrap the host-agent rule in your project.
|
|
82
42
|
|
|
83
43
|
```bash
|
|
84
|
-
npx
|
|
44
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client gemini
|
|
45
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client codex
|
|
46
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client claude
|
|
85
47
|
```
|
|
86
48
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Install a Category
|
|
90
|
-
|
|
91
|
-
Use a category path when you only want one execution domain:
|
|
49
|
+
Or initialize all supported host files:
|
|
92
50
|
|
|
93
51
|
```bash
|
|
94
|
-
npx
|
|
52
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client all
|
|
95
53
|
```
|
|
96
54
|
|
|
97
|
-
|
|
55
|
+
This writes an idempotent Kilo-Kit C4 block to:
|
|
98
56
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
57
|
+
| Client | File |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| Gemini CLI | `GEMINI.md` |
|
|
60
|
+
| OpenAI Codex | `AGENTS.md` |
|
|
61
|
+
| Claude Code | `CLAUDE.md` |
|
|
102
62
|
|
|
103
|
-
|
|
63
|
+
The block is wrapped in `KILO-KIT:C4` markers, so running the command again updates the Kilo-Kit section without deleting your existing project rules.
|
|
104
64
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
│ └── instructions.md
|
|
114
|
-
├── .cursor-plugin/ # Cursor IDE entry point
|
|
115
|
-
│ └── instructions.md
|
|
116
|
-
├── .codex/ # OpenAI Codex entry point
|
|
117
|
-
│ └── instructions.md
|
|
118
|
-
├── .opencode/ # OpenCode entry point
|
|
119
|
-
│ └── instructions.md
|
|
120
|
-
│
|
|
121
|
-
├── skills/ # Installable skill packs
|
|
122
|
-
│ ├── README.md # Human-facing skill catalog
|
|
123
|
-
│ ├── SKILLS_INDEX.md # Lightweight agent skill index
|
|
124
|
-
│ ├── kilo-kit/ # Core Kilo-Kit skills
|
|
125
|
-
│ │ ├── _template/ # Skill template
|
|
126
|
-
│ │ ├── debugging/ # Debugging skills
|
|
127
|
-
│ │ ├── development/ # Development skills
|
|
128
|
-
│ │ └── quality/ # Quality assurance skills
|
|
129
|
-
│ ├── engineering/ # Engineering and framework skills
|
|
130
|
-
│ ├── productivity/ # Agent workflow skills
|
|
131
|
-
│ ├── problem-solving/ # Debugging/reasoning skills
|
|
132
|
-
│ ├── design/ # UI/design skills
|
|
133
|
-
│ └── ... # Games, ops, docs, AI media, security
|
|
134
|
-
│
|
|
135
|
-
├── commands/ # Workflow commands
|
|
136
|
-
│ ├── quality-gate.md # Quality gate workflow
|
|
137
|
-
│ ├── init-skill.md # Skill initialization
|
|
138
|
-
│ └── validate-skill.md # Skill validation
|
|
139
|
-
│
|
|
140
|
-
├── src/ # Core system source
|
|
141
|
-
│ ├── core/ # Core system components
|
|
142
|
-
│ │ ├── KILO_MASTER.md # Master skill file (entry point)
|
|
143
|
-
│ │ ├── predictive-engine/ # Predictive Context Engine
|
|
144
|
-
│ │ ├── routing-engine/ # Adaptive Routing Engine
|
|
145
|
-
│ │ ├── execution-engine/ # Execution & Quality Gates
|
|
146
|
-
│ │ └── knowledge-layer/ # Persistent Knowledge
|
|
147
|
-
│ │
|
|
148
|
-
│ ├── behaviors/ # Composable Behavior Units
|
|
149
|
-
│ │ ├── atomic/ # Smallest behavior units
|
|
150
|
-
│ │ ├── compound/ # Combined behaviors
|
|
151
|
-
│ │ └── meta/ # Meta-behaviors
|
|
152
|
-
│ │
|
|
153
|
-
│ └── tools/ # CLI and utility tools
|
|
154
|
-
│ ├── init-skill.py # Skill initializer
|
|
155
|
-
│ ├── validate-skill.py # Skill validator (Python)
|
|
156
|
-
│ └── validate-skill.js # Skill validator (Node.js)
|
|
157
|
-
│
|
|
158
|
-
├── docs/ # Documentation
|
|
159
|
-
│ ├── architecture/ # Architecture decisions
|
|
160
|
-
│ ├── COMPLETION_ASSESSMENT.md
|
|
161
|
-
│ ├── DEEP_ANALYSIS.md
|
|
162
|
-
│ └── PROJECT_STRUCTURE.md
|
|
163
|
-
│
|
|
164
|
-
└── examples/ # Real-world examples
|
|
165
|
-
├── basic/ # Basic usage patterns
|
|
166
|
-
├── intermediate/ # Intermediate patterns
|
|
167
|
-
└── advanced/ # Advanced patterns
|
|
65
|
+
For Codex CLI on Windows, use an npm prefix outside the source checkout so npm does not resolve a local checkout:
|
|
66
|
+
|
|
67
|
+
```toml
|
|
68
|
+
[mcp_servers.kilo-kit]
|
|
69
|
+
command = "npm"
|
|
70
|
+
args = ["exec", "--prefix", "C:\\Users\\Admin", "--yes", "--package=@vodailoc/kilo-kit-mcp", "--", "kilo-kit-mcp"]
|
|
71
|
+
startup_timeout_sec = 60
|
|
72
|
+
enabled = true
|
|
168
73
|
```
|
|
169
74
|
|
|
170
|
-
##
|
|
75
|
+
## Why Bootstrap Is Needed
|
|
171
76
|
|
|
172
|
-
|
|
77
|
+
MCP exposes tools, prompts, resources, and server instructions. It does not force every host agent to call those tools automatically.
|
|
173
78
|
|
|
174
|
-
|
|
175
|
-
# Clone the repository
|
|
176
|
-
git clone https://github.com/VoDaiLocz/KILO-KIT.git
|
|
177
|
-
cd kilo-kit
|
|
79
|
+
Kilo-Kit ships the C4 rule in four places:
|
|
178
80
|
|
|
179
|
-
|
|
180
|
-
|
|
81
|
+
- MCP server instructions.
|
|
82
|
+
- MCP resource `kilo://rules/c4`.
|
|
83
|
+
- MCP prompt `kilo-c4-workflow`.
|
|
84
|
+
- Host bootstrap files created by `kilo-kit-init`.
|
|
181
85
|
|
|
182
|
-
|
|
86
|
+
The bootstrap file is the reliable part. It tells the host agent to call C4 before implementation instead of waiting for the user to manually request MCP usage.
|
|
183
87
|
|
|
184
|
-
|
|
88
|
+
## C4 Workflow
|
|
185
89
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
90
|
+
`kilo_orchestrate_task` is the main C4 entry point. It does not execute code. It routes the request, records state, and releases the next workflow only when the gate conditions are satisfied.
|
|
91
|
+
|
|
92
|
+
The intended flow is:
|
|
189
93
|
|
|
190
|
-
|
|
94
|
+
```text
|
|
95
|
+
1. User sends a substantive task.
|
|
96
|
+
2. Agent calls kilo_orchestrate_task(message, context).
|
|
97
|
+
3. C4 routes the task and injects productivity/brainstorming first.
|
|
98
|
+
4. State becomes brainstorming_required.
|
|
99
|
+
5. Agent loads productivity/brainstorming with kilo_get_skill.
|
|
100
|
+
6. Agent follows that skill and gets user approval.
|
|
101
|
+
7. Agent calls kilo_orchestrate_task again with the same sessionId and brainstormingApproved=true.
|
|
102
|
+
8. C4 checks memory suggestions.
|
|
103
|
+
9. If suggestions exist, state becomes awaiting_memory_confirmation.
|
|
104
|
+
10. Agent accepts or rejects suggestions with memoryConfirmations.
|
|
105
|
+
11. State becomes ready.
|
|
106
|
+
12. C4 returns finalWorkflow without productivity/brainstorming.
|
|
107
|
+
13. Agent loads the first workflow skill with kilo_get_skill.
|
|
108
|
+
14. Agent also checks its internal skill list for other relevant skills before coding.
|
|
109
|
+
15. Agent executes the workflow and satisfies the returned verificationGate before completion.
|
|
191
110
|
```
|
|
192
111
|
|
|
193
|
-
|
|
112
|
+
Read-only requests such as status, show, read, or explain can skip the brainstorming gate.
|
|
194
113
|
|
|
195
|
-
|
|
114
|
+
### C4 States
|
|
196
115
|
|
|
197
|
-
|
|
116
|
+
| State | Meaning |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| `brainstorming_required` | Substantive work is blocked until `productivity/brainstorming` is loaded, followed, and approved by the user. |
|
|
119
|
+
| `awaiting_memory_confirmation` | C4 found remembered operating preferences. The agent must accept or reject them before execution. |
|
|
120
|
+
| `ready` | C4 has released the post-brainstorming workflow and verification gate. |
|
|
198
121
|
|
|
199
|
-
|
|
122
|
+
### Returned Workflow
|
|
200
123
|
|
|
201
|
-
|
|
202
|
-
|-------------|---------|
|
|
203
|
-
| `kilo_orchestrate_task` | C4 central gate: require the real `/brainstorming` skill first, then log/route the approved task and release the post-brainstorming workflow |
|
|
204
|
-
| `kilo_route_intent` | Route the current chat request to skills, workflow order, rule hierarchy, and decision trail |
|
|
205
|
-
| `kilo_search_skills` | Search the skill catalog by task or keyword |
|
|
206
|
-
| `kilo_get_skill` | Load one exact `SKILL.md` with context-safe truncation |
|
|
207
|
-
| `kilo_route_report` | Summarize route telemetry, top skills, workflows, and conflict penalties |
|
|
208
|
-
| `kilo_memory_report` | Inspect C4 global memory facts, decisions, and suggestions |
|
|
209
|
-
| `kilo_validate_skills` | Run the skill validation quality gate |
|
|
210
|
-
| `kilo://skills/index` | Resource view of the lightweight skill index |
|
|
211
|
-
| `kilo://skills/{category}/{skill}` | Resource view for one skill |
|
|
124
|
+
When C4 is ready, it returns:
|
|
212
125
|
|
|
213
|
-
|
|
126
|
+
- `finalWorkflow`: ordered Kilo-Kit skill steps for the task mode.
|
|
127
|
+
- `firstSkillToLoad`: first skill the agent should load with `kilo_get_skill`.
|
|
128
|
+
- `verificationGate`: commands and rationale that must pass before completion.
|
|
129
|
+
- `nextAction`: the immediate instruction for the agent.
|
|
130
|
+
- `auditRef`: present when orchestration audit JSONL is enabled.
|
|
214
131
|
|
|
215
|
-
|
|
216
|
-
{
|
|
217
|
-
"mcpServers": {
|
|
218
|
-
"kilo-kit": {
|
|
219
|
-
"command": "npx",
|
|
220
|
-
"args": ["-y", "@vodailoc/kilo-kit-mcp"]
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
```
|
|
132
|
+
The returned workflow is a primary route, not the only context source. Agents must also inspect their own available skill list and load any other relevant skills before implementation.
|
|
225
133
|
|
|
226
|
-
|
|
134
|
+
## MCP Tools
|
|
227
135
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
136
|
+
| Tool | Purpose |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| `kilo_orchestrate_task` | C4 gate for substantive work. Routes internally, enforces brainstorming first, checks memory, and releases the final workflow. |
|
|
139
|
+
| `kilo_route_intent` | Routes a request to recommended skills, task mode, workflow order, rule hierarchy, and decision trail. |
|
|
140
|
+
| `kilo_search_skills` | Searches the skill catalog by natural-language query. |
|
|
141
|
+
| `kilo_get_skill` | Loads one exact `SKILL.md` with context-safe truncation. |
|
|
142
|
+
| `kilo_route_report` | Reports route telemetry, top skills, workflows, score averages, and conflict penalties. |
|
|
143
|
+
| `kilo_memory_report` | Reports C4 memory facts, decisions, suggestions, sessions, and workflow outcomes. |
|
|
144
|
+
| `kilo_validate_skills` | Runs the skill validation gate. |
|
|
235
145
|
|
|
236
|
-
|
|
146
|
+
## MCP Resources
|
|
237
147
|
|
|
238
|
-
|
|
148
|
+
| Resource | Purpose |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `kilo://skills/index` | Lightweight skill index for discovery. |
|
|
151
|
+
| `kilo://core/master` | Core Kilo-Kit master instructions. |
|
|
152
|
+
| `kilo://rules/c4` | Minimal host-agent operating rules for the C4 workflow. |
|
|
153
|
+
| `kilo://skills/{category}/{skill}` | Dynamic skill resource for one skill. |
|
|
239
154
|
|
|
240
|
-
|
|
155
|
+
## Persistence
|
|
241
156
|
|
|
242
|
-
|
|
157
|
+
Route telemetry is in memory by default. Enable JSONL decision persistence with:
|
|
243
158
|
|
|
244
159
|
```bash
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
npm run build
|
|
248
|
-
npm test
|
|
249
|
-
npm run smoke
|
|
160
|
+
KILO_KIT_WRITE_DECISIONS=true
|
|
161
|
+
KILO_KIT_DECISION_TRAIL_PATH=/absolute/path/decision-trail.jsonl
|
|
250
162
|
```
|
|
251
163
|
|
|
252
|
-
|
|
164
|
+
If `KILO_KIT_DECISION_TRAIL_PATH` is not set, route decisions are written to `.kilo/decision-trail.jsonl` under `KILO_KIT_REPO_ROOT`.
|
|
253
165
|
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
"mcpServers": {
|
|
257
|
-
"kilo-kit": {
|
|
258
|
-
"command": "node",
|
|
259
|
-
"args": ["<absolute-path-to-KILO-KIT>/mcp/dist/server.js"],
|
|
260
|
-
"env": {
|
|
261
|
-
"KILO_KIT_REPO_ROOT": "<absolute-path-to-KILO-KIT>"
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
```
|
|
166
|
+
C4 memory uses `node:sqlite` when available and defaults to:
|
|
267
167
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
168
|
+
```text
|
|
169
|
+
~/.kilo-kit/orchestrator.sqlite
|
|
170
|
+
```
|
|
271
171
|
|
|
272
|
-
|
|
172
|
+
Override C4 paths with:
|
|
273
173
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
| Workflow filename | `publish.yml` |
|
|
174
|
+
```bash
|
|
175
|
+
KILO_KIT_MEMORY_PATH=/absolute/path/orchestrator.sqlite
|
|
176
|
+
KILO_KIT_ORCHESTRATION_AUDIT_PATH=/absolute/path/orchestration-audit.jsonl
|
|
177
|
+
```
|
|
279
178
|
|
|
280
|
-
|
|
179
|
+
C4 memory stores structured facts, decisions, orchestration sessions, and workflow outcomes. The audit file stores append-only state transition events.
|
|
281
180
|
|
|
282
|
-
##
|
|
181
|
+
## Skill Library
|
|
283
182
|
|
|
284
|
-
|
|
285
|
-
|---------------|---------------|
|
|
286
|
-
| `bug, error, fix, debug` | `skills/kilo-kit/debugging/systematic/` |
|
|
287
|
-
| `validate, validation` | `skills/kilo-kit/debugging/systematic/` |
|
|
288
|
-
| `root cause, why` | `skills/kilo-kit/debugging/root-cause/` |
|
|
289
|
-
| `verify, confirm` | `skills/kilo-kit/debugging/verification/` |
|
|
290
|
-
| `review, PR, code review` | `skills/kilo-kit/quality/code-review/` |
|
|
291
|
-
| `test, TDD, testing` | `skills/kilo-kit/quality/testing/` |
|
|
292
|
-
| `security, auth, OWASP` | `skills/kilo-kit/development/security/` |
|
|
293
|
-
| `API, backend, server` | `skills/kilo-kit/development/backend/` |
|
|
183
|
+
`skills/` is the workflow surface shipped with the package.
|
|
294
184
|
|
|
295
|
-
|
|
185
|
+
| Path | Purpose |
|
|
186
|
+
| --- | --- |
|
|
187
|
+
| `skills/SKILLS_INDEX.md` | Lightweight index for routing and discovery. |
|
|
188
|
+
| `skills/kilo-kit/` | Core Kilo-Kit framework skills. |
|
|
189
|
+
| `skills/engineering/` | Engineering and framework workflows. |
|
|
190
|
+
| `skills/productivity/` | Agent workflow and planning skills. |
|
|
191
|
+
| `skills/problem-solving/` | Debugging and reasoning skills. |
|
|
192
|
+
| `skills/design/` | Frontend and product design skills. |
|
|
193
|
+
| `skills/operations/` | DevOps, MCP, shell, browser, and server skills. |
|
|
194
|
+
| `skills/writing-docs/` | Documents, slides, PDFs, spreadsheets, and diagrams. |
|
|
296
195
|
|
|
297
|
-
|
|
196
|
+
Install the full skill library:
|
|
298
197
|
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
Kilo-Kit: ┌─────────────────────────────┐
|
|
303
|
-
│ COGNITIVE FLOW │
|
|
304
|
-
│ │
|
|
305
|
-
Input ───►│ Predict → Execute → Learn │───► Output
|
|
306
|
-
│ ↑ │ │
|
|
307
|
-
Next ───►│ └──────────────┘ │───► Better
|
|
308
|
-
│ │
|
|
309
|
-
└─────────────────────────────┘
|
|
198
|
+
```bash
|
|
199
|
+
npx skills@latest add VoDaiLocz/KILO-KIT
|
|
310
200
|
```
|
|
311
201
|
|
|
312
|
-
|
|
202
|
+
Install one category:
|
|
313
203
|
|
|
314
204
|
```bash
|
|
315
|
-
|
|
316
|
-
typecheck → lint → test → build
|
|
317
|
-
|
|
318
|
-
# All must pass. No exceptions.
|
|
205
|
+
npx skills@latest add VoDaiLocz/KILO-KIT/skills/engineering
|
|
319
206
|
```
|
|
320
207
|
|
|
321
|
-
|
|
208
|
+
Install one skill:
|
|
322
209
|
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
↑ │
|
|
326
|
-
└────────────────────────────┘
|
|
210
|
+
```bash
|
|
211
|
+
npx skills@latest add VoDaiLocz/KILO-KIT/skills/engineering/tdd
|
|
327
212
|
```
|
|
328
213
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
214
|
+
## Repository Layout
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
.
|
|
218
|
+
|-- .claude-plugin/ Claude Code entry instructions
|
|
219
|
+
|-- .codex/ Codex entry instructions
|
|
220
|
+
|-- .cursor-plugin/ Cursor entry instructions
|
|
221
|
+
|-- .mcp/ MCP config examples
|
|
222
|
+
|-- .opencode/ OpenCode entry instructions
|
|
223
|
+
|-- commands/ Reusable workflow commands
|
|
224
|
+
|-- docs/ Architecture and planning documents
|
|
225
|
+
|-- examples/ Example workflows
|
|
226
|
+
|-- mcp/ TypeScript MCP server
|
|
227
|
+
|-- skills/ Installable skill library
|
|
228
|
+
|-- src/core/ Core framework docs and validator entry files
|
|
229
|
+
`-- src/tools/ Skill initialization and validation tools
|
|
335
230
|
```
|
|
336
231
|
|
|
337
|
-
##
|
|
232
|
+
## Local Development
|
|
338
233
|
|
|
339
|
-
|
|
234
|
+
Install, build, test, and smoke-check the MCP server:
|
|
340
235
|
|
|
341
236
|
```bash
|
|
342
|
-
|
|
237
|
+
npm --prefix mcp install
|
|
238
|
+
npm --prefix mcp run build
|
|
239
|
+
npm --prefix mcp run typecheck
|
|
240
|
+
npm --prefix mcp test
|
|
241
|
+
npm --prefix mcp run smoke
|
|
242
|
+
node src/tools/validate-skill.js --all skills
|
|
343
243
|
```
|
|
344
244
|
|
|
345
|
-
|
|
245
|
+
Use a local MCP server during development:
|
|
346
246
|
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"mcpServers": {
|
|
250
|
+
"kilo-kit": {
|
|
251
|
+
"command": "node",
|
|
252
|
+
"args": ["/absolute/path/to/KILO-KIT/mcp/dist/server.js"],
|
|
253
|
+
"env": {
|
|
254
|
+
"KILO_KIT_REPO_ROOT": "/absolute/path/to/KILO-KIT"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
347
259
|
```
|
|
348
|
-
my-skill/
|
|
349
|
-
├── SKILL.md # Main instructions (required)
|
|
350
|
-
├── references/ # Documentation to load as needed
|
|
351
|
-
├── scripts/ # Executable utilities
|
|
352
|
-
└── assets/ # Templates, images, etc.
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### SKILL.md Format
|
|
356
|
-
|
|
357
|
-
```yaml
|
|
358
|
-
---
|
|
359
|
-
name: my-skill
|
|
360
|
-
description: >-
|
|
361
|
-
Clear description of what this skill does and when to use it.
|
|
362
|
-
Include keywords that should trigger this skill.
|
|
363
|
-
version: 1.0.0
|
|
364
|
-
behaviors: [behavior1, behavior2]
|
|
365
|
-
token_estimate:
|
|
366
|
-
min: 500
|
|
367
|
-
typical: 1500
|
|
368
|
-
max: 5000
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
# My Skill
|
|
372
|
-
|
|
373
|
-
## When to Use
|
|
374
|
-
- Situation 1
|
|
375
|
-
- Situation 2
|
|
376
|
-
|
|
377
|
-
## Process
|
|
378
|
-
1. Step 1
|
|
379
|
-
2. Step 2
|
|
380
|
-
|
|
381
|
-
## Guidelines
|
|
382
|
-
- Guideline 1
|
|
383
|
-
- Guideline 2
|
|
384
|
-
|
|
385
|
-
## References
|
|
386
|
-
- `references/detailed-guide.md` - For detailed instructions
|
|
387
|
-
- `scripts/helper.py` - For automated tasks
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
## 📚 Documentation
|
|
391
|
-
|
|
392
|
-
- **[QUICKSTART.md](./QUICKSTART.md)** - Get started in 15 minutes
|
|
393
|
-
- **[docs/architecture/](./docs/architecture/)** - Architecture design documents
|
|
394
|
-
- **[docs/PROJECT_STRUCTURE.md](./docs/PROJECT_STRUCTURE.md)** - Project structure guide
|
|
395
|
-
- **[examples/](./examples/)** - Real-world usage examples
|
|
396
|
-
|
|
397
|
-
## 🤝 Contributing
|
|
398
|
-
|
|
399
|
-
We welcome contributions! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for:
|
|
400
|
-
|
|
401
|
-
- Code of conduct
|
|
402
|
-
- Development setup
|
|
403
|
-
- Pull request process
|
|
404
|
-
- Coding standards
|
|
405
260
|
|
|
406
|
-
##
|
|
261
|
+
## Release
|
|
407
262
|
|
|
408
|
-
|
|
409
|
-
| Category | Preferred | Avoid |
|
|
410
|
-
|----------|-----------|-------|
|
|
411
|
-
| Runtime | Bun, Node 20+ | Node <18 |
|
|
412
|
-
| Backend | Hono, Elysia | Express |
|
|
413
|
-
| ORM | Drizzle, Prisma 5+ | Sequelize |
|
|
414
|
-
| Testing | Vitest, Playwright | Jest |
|
|
415
|
-
| Package | pnpm, Bun | npm |
|
|
263
|
+
The root package publishes through npm Trusted Publishing from GitHub Actions.
|
|
416
264
|
|
|
417
|
-
|
|
418
|
-
| Category | Preferred | Avoid |
|
|
419
|
-
|----------|-----------|-------|
|
|
420
|
-
| Runtime | Python 3.11+ | <3.9 |
|
|
421
|
-
| Backend | FastAPI, Litestar | Flask |
|
|
422
|
-
| ORM | SQLAlchemy 2.0 | <2.0 |
|
|
423
|
-
| Validation | Pydantic v2 | v1 |
|
|
424
|
-
| Linting | Ruff, mypy | flake8 |
|
|
265
|
+
Configure npm once:
|
|
425
266
|
|
|
426
|
-
|
|
427
|
-
|
|
|
428
|
-
|
|
429
|
-
|
|
|
430
|
-
|
|
|
431
|
-
| ORM | EF Core |
|
|
432
|
-
| Testing | xUnit, NUnit |
|
|
267
|
+
| Field | Value |
|
|
268
|
+
| --- | --- |
|
|
269
|
+
| Provider | GitHub Actions |
|
|
270
|
+
| Repository | `VoDaiLocz/KILO-KIT` |
|
|
271
|
+
| Workflow filename | `publish.yml` |
|
|
433
272
|
|
|
434
|
-
|
|
273
|
+
Then run the `Publish npm package` workflow or push a version tag:
|
|
435
274
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
- [ ] v2.0.0 - Visual Workflow Builder
|
|
275
|
+
```bash
|
|
276
|
+
git tag v1.3.1
|
|
277
|
+
git push origin v1.3.1
|
|
278
|
+
```
|
|
441
279
|
|
|
442
|
-
|
|
280
|
+
The release workflow runs build, typecheck, tests, smoke, skill validation, package dry-run, and `npm publish --access public --ignore-scripts`.
|
|
443
281
|
|
|
444
|
-
|
|
282
|
+
## Roadmap
|
|
445
283
|
|
|
446
|
-
|
|
284
|
+
- v1.3.x: C4 gate hardening, memory/audit clarity, documentation cleanup.
|
|
285
|
+
- v2.0.0: Local Visual Workflow Builder for C4 sessions, memory, and audit review.
|
|
447
286
|
|
|
448
|
-
|
|
287
|
+
## License
|
|
449
288
|
|
|
450
|
-
|
|
289
|
+
Apache 2.0. See [LICENSE](./LICENSE).
|
package/mcp/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🔌 Kilo-Kit MCP Server
|
|
2
2
|
|
|
3
|
-
> **Version:** 1.3.
|
|
3
|
+
> **Version:** 1.3.1
|
|
4
4
|
> **Mode:** Read-only Skill Registry + Validator
|
|
5
5
|
> **Transport:** stdio
|
|
6
6
|
|
|
@@ -26,12 +26,14 @@ Resources:
|
|
|
26
26
|
|----------|---------|
|
|
27
27
|
| `kilo://skills/index` | Lightweight skill index |
|
|
28
28
|
| `kilo://core/master` | Kilo-Kit master skill |
|
|
29
|
+
| `kilo://rules/c4` | Minimal host-agent operating rules for the C4 workflow |
|
|
29
30
|
| `kilo://skills/{category}/{skill}` | Dynamic skill resource |
|
|
30
31
|
|
|
31
32
|
Prompts:
|
|
32
33
|
|
|
33
34
|
| Prompt | Purpose |
|
|
34
35
|
|--------|---------|
|
|
36
|
+
| `kilo-c4-workflow` | Run a request through the C4 gate before substantive implementation |
|
|
35
37
|
| `kilo-select-skill` | Route a request before implementation |
|
|
36
38
|
| `kilo-validate-library` | Run the validation quality gate |
|
|
37
39
|
|
|
@@ -50,8 +52,8 @@ npm run smoke
|
|
|
50
52
|
Expected verification:
|
|
51
53
|
|
|
52
54
|
```text
|
|
53
|
-
Test Files
|
|
54
|
-
Tests
|
|
55
|
+
Test Files 10 passed
|
|
56
|
+
Tests 28 passed
|
|
55
57
|
MCP smoke check passed.
|
|
56
58
|
```
|
|
57
59
|
|
|
@@ -74,6 +76,16 @@ Use the published npm package in any MCP-capable client:
|
|
|
74
76
|
|
|
75
77
|
The npm package includes the Kilo-Kit skill library, core master file, validator, and built MCP server.
|
|
76
78
|
|
|
79
|
+
Install the host-agent bootstrap rule in each project where you want C4 to run automatically:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client gemini
|
|
83
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client codex
|
|
84
|
+
npx -y --package=@vodailoc/kilo-kit-mcp kilo-kit-init init --client claude
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use `--client all` to write `GEMINI.md`, `AGENTS.md`, and `CLAUDE.md` in the target project. Use `--dir <path>` to initialize another project directory.
|
|
88
|
+
|
|
77
89
|
Route telemetry is in-memory by default. To persist route decisions between server runs, set:
|
|
78
90
|
|
|
79
91
|
```bash
|
|
@@ -93,6 +105,14 @@ KILO_KIT_ORCHESTRATION_AUDIT_PATH=/absolute/path/orchestration-audit.jsonl
|
|
|
93
105
|
|
|
94
106
|
`kilo_orchestrate_task` uses the C4 Brainstorming-First Gate as a skill gate, not a separate C4 questionnaire. Substantive work starts by loading and following `productivity/brainstorming`. After the user approves the brainstorming direction, call `kilo_orchestrate_task` again with `brainstormingApproved=true`; C4 then checks memory suggestions and releases the post-brainstorming workflow.
|
|
95
107
|
|
|
108
|
+
The released workflow is the primary C4 route, not an exclusive context source. After loading the first C4-selected skill, the agent must still inspect its own available skill list and load any other relevant skills before coding.
|
|
109
|
+
|
|
110
|
+
Installing the MCP server exposes tools, prompts, resources, and server instructions. It does not force every MCP host to call those tools automatically. If a client does not reliably follow MCP server instructions, use `kilo-kit-init` or add one bootstrap rule to the local agent configuration:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
For substantive project work, call kilo_orchestrate_task before implementation and follow the returned C4 state, workflow, and verificationGate.
|
|
114
|
+
```
|
|
115
|
+
|
|
96
116
|
### Codex CLI on Windows
|
|
97
117
|
|
|
98
118
|
When Codex is opened inside the Kilo-Kit source checkout, `npx -y @vodailoc/kilo-kit-mcp` can resolve the local package instead of the published package. Use an npm prefix outside the repository:
|
|
@@ -120,8 +140,8 @@ Configure the npm package once:
|
|
|
120
140
|
Then publish by running the GitHub Actions workflow `Publish npm package`, or by pushing a version tag:
|
|
121
141
|
|
|
122
142
|
```bash
|
|
123
|
-
git tag v1.3.
|
|
124
|
-
git push origin v1.3.
|
|
143
|
+
git tag v1.3.1
|
|
144
|
+
git push origin v1.3.1
|
|
125
145
|
```
|
|
126
146
|
|
|
127
147
|
The workflow runs build, typecheck, tests, smoke, skill validation, package dry-run, and then `npm publish --access public --ignore-scripts` through OIDC.
|
|
@@ -178,6 +198,7 @@ User request
|
|
|
178
198
|
→ kilo_orchestrate_task(message, context, brainstormingApproved=true)
|
|
179
199
|
→ accept/reject memory suggestions when relevant
|
|
180
200
|
→ kilo_get_skill(category, skill) for the first post-brainstorming workflow skill
|
|
201
|
+
→ inspect the agent's internal skill list and load any other relevant skills
|
|
181
202
|
→ follow final workflow skills in order
|
|
182
203
|
→ kilo_route_report when you need routing analytics
|
|
183
204
|
→ kilo_memory_report when you need memory analytics
|
package/mcp/dist/init.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { lstatSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
const START_MARKER = "<!-- KILO-KIT:C4:START -->";
|
|
6
|
+
const END_MARKER = "<!-- KILO-KIT:C4:END -->";
|
|
7
|
+
const MAX_BOOTSTRAP_FILE_BYTES = 256 * 1024;
|
|
8
|
+
const CLIENT_FILES = {
|
|
9
|
+
gemini: {
|
|
10
|
+
fileName: "GEMINI.md",
|
|
11
|
+
displayName: "Gemini CLI",
|
|
12
|
+
},
|
|
13
|
+
codex: {
|
|
14
|
+
fileName: "AGENTS.md",
|
|
15
|
+
displayName: "OpenAI Codex",
|
|
16
|
+
},
|
|
17
|
+
claude: {
|
|
18
|
+
fileName: "CLAUDE.md",
|
|
19
|
+
displayName: "Claude Code",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export function bootstrap(options) {
|
|
23
|
+
validateTargetDirectory(options.cwd);
|
|
24
|
+
const targets = resolveTargets(options);
|
|
25
|
+
return targets.map((target) => writeBootstrapBlock(target));
|
|
26
|
+
}
|
|
27
|
+
function resolveTargets(options) {
|
|
28
|
+
const clients = options.client === "all" ? Object.keys(CLIENT_FILES) : [options.client];
|
|
29
|
+
return clients.map((client) => {
|
|
30
|
+
const config = CLIENT_FILES[client];
|
|
31
|
+
return {
|
|
32
|
+
client,
|
|
33
|
+
filePath: path.resolve(options.cwd, config.fileName),
|
|
34
|
+
displayName: config.displayName,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function writeBootstrapBlock(target) {
|
|
39
|
+
assertSafeTarget(target.filePath);
|
|
40
|
+
const block = buildBootstrapBlock(target);
|
|
41
|
+
let action = "created";
|
|
42
|
+
let nextContent = block;
|
|
43
|
+
try {
|
|
44
|
+
const current = readFileSync(target.filePath, "utf8");
|
|
45
|
+
action = "updated";
|
|
46
|
+
nextContent = replaceOrAppendBlock(current, block);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (!isNotFoundError(error)) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
writeFileAtomic(target.filePath, nextContent);
|
|
54
|
+
return {
|
|
55
|
+
client: target.client,
|
|
56
|
+
filePath: target.filePath,
|
|
57
|
+
action,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function replaceOrAppendBlock(current, block) {
|
|
61
|
+
const start = current.indexOf(START_MARKER);
|
|
62
|
+
const end = current.indexOf(END_MARKER);
|
|
63
|
+
const hasStart = start >= 0;
|
|
64
|
+
const hasEnd = end >= 0;
|
|
65
|
+
if (hasStart !== hasEnd || (hasStart && end < start)) {
|
|
66
|
+
throw new Error(`Refusing to update bootstrap file because the Kilo-Kit marker block is malformed. Fix or remove ${START_MARKER} / ${END_MARKER} manually.`);
|
|
67
|
+
}
|
|
68
|
+
if (start >= 0 && end > start) {
|
|
69
|
+
const afterEnd = end + END_MARKER.length;
|
|
70
|
+
return `${current.slice(0, start)}${block}${current.slice(afterEnd)}`;
|
|
71
|
+
}
|
|
72
|
+
const separator = current.endsWith("\n") ? "\n" : "\n\n";
|
|
73
|
+
return `${current}${separator}${block}`;
|
|
74
|
+
}
|
|
75
|
+
function buildBootstrapBlock(target) {
|
|
76
|
+
return `${START_MARKER}
|
|
77
|
+
## Kilo-Kit C4 Workflow
|
|
78
|
+
|
|
79
|
+
Applies to: ${target.displayName}
|
|
80
|
+
|
|
81
|
+
For substantive coding, debugging, refactoring, review, publishing, or project-work requests:
|
|
82
|
+
|
|
83
|
+
1. Call \`kilo_orchestrate_task\` before implementation.
|
|
84
|
+
2. If state is \`brainstorming_required\`, load \`productivity/brainstorming\` with \`kilo_get_skill\`, follow it, and get user approval.
|
|
85
|
+
3. Call \`kilo_orchestrate_task\` again with the same \`sessionId\` and \`brainstormingApproved=true\`.
|
|
86
|
+
4. If state is \`awaiting_memory_confirmation\`, accept or reject memory suggestions before execution.
|
|
87
|
+
5. When state is \`ready\`, load \`firstSkillToLoad\` with \`kilo_get_skill\`.
|
|
88
|
+
6. Also inspect the host agent's own available skill list and load any other relevant skills before coding.
|
|
89
|
+
7. Follow \`finalWorkflow\`.
|
|
90
|
+
8. Satisfy \`verificationGate\` before claiming completion.
|
|
91
|
+
|
|
92
|
+
For read-only requests, \`kilo_route_intent\` is enough.
|
|
93
|
+
${END_MARKER}
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
function isNotFoundError(error) {
|
|
97
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
98
|
+
}
|
|
99
|
+
function validateTargetDirectory(cwd) {
|
|
100
|
+
let stats;
|
|
101
|
+
try {
|
|
102
|
+
stats = statSync(cwd);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
if (isNotFoundError(error)) {
|
|
106
|
+
throw new Error(`Target directory does not exist: ${cwd}`);
|
|
107
|
+
}
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
if (!stats.isDirectory()) {
|
|
111
|
+
throw new Error(`Target path is not a directory: ${cwd}`);
|
|
112
|
+
}
|
|
113
|
+
if (lstatSync(cwd).isSymbolicLink()) {
|
|
114
|
+
throw new Error(`Refusing to write bootstrap files through a symlinked directory: ${cwd}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function assertSafeTarget(filePath) {
|
|
118
|
+
try {
|
|
119
|
+
const stats = lstatSync(filePath);
|
|
120
|
+
if (stats.isSymbolicLink()) {
|
|
121
|
+
throw new Error(`Refusing to update symlinked bootstrap file: ${filePath}`);
|
|
122
|
+
}
|
|
123
|
+
if (!stats.isFile()) {
|
|
124
|
+
throw new Error(`Refusing to update non-file bootstrap target: ${filePath}`);
|
|
125
|
+
}
|
|
126
|
+
if (stats.size > MAX_BOOTSTRAP_FILE_BYTES) {
|
|
127
|
+
throw new Error(`Refusing to update bootstrap file larger than ${MAX_BOOTSTRAP_FILE_BYTES} bytes: ${filePath}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (!isNotFoundError(error)) {
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function writeFileAtomic(filePath, content) {
|
|
137
|
+
const dir = path.dirname(filePath);
|
|
138
|
+
const base = path.basename(filePath);
|
|
139
|
+
const tempPath = path.join(dir, `.${base}.${process.pid}.${Date.now()}.tmp`);
|
|
140
|
+
try {
|
|
141
|
+
writeFileSync(tempPath, content, { encoding: "utf8", flag: "wx", mode: 0o644 });
|
|
142
|
+
renameSync(tempPath, filePath);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
try {
|
|
146
|
+
unlinkSync(tempPath);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// Best-effort cleanup only.
|
|
150
|
+
}
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function parseArgs(argv) {
|
|
155
|
+
const command = argv[0];
|
|
156
|
+
if (command !== "init") {
|
|
157
|
+
throw new Error(usage());
|
|
158
|
+
}
|
|
159
|
+
let client;
|
|
160
|
+
let cwd = process.cwd();
|
|
161
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
162
|
+
const arg = argv[index];
|
|
163
|
+
if (arg === "--client") {
|
|
164
|
+
const value = argv[index + 1];
|
|
165
|
+
if (!value || !isClient(value)) {
|
|
166
|
+
throw new Error("Expected --client to be one of: gemini, codex, claude, all.");
|
|
167
|
+
}
|
|
168
|
+
client = value;
|
|
169
|
+
index += 1;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (arg === "--dir") {
|
|
173
|
+
const value = argv[index + 1];
|
|
174
|
+
if (!value) {
|
|
175
|
+
throw new Error("Expected --dir to receive a path.");
|
|
176
|
+
}
|
|
177
|
+
cwd = path.resolve(value);
|
|
178
|
+
index += 1;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (arg === "--help" || arg === "-h") {
|
|
182
|
+
throw new Error(usage());
|
|
183
|
+
}
|
|
184
|
+
throw new Error(`Unknown argument: ${arg}\n\n${usage()}`);
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
client: client ?? "all",
|
|
188
|
+
cwd,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function isClient(value) {
|
|
192
|
+
return value === "gemini" || value === "codex" || value === "claude" || value === "all";
|
|
193
|
+
}
|
|
194
|
+
function usage() {
|
|
195
|
+
return [
|
|
196
|
+
"Usage:",
|
|
197
|
+
" kilo-kit-init init [--client gemini|codex|claude|all] [--dir <path>]",
|
|
198
|
+
"",
|
|
199
|
+
"Examples:",
|
|
200
|
+
" kilo-kit-init init --client gemini",
|
|
201
|
+
" kilo-kit-init init --client codex --dir /path/to/project",
|
|
202
|
+
" kilo-kit-init init --client all",
|
|
203
|
+
].join("\n");
|
|
204
|
+
}
|
|
205
|
+
async function main() {
|
|
206
|
+
const options = parseArgs(process.argv.slice(2));
|
|
207
|
+
const results = bootstrap(options);
|
|
208
|
+
for (const result of results) {
|
|
209
|
+
console.log(`${result.action}: ${result.filePath}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
213
|
+
main().catch((error) => {
|
|
214
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
215
|
+
process.exit(1);
|
|
216
|
+
});
|
|
217
|
+
}
|
package/mcp/dist/orchestrator.js
CHANGED
|
@@ -187,9 +187,9 @@ function buildNextAction(state, session, pendingSuggestions, firstSkillToLoad) {
|
|
|
187
187
|
return `Accept or reject memory suggestions before execution: ${pendingSuggestions.map((item) => item.key).join(", ")}.`;
|
|
188
188
|
}
|
|
189
189
|
if (firstSkillToLoad) {
|
|
190
|
-
return `Load ${firstSkillToLoad.id} with kilo_get_skill, then follow the final workflow.`;
|
|
190
|
+
return `Load ${firstSkillToLoad.id} with kilo_get_skill, then follow the final workflow. IMPORTANT: Do NOT rely solely on this workflow. You MUST also scan your full internal skill list (in your system prompt) and use view_file to load any other relevant skills before coding.`;
|
|
191
191
|
}
|
|
192
|
-
return session.route.nextAction;
|
|
192
|
+
return session.route.nextAction + " IMPORTANT: You MUST also scan your full internal skill list and load any other relevant skills before coding.";
|
|
193
193
|
}
|
|
194
194
|
function executableWorkflow(session) {
|
|
195
195
|
if (!session.brainstormingApproved) {
|
package/mcp/dist/server.js
CHANGED
|
@@ -15,7 +15,7 @@ import { createInMemoryRouteAnalytics, createJsonlRouteAnalytics } from "./route
|
|
|
15
15
|
import { createSkillRegistry } from "./registry.js";
|
|
16
16
|
import { routeIntent } from "./router.js";
|
|
17
17
|
import { validateSkills } from "./validator.js";
|
|
18
|
-
const SERVER_VERSION = "1.3.
|
|
18
|
+
const SERVER_VERSION = "1.3.1";
|
|
19
19
|
const DEFAULT_REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
20
20
|
const formatSchema = z.enum(["markdown", "json"]).default("markdown");
|
|
21
21
|
export async function createKiloKitServer(options = {}) {
|
|
@@ -43,7 +43,7 @@ export async function createKiloKitServer(options = {}) {
|
|
|
43
43
|
name: "kilo-kit",
|
|
44
44
|
version: SERVER_VERSION,
|
|
45
45
|
}, {
|
|
46
|
-
instructions: "
|
|
46
|
+
instructions: "For substantive coding, debugging, refactoring, review, publishing, or project-work requests, call kilo_orchestrate_task before implementation. If it returns brainstorming_required, load productivity/brainstorming with kilo_get_skill and get user approval before coding. After approval, call kilo_orchestrate_task again with the same sessionId and brainstormingApproved=true. If it returns awaiting_memory_confirmation, accept or reject memory suggestions before execution. When it returns ready, load firstSkillToLoad with kilo_get_skill, inspect any additional relevant skills available in the host agent, follow the finalWorkflow, and satisfy verificationGate before claiming completion. For read-only requests, kilo_route_intent is acceptable. Route telemetry is in-memory by default and only persists when KILO_KIT_WRITE_DECISIONS=true.",
|
|
47
47
|
});
|
|
48
48
|
server.registerTool("kilo_orchestrate_task", {
|
|
49
49
|
title: "Kilo-Kit C4 Orchestrate Task",
|
|
@@ -237,6 +237,18 @@ function registerResources(server, repoRoot, registry) {
|
|
|
237
237
|
},
|
|
238
238
|
],
|
|
239
239
|
}));
|
|
240
|
+
server.registerResource("kilo-c4-operating-rules", "kilo://rules/c4", {
|
|
241
|
+
title: "Kilo-Kit C4 Operating Rules",
|
|
242
|
+
description: "Minimal rules a host agent should follow after installing the Kilo-Kit MCP server.",
|
|
243
|
+
mimeType: "text/markdown",
|
|
244
|
+
}, async (uri) => ({
|
|
245
|
+
contents: [
|
|
246
|
+
{
|
|
247
|
+
uri: uri.href,
|
|
248
|
+
text: C4_OPERATING_RULES,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
}));
|
|
240
252
|
server.registerResource("kilo-skill", new ResourceTemplate("kilo://skills/{category}/{skill}", {
|
|
241
253
|
list: async () => ({
|
|
242
254
|
resources: registry.listSkills().map((skill) => ({
|
|
@@ -265,6 +277,23 @@ function registerResources(server, repoRoot, registry) {
|
|
|
265
277
|
});
|
|
266
278
|
}
|
|
267
279
|
function registerPrompts(server) {
|
|
280
|
+
server.registerPrompt("kilo-c4-workflow", {
|
|
281
|
+
title: "Run Request Through C4",
|
|
282
|
+
description: "Prompt the agent to use the C4 gate before substantive implementation work.",
|
|
283
|
+
argsSchema: {
|
|
284
|
+
request: z.string().min(1).max(4000),
|
|
285
|
+
},
|
|
286
|
+
}, ({ request }) => ({
|
|
287
|
+
messages: [
|
|
288
|
+
{
|
|
289
|
+
role: "user",
|
|
290
|
+
content: {
|
|
291
|
+
type: "text",
|
|
292
|
+
text: `Use the Kilo-Kit C4 workflow for this request. Call kilo_orchestrate_task first. If the state is brainstorming_required, load productivity/brainstorming with kilo_get_skill and get approval before coding. If the state is awaiting_memory_confirmation, resolve the suggestions. When the state is ready, load firstSkillToLoad, inspect any other relevant host-agent skills, follow finalWorkflow, and satisfy verificationGate before completion.\n\nRequest:\n${request}`,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
}));
|
|
268
297
|
server.registerPrompt("kilo-select-skill", {
|
|
269
298
|
title: "Select Kilo-Kit Skill",
|
|
270
299
|
description: "Prompt the agent to route the current request through Kilo-Kit before implementation.",
|
|
@@ -301,6 +330,21 @@ function registerPrompts(server) {
|
|
|
301
330
|
function normalizeFormat(format) {
|
|
302
331
|
return format ?? "markdown";
|
|
303
332
|
}
|
|
333
|
+
const C4_OPERATING_RULES = `# Kilo-Kit C4 Operating Rules
|
|
334
|
+
|
|
335
|
+
For substantive coding, debugging, refactoring, review, publishing, or project-work requests:
|
|
336
|
+
|
|
337
|
+
1. Call \`kilo_orchestrate_task\` before implementation.
|
|
338
|
+
2. If state is \`brainstorming_required\`, load \`productivity/brainstorming\` with \`kilo_get_skill\`, follow it, and get user approval.
|
|
339
|
+
3. Call \`kilo_orchestrate_task\` again with the same \`sessionId\` and \`brainstormingApproved=true\`.
|
|
340
|
+
4. If state is \`awaiting_memory_confirmation\`, accept or reject memory suggestions before execution.
|
|
341
|
+
5. When state is \`ready\`, load \`firstSkillToLoad\` with \`kilo_get_skill\`.
|
|
342
|
+
6. Also inspect the host agent's own available skill list and load any other relevant skills before coding.
|
|
343
|
+
7. Follow \`finalWorkflow\`.
|
|
344
|
+
8. Satisfy \`verificationGate\` before claiming completion.
|
|
345
|
+
|
|
346
|
+
For read-only requests, \`kilo_route_intent\` is enough.
|
|
347
|
+
`;
|
|
304
348
|
async function main() {
|
|
305
349
|
const server = await createKiloKitServer();
|
|
306
350
|
const transport = new StdioServerTransport();
|
package/mcp/dist/smoke.js
CHANGED
|
@@ -23,6 +23,20 @@ try {
|
|
|
23
23
|
throw new Error(`Missing expected tool: ${required}`);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
const prompts = await client.listPrompts();
|
|
27
|
+
const promptNames = prompts.prompts.map((prompt) => prompt.name);
|
|
28
|
+
for (const required of ["kilo-c4-workflow", "kilo-select-skill", "kilo-validate-library"]) {
|
|
29
|
+
if (!promptNames.includes(required)) {
|
|
30
|
+
throw new Error(`Missing expected prompt: ${required}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const resources = await client.listResources();
|
|
34
|
+
const resourceUris = resources.resources.map((resource) => resource.uri);
|
|
35
|
+
for (const required of ["kilo://skills/index", "kilo://core/master", "kilo://rules/c4"]) {
|
|
36
|
+
if (!resourceUris.includes(required)) {
|
|
37
|
+
throw new Error(`Missing expected resource: ${required}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
26
40
|
const route = await client.callTool({
|
|
27
41
|
name: "kilo_route_intent",
|
|
28
42
|
arguments: {
|
package/mcp/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kilo-kit/mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Kilo-Kit MCP server for skill routing, skill loading, and validation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"bin": {
|
|
8
|
-
"kilo-kit-mcp": "./dist/server.js"
|
|
8
|
+
"kilo-kit-mcp": "./dist/server.js",
|
|
9
|
+
"kilo-kit-init": "./dist/init.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build": "tsc -p tsconfig.json",
|
|
@@ -25,5 +26,8 @@
|
|
|
25
26
|
},
|
|
26
27
|
"engines": {
|
|
27
28
|
"node": ">=20.0.0"
|
|
29
|
+
},
|
|
30
|
+
"optionalDependencies": {
|
|
31
|
+
"@rolldown/binding-linux-x64-gnu": "^1.0.0-rc.17"
|
|
28
32
|
}
|
|
29
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vodailoc/kilo-kit-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Kilo-Kit MCP server for adaptive skill routing, skill loading, and validation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Kilo-Kit Team",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"url": "https://github.com/VoDaiLocz/KILO-KIT/issues"
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
|
-
"kilo-kit-mcp": "mcp/dist/server.js"
|
|
16
|
+
"kilo-kit-mcp": "mcp/dist/server.js",
|
|
17
|
+
"kilo-kit-init": "mcp/dist/init.js"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"LICENSE",
|