specmem-hardwicksoftware 3.7.35 → 3.7.36

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +11 -15
  3. package/bin/specmem-console.cjs +839 -51
  4. package/claude-hooks/agent-chooser-hook.js +6 -6
  5. package/claude-hooks/agent-loading-hook.cjs +16 -16
  6. package/claude-hooks/agent-loading-hook.js +18 -18
  7. package/claude-hooks/agent-type-matcher.js +1 -1
  8. package/claude-hooks/background-completion-silencer.js +1 -1
  9. package/claude-hooks/file-claim-enforcer.cjs +37 -36
  10. package/claude-hooks/output-cleaner.cjs +1 -1
  11. package/claude-hooks/settings.json +27 -3
  12. package/claude-hooks/specmem-search-enforcer.cjs +2 -11
  13. package/claude-hooks/specmem-team-member-inject.js +1 -1
  14. package/claude-hooks/specmem-unified-hook.py +1 -1
  15. package/claude-hooks/subagent-loading-hook.cjs +1 -1
  16. package/claude-hooks/task-progress-hook.cjs +7 -7
  17. package/claude-hooks/task-progress-hook.js +3 -3
  18. package/claude-hooks/team-comms-enforcer.cjs +49 -47
  19. package/dist/claude-sessions/sessionParser.js +5 -0
  20. package/dist/codebase/codebaseIndexer.js +48 -17
  21. package/dist/codebase/exclusions.js +3 -4
  22. package/dist/codebase/index.js +4 -0
  23. package/dist/codebase/pdfExtractor.js +298 -0
  24. package/dist/dashboard/api/taskTeamMembers.js +2 -2
  25. package/dist/db/bigBrainMigrations.js +29 -0
  26. package/dist/hooks/hookManager.js +4 -4
  27. package/dist/hooks/teamFramingCli.js +1 -1
  28. package/dist/hooks/teamMemberPrepromptHook.js +5 -5
  29. package/dist/init/claudeConfigInjector.js +2 -2
  30. package/dist/mcp/compactionProxy.js +834 -186
  31. package/dist/mcp/compactionProxyDaemon.js +112 -37
  32. package/dist/mcp/contextVault.js +439 -0
  33. package/dist/mcp/embeddingServerManager.js +61 -1
  34. package/dist/mcp/mcpProtocolHandler.js +6 -1
  35. package/dist/mcp/miniCOTServerManager.js +82 -8
  36. package/dist/mcp/specMemServer.js +45 -10
  37. package/dist/mcp/toolRegistry.js +6 -0
  38. package/dist/startup/startupIndexing.js +14 -0
  39. package/dist/team-members/taskOrchestrator.js +3 -3
  40. package/dist/team-members/taskTeamMemberLogger.js +2 -2
  41. package/dist/tools/goofy/deployTeamMember.js +3 -3
  42. package/dist/tools/goofy/digInTheVault.js +81 -0
  43. package/dist/tools/goofy/stashTheGoods.js +56 -0
  44. package/dist/tools/teamMemberDeployer.js +2 -2
  45. package/dist/watcher/changeHandler.js +65 -8
  46. package/dist/watcher/changeQueue.js +20 -1
  47. package/embedding-sandbox/mini-cot-service.py +11 -13
  48. package/embedding-sandbox/pdf-text-extract.py +208 -0
  49. package/package.json +1 -1
  50. package/scripts/deploy-hooks.cjs +2 -2
  51. package/scripts/global-postinstall.cjs +2 -2
  52. package/scripts/specmem-init.cjs +130 -36
  53. package/specmem/model-config.json +6 -6
  54. package/specmem/supervisord.conf +1 -1
  55. package/svg-sections/readme-token-compaction.svg +246 -0
@@ -4388,6 +4388,35 @@ export class BigBrainMigrations {
4388
4388
  -- no-op: we only ADD COLUMN IF NOT EXISTS, nothing to reverse
4389
4389
  `,
4390
4390
  checksum: this.generateChecksum('reconcile_code_definitions_columns_v37')
4391
+ },
4392
+ // migration 38: context vault — token-saving stash for thicc tool outputs
4393
+ // chunks large content, indexes with tsvector for BM25 search,
4394
+ // auto-expires after 24h. inspired by claude-context-mode but on postgres.
4395
+ {
4396
+ version: 38,
4397
+ name: 'context_vault_table',
4398
+ up: `
4399
+ CREATE TABLE IF NOT EXISTS context_vault (
4400
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
4401
+ vault_id VARCHAR(16) NOT NULL,
4402
+ chunk_idx INTEGER NOT NULL DEFAULT 0,
4403
+ content TEXT NOT NULL,
4404
+ content_tsv TSVECTOR GENERATED ALWAYS AS (to_tsvector('english', content)) STORED,
4405
+ source_tool VARCHAR(128),
4406
+ source_size INTEGER DEFAULT 0,
4407
+ metadata JSONB DEFAULT '{}',
4408
+ project_path VARCHAR(500) DEFAULT '/',
4409
+ stashed_at TIMESTAMPTZ DEFAULT NOW(),
4410
+ expires_at TIMESTAMPTZ DEFAULT (NOW() + INTERVAL '24 hours'),
4411
+ UNIQUE(vault_id, chunk_idx)
4412
+ );
4413
+ CREATE INDEX IF NOT EXISTS idx_ctx_vault_tsv ON context_vault USING GIN(content_tsv);
4414
+ CREATE INDEX IF NOT EXISTS idx_ctx_vault_id ON context_vault(vault_id);
4415
+ CREATE INDEX IF NOT EXISTS idx_ctx_vault_expires ON context_vault(expires_at);
4416
+ CREATE INDEX IF NOT EXISTS idx_ctx_vault_project ON context_vault(project_path);
4417
+ `,
4418
+ down: `DROP TABLE IF EXISTS context_vault;`,
4419
+ checksum: this.generateChecksum('context_vault_table_v38')
4391
4420
  }
4392
4421
  ];
4393
4422
  }
@@ -486,7 +486,7 @@ export class HookManager {
486
486
  };
487
487
  }
488
488
  /**
489
- * Create the team framing hook for Task tool interception
489
+ * Create the team framing hook for Agent tool interception
490
490
  * This hook injects "dev team" framing into spawned team members
491
491
  */
492
492
  createTeamFramingHook() {
@@ -495,7 +495,7 @@ export class HookManager {
495
495
  /**
496
496
  * Team Framing Hook for SpecMem
497
497
  *
498
- * PreToolUse hook that intercepts Task tool calls and injects
498
+ * PreToolUse hook that intercepts Agent tool calls and injects
499
499
  * a "dev team" framing prompt to spawned team members.
500
500
  *
501
501
  * The framing creates a psychological context where:
@@ -518,7 +518,7 @@ const DEFAULT_CONFIG = {
518
518
  enabled: true,
519
519
  channelName: 'dev-coordination',
520
520
  customPreprompt: '',
521
- triggerTools: ['Task', 'task', 'spawn_agent', 'deploy_agent'],
521
+ triggerTools: ['Agent', 'agent', 'spawn_agent', 'deploy_agent'],
522
522
  includeMcpToolInstructions: true,
523
523
  seniorEngineerName: 'the senior engineer',
524
524
  teamName: 'the development team'
@@ -635,7 +635,7 @@ main().catch(() => process.exit(0));
635
635
  type: 'PreToolUse',
636
636
  enabled: true,
637
637
  file: hookPath,
638
- description: 'Injects dev team framing into Task tool calls for team member spawning'
638
+ description: 'Injects dev team framing into Agent tool calls for team member spawning'
639
639
  });
640
640
  logger.info({ path: hookPath }, 'Created team framing hook');
641
641
  return hookPath;
@@ -167,7 +167,7 @@ ${'-'.repeat(60)}
167
167
  async function runTest() {
168
168
  console.log('Running test with sample Task tool input...\n');
169
169
  const testInput = {
170
- tool_name: 'Task',
170
+ tool_name: 'Agent',
171
171
  tool_input: {
172
172
  prompt: 'Implement the user authentication feature',
173
173
  description: 'Create login and registration flows'
@@ -2,7 +2,7 @@
2
2
  * SPECMEM TEAM_MEMBER PREPROMPT HOOK
3
3
  * ===================================
4
4
  *
5
- * Pre-tool hook that intercepts Task tool calls and injects a "dev team"
5
+ * Pre-tool hook that intercepts Agent tool calls and injects a "dev team"
6
6
  * framing prompt to all spawned team members (teamMembers).
7
7
  *
8
8
  * The framing creates a psychological context where:
@@ -11,10 +11,10 @@
11
11
  * - Team communication tools encourage coordination
12
12
  * - The artificial nature of the team is not revealed
13
13
  *
14
- * Hook Type: PreToolUse (intercepts Task tool calls before execution)
14
+ * Hook Type: PreToolUse (intercepts Agent tool calls before execution)
15
15
  *
16
16
  * Flow:
17
- * 1. calls Task tool to spawn a team member
17
+ * 1. calls Agent tool to spawn a team member
18
18
  * 2. This hook intercepts the call
19
19
  * 3. The prompt is modified to include team framing
20
20
  * 4. TeamMember spawns with team context + original task
@@ -36,7 +36,7 @@ export const DEFAULT_TEAM_CONFIG = {
36
36
  channelName: 'dev-coordination',
37
37
  customPreprompt: '',
38
38
  additionalContext: '',
39
- triggerTools: ['Task', 'task', 'spawn_agent', 'deploy_agent'],
39
+ triggerTools: ['Agent', 'agent', 'spawn_agent', 'deploy_agent'],
40
40
  includeMcpToolInstructions: true,
41
41
  seniorEngineerName: 'the senior engineer',
42
42
  teamName: 'the development team'
@@ -152,7 +152,7 @@ function extractTaskDescription(toolInput) {
152
152
  return null;
153
153
  }
154
154
  /**
155
- * Main hook function - intercepts Task tool calls and injects team framing
155
+ * Main hook function - intercepts Agent tool calls and injects team framing
156
156
  *
157
157
  * @param toolName - Name of the tool being called
158
158
  * @param toolInput - Tool arguments/input
@@ -727,7 +727,7 @@ function getRequiredHooks() {
727
727
  PreToolUse: [
728
728
  // CRITICAL: Agent loading hook for Task tool - injects SpecMem context & auto-backgrounds
729
729
  ...(fs.existsSync(HOOKS.agentLoading) ? [{
730
- matcher: 'Task',
730
+ matcher: 'Agent',
731
731
  hooks: [{
732
732
  type: 'command',
733
733
  command: `node ${HOOKS.agentLoading}`,
@@ -802,7 +802,7 @@ function getRequiredHooks() {
802
802
  // =========================================================================
803
803
  PostToolUse: [
804
804
  ...(fs.existsSync(HOOKS.taskProgress) ? [{
805
- matcher: 'Task',
805
+ matcher: 'Agent',
806
806
  hooks: [{
807
807
  type: 'command',
808
808
  command: `node ${HOOKS.taskProgress}`,