cognitive-kit 1.0.0-alpha.3 → 1.0.0-alpha.4

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/cli.mjs ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import('./dist/cli.js').catch((err) => {
3
+ console.error('cognitive-kit failed:', err.message);
4
+ process.exit(1);
5
+ });
@@ -0,0 +1,348 @@
1
+ # Antigravity Integration Guide
2
+
3
+ Integrate `cognitive-kit` (31+ MCP tools) into the **Antigravity AI Agent** framework to extend its cognitive capabilities — reasoning, research, planning, security, knowledge, agency orchestration, and adaptive pipelines.
4
+
5
+ ---
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ ┌──────────────────────────────────────────────┐
11
+ │ ANTIGRAVITY AI AGENT │
12
+ │ .gemini/GEMINI.md ← Agent Rules │
13
+ │ C4IRS+S Roles ← Reasoning Cycles │
14
+ │ AR-Tier Personas ← Domain Specialization │
15
+ │ │
16
+ │ ┌──────────────────────────────────────┐ │
17
+ │ │ MCP CLIENT (built-in) │ │
18
+ │ └──────────┬───────────────────────────┘ │
19
+ └─────────────┼────────────────────────────────┘
20
+ │ MCP stdio/SSE
21
+
22
+ ┌──────────────────────────────────────────────┐
23
+ │ COGNITIVE KIT (MCP Server) │
24
+ │ │
25
+ │ 31 tools: cognitive_reason, cognitive_plan, │
26
+ │ security_gate, ethics_audit, agency_execute, │
27
+ │ guardian_status, skill_forge, federation... │
28
+ │ │
29
+ │ Guardian Gate → Sovereignty + Firewall │
30
+ │ Agency Orch. → Adaptive pipelines │
31
+ │ Skill Forging → Pattern → Skills │
32
+ │ Federation → Multi-kit │
33
+ └──────────────────────────────────────────────┘
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Quick Start (VS Code)
39
+
40
+ ### 1. Install the Kit
41
+
42
+ ```bash
43
+ npm install -g cognitive-kit
44
+ ```
45
+
46
+ ### 2. Configure MCP in VS Code
47
+
48
+ Create `.vscode/mcp.json` in your workspace:
49
+
50
+ ```json
51
+ {
52
+ "servers": {
53
+ "cognitive-kit": {
54
+ "type": "stdio",
55
+ "command": "npx",
56
+ "args": ["cognitive-kit"],
57
+ "env": {
58
+ "KIT_HOST_ID": "antigravity-${workspaceFolderBasename}",
59
+ "KIT_HOST_NAME": "${workspaceFolderBasename}",
60
+ "KIT_SOVEREIGN_KEY": ""
61
+ }
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### 3. Restart VS Code
68
+
69
+ The kit's 31 tools appear in the MCP tool list. Antigravity can now invoke them via C4IRS cycles.
70
+
71
+ ---
72
+
73
+ ## Persona-to-Tool Mapping
74
+
75
+ Map C4IRS+S roles and AR-tier personas to cognitive-kit tools for precise capability delegation.
76
+
77
+ | C4IRS Role | AR Persona | cognitive-kit Tools |
78
+ |------------|------------|-------------------|
79
+ | **`[C]` Command** | AR-100 Architect | `cognitive_plan`, `cognitive_reason`, `consensus_engine` |
80
+ | **`[C]` Control** | AR-200 Engineer | `execution_flow`, `swarm_orchestrator`, `subagent_protocol` |
81
+ | **`[C]` Communications** | AR-300 Artisan | `cognitive_create`, `sentiment_adapter`, `context_synth` |
82
+ | **`[I]` Intelligence** | AR-400 Oracle | `cognitive_research`, `knowledge_evolve`, `memory_vam` |
83
+ | **`[R]` Reconnaissance** | AR-400 Oracle | `code_archaeologist`, `context_synth`, `threat_mapper` |
84
+ | **`[S]` Surveillance** | AR-500 Operator | `guardian_status`, `state_guardian`, `integrity_ledger` |
85
+ | **`[S]` Sovereignty** | AR-100 Architect | `guardian_freeze`, `guardian_unfreeze`, `integrity_ledger` |
86
+
87
+ ---
88
+
89
+ ## C4IRS Workflow Integration
90
+
91
+ ### `[C]` Command — Strategic Planning
92
+
93
+ Instead of manual reasoning, delegate to the agency pipeline:
94
+
95
+ ```
96
+ Antigravity: "Plan the authentication microservice"
97
+ → calls agency_execute(objective: "Design auth service", mode: "adaptive")
98
+ → Kit selects phases: [delimit, research, architect, security, validate]
99
+ → Kit assigns agents: [Strategist, Analyst, Architect, Guardian, Validator]
100
+ → Returns: mission plan with 5 phases, synergy score, sovereignty seal
101
+ ```
102
+
103
+ ### `[I]` Intelligence — Deep Research
104
+
105
+ Use multi-perspective research:
106
+
107
+ ```
108
+ Antigravity: "Research vector database options"
109
+ → calls cognitive_research(topic: "vector databases 2026", depth: "deep")
110
+ → Returns: analysis from architect, guardian, executor, strategic perspectives
111
+ ```
112
+
113
+ ### `[R]` Reconnaissance — Codebase Analysis
114
+
115
+ Analyze project structure:
116
+
117
+ ```
118
+ Antigravity: "Analyze the src/ directory structure"
119
+ → calls fs_list(path: "src")
120
+ → calls code_archaeologist(code: "<file content>", mode: "full")
121
+ → calls knowledge_evolve(knowledgeBase: "<analysis>", mode: "gap")
122
+ ```
123
+
124
+ ### `[S]` Surveillance — System Health
125
+
126
+ Monitor the kit's operational state:
127
+
128
+ ```
129
+ Antigravity: "Check system health"
130
+ → calls guardian_status()
131
+ → Returns: tool metrics, error rate, firewall stats, sovereignty chain
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Prompt Injection (`.gemini/GEMINI.md`)
137
+
138
+ Add these rules to your `.gemini/GEMINI.md` to enable cognitive-kit awareness:
139
+
140
+ ```markdown
141
+ ## 🧠 Cognitive Kit Integration (MCP)
142
+
143
+ You have access to the Cognitive Kit MCP server with 31+ tools.
144
+
145
+ ### Available Tool Categories
146
+
147
+ | Category | Tools | Use Case |
148
+ |----------|-------|----------|
149
+ | **Cognitive** | reason, research, plan, create, reflect | Core reasoning & analysis |
150
+ | **Security** | gate, ethics, ledger, threat, redteam, blast | Security audits & threat modeling |
151
+ | **Knowledge** | vam, evolve, synth | Memory & knowledge operations |
152
+ | **Analysis** | code, sentiment, consensus, flow | Code review & process analysis |
153
+ | **Agency** | swarm, meta, subagent, execute | Multi-agent orchestration |
154
+ | **Guardian** | status, freeze, unfreeze | System monitoring & control |
155
+ | **Federation** | status, connect, execute, disconnect | Multi-kit communication |
156
+ | **Forge** | skill_forge, skill_list_forged | Auto-generate skills |
157
+
158
+ ### C4IRS Tool Delegation
159
+
160
+ - Use `agency_execute` for complex multi-step tasks (replaces manual iteration)
161
+ - Use `cognitive_reason` for logical analysis (replaces chain-of-thought)
162
+ - Use `consensus_engine` for architectural decisions (replaces manual deliberation)
163
+ - Use `threat_mapper` for risk assessment (replaces STRIDE manual analysis)
164
+ - Use `guardian_status` before ANY destructive operation
165
+
166
+ ### Execution Protocol
167
+
168
+ 1. Before any action, call `guardian_status` to verify system health
169
+ 2. For complex tasks, call `agency_execute` with mode: "adaptive"
170
+ 3. For analysis, delegate to the appropriate cognitive tool
171
+ 4. After execution, call `integrity_ledger` to seal the operation
172
+ 5. Call `guardian_status` to verify post-operation state
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Antigravity Autorun Configuration
178
+
179
+ Update your `.antigravity-autorun.njk` to start the kit automatically:
180
+
181
+ ```njk
182
+ # Antigravity Autorun Configuration
183
+ # Auto-enables CDP: true
184
+ # Run always: true
185
+
186
+ # Start Cognitive Kit MCP Server
187
+ npx cognitive-kit &
188
+ sleep 2
189
+ echo "Cognitive Kit ready — 31 tools available"
190
+
191
+ {% set languages = ["python", "go", "typescript"] %}
192
+ {% for lang in languages %}
193
+ - Enable {{ lang }} usage: true
194
+ {% endfor %}
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Using cognitive-kit as a Library (Embedded Mode)
200
+
201
+ For deeper integration, embed cognitive-kit directly into Antigravity's runtime:
202
+
203
+ ```javascript
204
+ // antigravity-cognitive.js
205
+ import { CognitiveKit, FileSystemAdapter } from 'cognitive-kit';
206
+
207
+ const kit = new CognitiveKit({
208
+ host: new FileSystemAdapter(process.cwd(), { allowWrite: true }),
209
+ storage: { type: 'sqlite', path: './.cognitive-kit.db' },
210
+ transport: { type: 'direct' }, // in-process, no MCP needed
211
+ sovereignty: {
212
+ hostId: 'antigravity-' + process.env.KIT_HOST_ID,
213
+ hostName: 'Antigravity Agent',
214
+ },
215
+ });
216
+
217
+ await kit.initialize();
218
+
219
+ export default {
220
+ // Expose tools to Antigravity's reasoning engine
221
+ reason: (problem) => kit['toolRegistry'].execute('cognitive_reason', { problem }),
222
+ research: (topic) => kit['toolRegistry'].execute('cognitive_research', { topic }),
223
+ plan: (objective) => kit.executeAgency(objective, { mode: 'adaptive' }),
224
+ gate: (payload) => kit.guardian.guardianGate.executeTool('security_gate', { payload }, ctx),
225
+ status: () => kit.guardian.stateGuardian.getMetrics(),
226
+ };
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Federation: Antigravity + Other Systems
232
+
233
+ Connect Antigravity to other kit instances (databases, CI/CD, etc.):
234
+
235
+ ```
236
+ Antigravity (VS Code)
237
+ │ federation_connect("http://db-kit:4200")
238
+
239
+ ├── pg_schema → Explore database structure
240
+ ├── cognitive_reason → Analyze schema relationships
241
+ └── knowledge_evolve → Identify knowledge gaps
242
+ ```
243
+
244
+ ```json
245
+ {
246
+ "servers": {
247
+ "cognitive-kit": {
248
+ "type": "stdio",
249
+ "command": "npx",
250
+ "args": ["cognitive-kit"],
251
+ "env": {
252
+ "KIT_FEDERATION_PEERS": "http://localhost:4200"
253
+ }
254
+ }
255
+ }
256
+ }
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Tool Reference by Antigravity Workflow
262
+
263
+ ### W-201 Deep Research
264
+ ```
265
+ cognitive_research(topic, depth: "deep", perspectives: "architect,guardian,executor,strategic")
266
+ knowledge_evolve(knowledgeBase: "<findings>", mode: "gap")
267
+ context_synth(sources: "<findings>", mode: "summarize")
268
+ ```
269
+
270
+ ### W-202 Chain Actions
271
+ ```
272
+ agency_execute(objective, mode: "sequential")
273
+ execution_flow(process, granularity: "fine")
274
+ subagent_protocol(task, mode: "supervised")
275
+ ```
276
+
277
+ ### W-203 Semantic Embeddings
278
+ ```
279
+ memory_vam(action: "search", query, namespace: "knowledge")
280
+ knowledge_evolve(knowledgeBase: "<results>", mode: "connect")
281
+ ```
282
+
283
+ ### W-204 Context Orchestration
284
+ ```
285
+ context_synth(sources: "<contexts>", mode: "merge")
286
+ memory_vam(action: "store", content: "<synthesized>", namespace: "context")
287
+ ```
288
+
289
+ ### W-205 Criteria Enforcement
290
+ ```
291
+ ethics_audit(subject: "<decision>")
292
+ consensus_engine(proposal: "<decision>", model: "weighted")
293
+ integrity_ledger(action: "create", payload: "<decision>")
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Example: Antigravity + cognitive-kit Session
299
+
300
+ ```
301
+ User: "Design and implement a secure file upload service"
302
+
303
+ Antigravity:
304
+ [C] Command → agency_execute(objective: "Design file upload service", mode: "adaptive")
305
+ ← Returns: 6-phase plan [delimit, research, architect, security, validate, execute]
306
+
307
+ [I] Intelligence → cognitive_research(topic: "secure file upload patterns 2026", depth: "deep")
308
+ ← Returns: multi-perspective analysis
309
+
310
+ [C] Control → execution_flow(process: "Implement upload endpoint", granularity: "fine")
311
+ ← Returns: 8-step execution plan with dependencies
312
+
313
+ [S] Surveillance → security_gate(payload: "<implementation code>")
314
+ ← Returns: PASSED (no violations)
315
+
316
+ [S] Sovereignty → integrity_ledger(action: "create", payload: "Upload service v1 deployed")
317
+ ← Returns: signed ledger entry with seal
318
+
319
+ → Emits: Sovereign Audit Trace with completion status
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Requirements
325
+
326
+ - Node.js ≥ 20
327
+ - VS Code (or any MCP-compatible editor)
328
+ - `npx cognitive-kit` (auto-installs on first run)
329
+ - `.vscode/mcp.json` configured (see Quick Start)
330
+
331
+ ## Troubleshooting
332
+
333
+ | Symptom | Fix |
334
+ |---------|-----|
335
+ | "Tool not found" | Ensure cognitive-kit is running (`npx cognitive-kit`) |
336
+ | Connection refused | Restart VS Code after adding `mcp.json` |
337
+ | Firewall blocked | Check `guardian_status` for blocked operations |
338
+ | Federation timeout | Verify peer URL and port are correct |
339
+
340
+ ---
341
+
342
+ ## Related
343
+
344
+ - [VS Code Integration Guide](./vscode-integration.md)
345
+ - [Cursor Integration Guide](./cursor-integration.md)
346
+ - [Claude Desktop Integration Guide](./claude-desktop-integration.md)
347
+ - [Federation Multi-Kit Example](../examples/federation.md)
348
+ - [Cognitive Kit README](../../README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cognitive-kit",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "Pluggable cognitive layer — port of GCS v15.3 as an embeddable MCP cognitive kit. Provides reasoning, research, planning, creativity, reflection, security, knowledge, analysis, agency orchestration, and adaptive pipelines via MCP protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,12 +19,13 @@
19
19
  }
20
20
  },
21
21
  "bin": {
22
- "cognitive-kit": "./dist/cli.js"
22
+ "cognitive-kit": "./cli.mjs"
23
23
  },
24
24
  "files": [
25
25
  "dist",
26
26
  "types",
27
27
  "docs",
28
+ "cli.mjs",
28
29
  "mcp.json",
29
30
  "README.md",
30
31
  "LICENSE"
@@ -44,13 +45,12 @@
44
45
  },
45
46
  "repository": {
46
47
  "type": "git",
47
- "url": "https://github.com/GaboBase/TODO-Cognitive.git",
48
- "directory": "packages/cognitive-kit"
48
+ "url": "https://github.com/GaboBase/cognitive-kit.git"
49
49
  },
50
50
  "bugs": {
51
- "url": "https://github.com/GaboBase/TODO-Cognitive/issues"
51
+ "url": "https://github.com/GaboBase/cognitive-kit/issues"
52
52
  },
53
- "homepage": "https://github.com/GaboBase/TODO-Cognitive/tree/main/packages/cognitive-kit",
53
+ "homepage": "https://github.com/GaboBase/cognitive-kit",
54
54
  "keywords": [
55
55
  "mcp",
56
56
  "model-context-protocol",
@@ -77,8 +77,12 @@
77
77
  "dependencies": {
78
78
  "sql.js": "^1.11.0"
79
79
  },
80
+ "optionalDependencies": {
81
+ "pg": "^8.14.0"
82
+ },
80
83
  "devDependencies": {
81
84
  "@types/node": "^24.0.0",
85
+ "@types/pg": "^8.20.0",
82
86
  "typescript": "^5.8.2"
83
87
  }
84
88
  }