kenaz 0.3.9 → 0.3.11
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/core/.claude/commands/Ansuz.md +12 -16
- package/core/.claude/hooks/memory-guard.js +13 -0
- package/core/.claude/skills/code_reviewer/SKILL.md +0 -1
- package/core/.claude/skills/code_reviewer/patterns.yaml +0 -8
- package/core/.claude/skills/dev_agent/SKILL.md +3 -6
- package/core/.claude/skills/heimdall/SKILL.md +5 -6
- package/core/.claude/skills/huginn/SKILL.md +11 -38
- package/core/.collaboration/core/task-api.js +2 -218
- package/core/.collaboration/core/task-api.test.js +1 -138
- package/core/.formation/bifrost/launch.js +2 -2
- package/core/.formation/bifrost/launch.test.js +2 -2
- package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
- package/core/.formation/bifrost/shared/codex-injection.js +3 -17
- package/core/.formation/bifrost/shared/consolidate.js +1 -51
- package/core/.formation/bifrost/sync.js +4 -5
- package/core/.formation/tools/__tests__/subagent-bifrost-guard.test.js +1 -1
- package/core/.formation/tools/dispatch.js +2 -2
- package/core/.formation/tools/kenaz-stats.js +259 -0
- package/core/.formation/tools/kenaz-stats.test.js +180 -0
- package/core/.formation/tools/mcp-allowlist.test.js +5 -3
- package/core/.formation/tools/post-complete/bounded-http.js +1 -40
- package/core/.formation/tools/post-complete/bounded-http.test.js +2 -89
- package/core/.formation/tools/post-complete/cognitive.js +2 -119
- package/core/.formation/tools/post-complete/testing.js +3 -21
- package/core/.formation/tools/post-complete.js +2 -428
- package/core/.formation/tools/post-complete.test.js +0 -135
- package/core/.formation/tools/prompt.js +14 -0
- package/core/.formation/tools/route-audit.test.js +8 -20
- package/core/.rule/INDEX.yaml +3 -3
- package/core/.rule/general/ddx-synapse-stack.yaml +11 -11
- package/core/.rule/general/specialist-identity-contract.yaml +5 -5
- package/core/.rule/general/synapse-code-intelligence.yaml +25 -111
- package/core/.rule/general/worktree-isolation.yaml +2 -2
- package/core/.rule/pipeline/task-execution.yaml +6 -9
- package/core/.specialist/Amelia/README.md +5 -5
- package/core/.specialist/Amelia/capability.yaml +10 -18
- package/core/.specialist/Amelia/knowledge.yaml +15 -66
- package/core/.specialist/Amelia/workflow.yaml +12 -21
- package/core/.specialist/Ansuz/RULES.md +6 -0
- package/core/.specialist/Ansuz/capability.yaml +12 -87
- package/core/.specialist/Ansuz/concepts/autonomous_agenda.yaml +1 -1
- package/core/.specialist/Ansuz/concepts/autonomy_contract.yaml +2 -3
- package/core/.specialist/Ansuz/concepts/capability_pointers.yaml +1 -3
- package/core/.specialist/Ansuz/concepts/cognitive_fluency_contract.yaml +8 -21
- package/core/.specialist/Ansuz/concepts/cognitive_systems_overview.yaml +0 -4
- package/core/.specialist/Ansuz/concepts/cognitive_systems_turn_context.yaml +1 -1
- package/core/.specialist/Ansuz/concepts/completion_tracking.yaml +0 -1
- package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +0 -3
- package/core/.specialist/Ansuz/concepts/evolvable_guardrails.yaml +3 -3
- package/core/.specialist/Ansuz/concepts/fatigue_handoff.yaml +1 -7
- package/core/.specialist/Ansuz/concepts/guardrails_immutable.yaml +3 -4
- package/core/.specialist/Ansuz/concepts/identity.yaml +1 -2
- package/core/.specialist/Ansuz/concepts/phase9_verification.yaml +0 -1
- package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +3 -4
- package/core/.specialist/Ansuz/core.yaml +3 -6
- package/core/.specialist/Ansuz/elixir.yaml +6 -6
- package/core/.specialist/Ansuz/exo_cortex_tools.yaml +5 -9
- package/core/.specialist/Ansuz/guards/blind_spot_guards.yaml +2 -2
- package/core/.specialist/Ansuz/guards/lesson_guards.yaml +6 -19
- package/core/.specialist/Ansuz/identity_contract.yaml +4 -4
- package/core/.specialist/Ansuz/knowledge.yaml +13 -40
- package/core/.specialist/Ansuz/modules/ddx.yaml +2 -2
- package/core/.specialist/Ansuz/modules/prophecy.yaml +19 -19
- package/core/.specialist/Ansuz/modules/pulse_empty.yaml +6 -17
- package/core/.specialist/Ansuz/tools/ansuz-handoff-snapshot.js +3 -102
- package/core/.specialist/Ansuz/tools/ansuz-sdk-runner.js +2 -44
- package/core/.specialist/Ansuz/workflow.yaml +32 -76
- package/core/.specialist/Forseti/core.yaml +2 -7
- package/core/.specialist/Forseti/rule.yaml +1 -1
- package/core/.specialist/Heimdall/SKILL.md +2 -3
- package/core/.specialist/Heimdall/capability.yaml +22 -45
- package/core/.specialist/Heimdall/core.yaml +24 -126
- package/core/.specialist/Heimdall/principles.yaml +8 -11
- package/core/.specialist/Heimdall/rule.yaml +2 -2
- package/core/.specialist/Huginn/capability.yaml +31 -52
- package/core/.specialist/Huginn/core.yaml +43 -123
- package/core/.specialist/Huginn/principles.yaml +5 -5
- package/core/.specialist/Huginn/rule.yaml +3 -9
- package/core/.specialist/REFLECTION_TO_CONTROL.md +3 -4
- package/core/.specialist/shared/guard_schema.json +1 -1
- package/core/.specialist/shared/principles.yaml +6 -6
- package/core/.specialist/tools/__tests__/task-2409-lessons.test.js +95 -0
- package/core/.specialist/tools/ansuz-boot-fast.js +1 -0
- package/core/.specialist/tools/lessons.js +234 -0
- package/core/.specialist/tools/phase-gate.js +10 -230
- package/core/.specialist/tools/phase-gate.test.js +2 -2
- package/core/.specialist/tools/prompt-files.test.js +1 -1
- package/core/.specialist/tools/session.js +2 -89
- package/core/.system/memory/README.md +3 -0
- package/core/CLAUDE.md +6 -7
- package/core/KENAZ_CORE_VERSION +1 -1
- package/core/dev/plans/CLI_FIRST_INSTALL_FLOW.md +26 -0
- package/core/plugins/kenaz/INVENTORY.md +1 -1
- package/core/plugins/kenaz/commands/Ansuz.md +12 -16
- package/core/plugins/kenaz/scripts/kenaz.test.js +2 -1
- package/core/plugins/kenaz/scripts/ygg.js +2 -0
- package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +0 -1
- package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +0 -8
- package/core/plugins/kenaz/skills/dev_agent/SKILL.md +3 -6
- package/lib/cli.js +13 -3
- package/package.json +6 -6
- package/core/.claude/hooks/handoff-snapshot-on-decision.js +0 -188
- package/core/.claude/skills/synapse_maintain/SKILL.md +0 -84
- package/core/.formation/tools/alaya-gate.js +0 -198
- package/core/.formation/tools/post-complete/health.js +0 -464
- package/core/.formation/tools/post-complete/task2038.test.js +0 -246
- package/core/.formation/tools/post-complete/task2341.test.js +0 -74
- package/core/.rule/general/cortex-tools.yaml +0 -181
- package/core/.rule/general/memory-language.yaml +0 -67
- package/core/.rule/general/memory-source-priority.yaml +0 -207
- package/core/.rule/general/synapse-cognitive-fusion.yaml +0 -301
- package/core/.specialist/Ansuz/concepts/cognitive_systems_hippocampus.yaml +0 -14
- package/core/.specialist/Ansuz/concepts/write_verification.yaml +0 -26
- package/core/.specialist/Ansuz/modules/recall.yaml +0 -45
- package/core/.specialist/tools/MEMORY_RECALL_TRIGGERS.md +0 -156
- package/core/.specialist/tools/context-injection.js +0 -395
- package/core/dev/scripts/probe/hippocampus-concurrency.js +0 -247
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* COGNITIVE — extracted from post-complete.js (D.4 refactor)
|
|
3
3
|
*
|
|
4
|
-
* Cognitive checkpoint detection
|
|
5
|
-
*
|
|
6
|
-
* and cognitive competence map.
|
|
4
|
+
* Cognitive checkpoint detection and thinking tags. (Passive rune extraction and the
|
|
5
|
+
* Hippocampus MCP sync were removed with the memory system in TASK_2411.)
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
const path = require('path');
|
|
10
9
|
const fs = require('fs');
|
|
11
|
-
const { execSync, spawnSync } = require('child_process');
|
|
12
10
|
const { ROOT, COLLABORATION_API, LOG_DIR, getLogDir } = require('../utils');
|
|
13
11
|
// TASK_2275: kenaz-core ships without node_modules; fall back to the vendored copy.
|
|
14
12
|
const yaml = (() => { try { return require('js-yaml'); } catch { return require('../../../.vendor/js-yaml.cjs'); } })();
|
|
@@ -147,124 +145,9 @@ function collectThinkingTags(taskId, projectRoot) {
|
|
|
147
145
|
return { tags: ordered.slice(0, 3), truncated, totalRaw };
|
|
148
146
|
}
|
|
149
147
|
|
|
150
|
-
/**
|
|
151
|
-
* Passive Rune Extraction: mine knowledge from git commit messages.
|
|
152
|
-
* Background bounded batch: callers may await its result; no retries.
|
|
153
|
-
* Called after a successful commit (gitResult.committed === true).
|
|
154
|
-
*
|
|
155
|
-
* Behavior:
|
|
156
|
-
* 1. Parse commit type from message prefix (fix/feat/refactor)
|
|
157
|
-
* 2. Get changed file list via git diff HEAD~1 HEAD
|
|
158
|
-
* 3. Call synapse_inscribe for each file (max 20) via MCP HTTP
|
|
159
|
-
*
|
|
160
|
-
* @param {string} commitMsg - full commit message
|
|
161
|
-
* @param {string} projectRoot - absolute path to git repo root
|
|
162
|
-
* @param {string|null} projectPath - passed through to synapse_inscribe
|
|
163
|
-
*/
|
|
164
|
-
function triggerPassiveRuneExtraction(commitMsg, projectRoot, projectPath) {
|
|
165
|
-
// 1. Parse commit type
|
|
166
|
-
const typeMatch = commitMsg.match(/^(fix!?|feat!?|refactor)/i);
|
|
167
|
-
let runeType, contentPrefix;
|
|
168
|
-
if (typeMatch) {
|
|
169
|
-
const t = typeMatch[1].toLowerCase();
|
|
170
|
-
if (t.startsWith('fix')) {
|
|
171
|
-
runeType = 'risk';
|
|
172
|
-
contentPrefix = 'Fixed';
|
|
173
|
-
} else if (t.startsWith('feat')) {
|
|
174
|
-
runeType = 'summary';
|
|
175
|
-
contentPrefix = 'Added';
|
|
176
|
-
} else {
|
|
177
|
-
runeType = 'decision';
|
|
178
|
-
contentPrefix = 'Refactored';
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
runeType = 'summary';
|
|
182
|
-
contentPrefix = 'Added';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// 2. Get changed files (post-commit diff)
|
|
186
|
-
const changedFiles = getPostCompleteChangedFiles(projectRoot, null).slice(0, 20);
|
|
187
|
-
|
|
188
|
-
if (changedFiles.length === 0) return;
|
|
189
|
-
|
|
190
|
-
// One bounded batch; completion counts are acknowledgements, never requests fired.
|
|
191
|
-
const { inscribeBatch } = require('./bounded-http');
|
|
192
|
-
const runeContent = `${contentPrefix}: ${stripCJK(commitMsg)}`;
|
|
193
|
-
const items = changedFiles.map(filePath => ({
|
|
194
|
-
symbol_id: filePath, type: runeType, content: runeContent, confidence: 0.65,
|
|
195
|
-
// TASK_2025: synapse_inscribe is a write tool -- must not omit projectPath
|
|
196
|
-
// (mcp.rs resolve_project_for_write no longer falls back to the
|
|
197
|
-
// Dashboard's currently-selected project). Fall back to ROOT (this
|
|
198
|
-
// script's own core project) rather than dropping the param.
|
|
199
|
-
projectPath: projectPath || ROOT,
|
|
200
|
-
}));
|
|
201
|
-
return inscribeBatch(items).then(counts => {
|
|
202
|
-
console.log(` [Rune extraction] successful=${counts.successful}, spooled=${counts.spooled}, failed=${counts.failed}, skipped=${counts.skipped} (${runeType}${counts.reason ? '; ' + counts.reason : ''}; failed writes are unconfirmed)`);
|
|
203
|
-
return counts;
|
|
204
|
-
}).catch(() => {
|
|
205
|
-
console.warn(' [Rune extraction] batch failed; completion not confirmed');
|
|
206
|
-
return null;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// TASK_2341: Cognitive Attribution (POST /api/synapse/link-cognitive -> COGNITIVE_APPLIES_TO graph
|
|
211
|
-
// edges) was removed with the Kuzu graph; the route no longer exists.
|
|
212
|
-
|
|
213
|
-
// ─────────────────────────────────────────
|
|
214
|
-
// Hippocampus Episode Integration
|
|
215
|
-
// ─────────────────────────────────────────
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Call a hippocampus MCP tool synchronously via the Dashboard HTTP endpoint.
|
|
219
|
-
* Uses the same spawnSync pattern as measureHealthScoreSync.
|
|
220
|
-
* Returns parsed JSON result, or null if the dashboard is not running / timed out.
|
|
221
|
-
* @param {string} toolName - e.g. 'hippocampus_episode_start' | 'hippocampus_episode_close'
|
|
222
|
-
* @param {object} toolArgs - arguments forwarded to the tool
|
|
223
|
-
* @returns {object|null}
|
|
224
|
-
*/
|
|
225
|
-
function callHippocampusMcpSync(toolName, toolArgs) {
|
|
226
|
-
const script = [
|
|
227
|
-
"const http = require('http');",
|
|
228
|
-
`const payload = JSON.stringify({ jsonrpc: '2.0', id: 'hipp-sync-' + Date.now(), method: 'tools/call',`,
|
|
229
|
-
` params: { name: ${JSON.stringify(toolName)}, arguments: ${JSON.stringify(toolArgs)} } });`,
|
|
230
|
-
"const req = http.request({ hostname: '127.0.0.1', port: 18080, path: '/api/mcp',",
|
|
231
|
-
" method: 'POST',",
|
|
232
|
-
" headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) },",
|
|
233
|
-
" timeout: 8000 }, (res) => {",
|
|
234
|
-
" let b = '';",
|
|
235
|
-
" res.on('data', c => b += c);",
|
|
236
|
-
" res.on('end', () => {",
|
|
237
|
-
" try {",
|
|
238
|
-
" const r = JSON.parse(b);",
|
|
239
|
-
" const t = r && r.result && r.result.content && r.result.content[0] && r.result.content[0].text;",
|
|
240
|
-
" if (t) { process.stdout.write(t); }",
|
|
241
|
-
" } catch(e) { process.stderr.write(e.message); }",
|
|
242
|
-
" });",
|
|
243
|
-
"});",
|
|
244
|
-
"req.on('error', () => {});",
|
|
245
|
-
"req.on('timeout', () => req.destroy());",
|
|
246
|
-
"req.write(payload);",
|
|
247
|
-
"req.end();",
|
|
248
|
-
].join('\n');
|
|
249
|
-
|
|
250
|
-
try {
|
|
251
|
-
const res = spawnSync(process.execPath, ['-e', script], {
|
|
252
|
-
encoding: 'utf8',
|
|
253
|
-
timeout: 12000,
|
|
254
|
-
windowsHide: true,
|
|
255
|
-
});
|
|
256
|
-
if (res.stdout && res.stdout.trim()) {
|
|
257
|
-
try { return JSON.parse(res.stdout.trim()); } catch { return { raw: res.stdout.trim() }; }
|
|
258
|
-
}
|
|
259
|
-
} catch { /* dashboard not running or timeout — graceful degradation */ }
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
148
|
module.exports = {
|
|
264
149
|
initCognitive,
|
|
265
150
|
parseCognitiveCheckpoint,
|
|
266
151
|
detectCognitiveCheckpoint,
|
|
267
152
|
collectThinkingTags,
|
|
268
|
-
triggerPassiveRuneExtraction,
|
|
269
|
-
callHippocampusMcpSync,
|
|
270
153
|
};
|
|
@@ -178,19 +178,7 @@ function detectAllTestCommands(projectRoot, scopePaths = []) {
|
|
|
178
178
|
const normScopes = (scopePaths || []).map(p => p.replace(/\\/g, '/'));
|
|
179
179
|
const scopeTouches = (prefix) => normScopes.some(s => s === prefix || s.startsWith(prefix + '/') || prefix.startsWith(s + '/'));
|
|
180
180
|
|
|
181
|
-
// 1.
|
|
182
|
-
const dashPkg = path.join(projectRoot, 'dashboard', 'package.json');
|
|
183
|
-
if (fs.existsSync(dashPkg)) {
|
|
184
|
-
try {
|
|
185
|
-
const pkg = JSON.parse(fs.readFileSync(dashPkg, 'utf8'));
|
|
186
|
-
const testScript = pkg.scripts?.test;
|
|
187
|
-
if (testScript && !testScript.includes('echo "Error')) {
|
|
188
|
-
commands.push({ cmd: 'npm test -- --passWithNoTests', cwd: path.join(projectRoot, 'dashboard'), label: 'dashboard (npm test)' });
|
|
189
|
-
}
|
|
190
|
-
} catch { /* skip */ }
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// 2. Root package.json
|
|
181
|
+
// 1. Root package.json
|
|
194
182
|
const rootPkg = path.join(projectRoot, 'package.json');
|
|
195
183
|
if (fs.existsSync(rootPkg)) {
|
|
196
184
|
try {
|
|
@@ -202,7 +190,7 @@ function detectAllTestCommands(projectRoot, scopePaths = []) {
|
|
|
202
190
|
} catch { /* skip */ }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
|
-
//
|
|
193
|
+
// 2. Rust: dashboard/src-tauri/ (kenaz-server lib) — only when scope explicitly touches it.
|
|
206
194
|
// The cargo build pulls kuzu via cmake which is the dominant source of
|
|
207
195
|
// false-positive regression failures observed in this project (~every
|
|
208
196
|
// dispatch reported "src-tauri tests FAILED" with cmake exit 2). Empty
|
|
@@ -210,13 +198,7 @@ function detectAllTestCommands(projectRoot, scopePaths = []) {
|
|
|
210
198
|
// Agents that explicitly need Rust coverage can pass --test-cmd.
|
|
211
199
|
const tauriCargo = path.join(projectRoot, 'dashboard', 'src-tauri', 'Cargo.toml');
|
|
212
200
|
if (fs.existsSync(tauriCargo) && scopeTouches('dashboard/src-tauri')) {
|
|
213
|
-
commands.push({ cmd: 'cargo test --
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// 4. Rust: dashboard/pty-server/ — same selective rule
|
|
217
|
-
const ptyCargo = path.join(projectRoot, 'dashboard', 'pty-server', 'Cargo.toml');
|
|
218
|
-
if (fs.existsSync(ptyCargo) && scopeTouches('dashboard/pty-server')) {
|
|
219
|
-
commands.push({ cmd: 'cargo test', cwd: path.join(projectRoot, 'dashboard', 'pty-server'), label: 'pty-server (cargo test)' });
|
|
201
|
+
commands.push({ cmd: 'cargo test --lib', cwd: path.join(projectRoot, 'dashboard', 'src-tauri'), label: 'src-tauri (cargo test)' });
|
|
220
202
|
}
|
|
221
203
|
|
|
222
204
|
// 5. Python (pytest) — root level
|