@claude-flow/cli 3.68.0 → 3.70.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.
Files changed (64) hide show
  1. package/.claude/helpers/helpers.manifest.json +2 -2
  2. package/.claude/skills/agentdb-advanced/SKILL.md +1 -1
  3. package/.claude/skills/agentdb-learning/SKILL.md +1 -1
  4. package/.claude/skills/agentdb-memory-patterns/SKILL.md +1 -1
  5. package/.claude/skills/agentdb-optimization/SKILL.md +1 -1
  6. package/.claude/skills/agentdb-vector-search/SKILL.md +1 -1
  7. package/.claude/skills/hooks-automation/SKILL.md +1 -1
  8. package/.claude/skills/pair-programming/SKILL.md +1 -1
  9. package/.claude/skills/reasoningbank-agentdb/SKILL.md +1 -1
  10. package/.claude/skills/reasoningbank-intelligence/SKILL.md +1 -1
  11. package/.claude/skills/skill-builder/SKILL.md +1 -1
  12. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  13. package/.claude/skills/v3-cli-modernization/SKILL.md +1 -1
  14. package/.claude/skills/v3-core-implementation/SKILL.md +1 -1
  15. package/.claude/skills/v3-ddd-architecture/SKILL.md +1 -1
  16. package/.claude/skills/v3-integration-deep/SKILL.md +1 -1
  17. package/.claude/skills/v3-mcp-optimization/SKILL.md +1 -1
  18. package/.claude/skills/v3-memory-unification/SKILL.md +1 -1
  19. package/.claude/skills/v3-performance-optimization/SKILL.md +1 -1
  20. package/.claude/skills/v3-security-overhaul/SKILL.md +1 -1
  21. package/.claude/skills/v3-swarm-coordination/SKILL.md +1 -1
  22. package/.claude/skills/verification-quality/SKILL.md +1 -1
  23. package/catalog-manifest.json +3 -3
  24. package/dist/src/commands/context-plan.d.ts +4 -0
  25. package/dist/src/commands/context-plan.js +36 -0
  26. package/dist/src/commands/hooks.js +20 -4
  27. package/dist/src/commands/workflow.js +3 -1
  28. package/dist/src/index.d.ts +4 -0
  29. package/dist/src/index.js +3 -0
  30. package/dist/src/mcp-tools/agent-tools.js +31 -14
  31. package/dist/src/mcp-tools/agentdb-episode-tools.d.ts +16 -0
  32. package/dist/src/mcp-tools/agentdb-episode-tools.js +214 -0
  33. package/dist/src/mcp-tools/agentdb-tools.js +2 -0
  34. package/dist/src/mcp-tools/claims-tools.js +7 -3
  35. package/dist/src/mcp-tools/config-tools.js +48 -22
  36. package/dist/src/mcp-tools/coordination-tools.js +5 -2
  37. package/dist/src/mcp-tools/daa-tools.js +12 -5
  38. package/dist/src/mcp-tools/hooks-tools.js +46 -7
  39. package/dist/src/mcp-tools/session-tools.d.ts +10 -0
  40. package/dist/src/mcp-tools/session-tools.js +15 -2
  41. package/dist/src/mcp-tools/workflow-tools.js +9 -4
  42. package/dist/src/memory/episode-crud.d.ts +70 -0
  43. package/dist/src/memory/episode-crud.js +114 -0
  44. package/dist/src/memory/ewc-consolidation.d.ts +7 -0
  45. package/dist/src/memory/ewc-consolidation.js +19 -1
  46. package/dist/src/memory/memory-bridge.d.ts +5 -0
  47. package/dist/src/memory/memory-bridge.js +38 -3
  48. package/dist/src/mods/command-registry/schema.d.ts +6 -6
  49. package/dist/src/services/anthropic-context-adapter.d.ts +81 -0
  50. package/dist/src/services/anthropic-context-adapter.js +257 -0
  51. package/dist/src/services/context-delegation.d.ts +107 -0
  52. package/dist/src/services/context-delegation.js +193 -0
  53. package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
  54. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +1 -0
  55. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -1
  56. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +8 -0
  57. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -1
  58. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
  59. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -1
  60. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +9 -2
  61. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -1
  62. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
  63. package/package.json +5 -5
  64. package/.claude/memory.db +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.68.0",
3
+ "version": "3.70.0",
4
4
  "files": {
5
5
  "auto-memory-hook.mjs": "631fac9d518835e2852a406888316bbbddddb49e7ed8e406d2e971f46833df9a",
6
6
  "hook-handler.cjs": "0ce70981aa33f76d008b6f49626effaf4269918c4094f1a28c1ef6fceb097d6f",
@@ -10,6 +10,6 @@
10
10
  "learning-loop.cjs": "d046cd6f8efb7dd40e1d2451516c181fc8b26477aefb1124c0df5f52a23f9190"
11
11
  }
12
12
  },
13
- "signature": "hlbaMRRdeS+x8RDQSG0gdJuZhV7d1pJKr+ut6Gy3w4y72vxS2tbe/R1G+zs5WUtCfX5/bkzh/U9YBDqsMiovCA==",
13
+ "signature": "8Yx6pZ2AjAZmPJJECS9jV5m85+kNAuaiehV3sttqE4L37q7wG/PoPetmVeBVJ6QkNlj0dKUra5Dl//I/AW0kDA==",
14
14
  "algorithm": "ed25519"
15
15
  }
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "AgentDB Advanced Features"
2
+ name: agentdb-advanced
3
3
  description: "Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "AgentDB Learning Plugins"
2
+ name: agentdb-learning
3
3
  description: "Create and train AI learning plugins with AgentDB's 9 reinforcement learning algorithms. Includes Decision Transformer, Q-Learning, SARSA, Actor-Critic, and more. Use when building self-learning agents, implementing RL, or optimizing agent behavior through experience."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "AgentDB Memory Patterns"
2
+ name: agentdb-memory-patterns
3
3
  description: "Implement persistent memory patterns for AI agents using AgentDB. Includes session memory, long-term storage, pattern learning, and context management. Use when building stateful agents, chat systems, or intelligent assistants."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "AgentDB Performance Optimization"
2
+ name: agentdb-optimization
3
3
  description: "Optimize AgentDB performance with quantization (4-32x memory reduction), HNSW indexing (150x faster search), caching, and batch operations. Use when optimizing memory usage, improving search speed, or scaling to millions of vectors."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "AgentDB Vector Search"
2
+ name: agentdb-vector-search
3
3
  description: "Implement semantic vector search with AgentDB for intelligent document retrieval, similarity matching, and context-aware querying. Use when building RAG systems, semantic search engines, or intelligent knowledge bases."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: Hooks Automation
2
+ name: hooks-automation
3
3
  description: Automated coordination, formatting, and learning from Claude Code operations using intelligent hooks with MCP integration. Includes pre/post task hooks, session management, Git integration, memory coordination, and neural pattern training for enhanced development workflows.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: Pair Programming
2
+ name: pair-programming
3
3
  description: AI-assisted pair programming with multiple modes (driver/navigator/switch), real-time verification, quality monitoring, and comprehensive testing. Supports TDD, debugging, refactoring, and learning sessions. Features automatic role switching, continuous code review, security scanning, and performance optimization with truth-score verification.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "ReasoningBank with AgentDB"
2
+ name: reasoningbank-agentdb
3
3
  description: "Implement ReasoningBank adaptive learning with AgentDB's 150x faster vector database. Includes trajectory tracking, verdict judgment, memory distillation, and pattern recognition. Use when building self-learning agents, optimizing decision-making, or implementing experience replay systems."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "ReasoningBank Intelligence"
2
+ name: reasoningbank-intelligence
3
3
  description: "Implement adaptive learning with ReasoningBank for pattern recognition, strategy optimization, and continuous improvement. Use when building self-learning agents, optimizing workflows, or implementing meta-cognitive systems."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "Skill Builder"
2
+ name: skill-builder
3
3
  description: "Create new Claude Code Skills with proper YAML frontmatter, progressive disclosure structure, and complete directory organization. Use when you need to build custom skills for specific workflows, generate skill templates, or understand the Claude Skills specification."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "Swarm Orchestration"
2
+ name: swarm-orchestration
3
3
  description: "Orchestrate multi-agent swarms with agentic-flow for parallel task execution, dynamic topology, and intelligent coordination. Use when scaling beyond single agents, implementing complex workflows, or building distributed AI systems."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 CLI Modernization"
2
+ name: v3-cli-modernization
3
3
  description: "CLI modernization and hooks system enhancement for claude-flow v3. Implements interactive prompts, command decomposition, enhanced hooks integration, and intelligent workflow automation."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 Core Implementation"
2
+ name: v3-core-implementation
3
3
  description: "Core module implementation for claude-flow v3. Implements DDD domains, clean architecture patterns, dependency injection, and modular TypeScript codebase with comprehensive testing."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 DDD Architecture"
2
+ name: v3-ddd-architecture
3
3
  description: "Domain-Driven Design architecture for claude-flow v3. Implements modular, bounded context architecture with clean separation of concerns and microkernel pattern."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 Deep Integration"
2
+ name: v3-integration-deep
3
3
  description: "Deep agentic-flow@alpha integration implementing ADR-001. Eliminates 10,000+ duplicate lines by building claude-flow as specialized extension rather than parallel implementation."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 MCP Optimization"
2
+ name: v3-mcp-optimization
3
3
  description: "MCP server optimization and transport layer enhancement for claude-flow v3. Implements connection pooling, load balancing, tool registry optimization, and performance monitoring for sub-100ms response times."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 Memory Unification"
2
+ name: v3-memory-unification
3
3
  description: "Unify 6+ memory systems into AgentDB with HNSW indexing for 150x-12,500x search improvements. Implements ADR-006 (Unified Memory Service) and ADR-009 (Hybrid Memory Backend)."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 Performance Optimization"
2
+ name: v3-performance-optimization
3
3
  description: "Achieve aggressive v3 performance targets: 2.49x-7.47x Flash Attention speedup, 150x-12,500x search improvements, 50-75% memory reduction. Comprehensive benchmarking and optimization suite."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 Security Overhaul"
2
+ name: v3-security-overhaul
3
3
  description: "Complete security architecture overhaul for claude-flow v3. Addresses critical CVEs (CVE-1, CVE-2, CVE-3) and implements secure-by-default patterns. Use for security-first v3 implementation."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "V3 Swarm Coordination"
2
+ name: v3-swarm-coordination
3
3
  description: "15-agent hierarchical mesh coordination for v3 implementation. Orchestrates parallel execution across security, core, and integration domains following 10 ADRs with 14-week timeline."
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "Verification & Quality Assurance"
2
+ name: verification-quality
3
3
  description: |
4
4
  Check code quality and change risk with ruflo's shipped analysis commands (analyze diff, analyze complexity, analyze code), and run or extend ruflo's own CI regression guards. Use when assessing a change's risk, finding complexity hot spots, or adding a regression guard to ruflo. The truth-scoring and auto-rollback commands described later in this file are design notes, not shipped CLI commands.
5
5
  ---
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 7,
4
- "generatedAt": "2026-11-01T04:34:21.063Z",
5
- "gitSha": "2b1a3927",
4
+ "generatedAt": "2026-11-01T19:14:23.757Z",
5
+ "gitSha": "a3d45e64",
6
6
  "catalog": {
7
7
  "agents": 177,
8
- "tools": 446,
8
+ "tools": 450,
9
9
  "skills": 34
10
10
  },
11
11
  "benchmark": null
@@ -0,0 +1,4 @@
1
+ import type { Command } from '../types.js';
2
+ /** Metadata-only planning surface. Does not read files or launch a model. */
3
+ export declare const contextPlanCommand: Command;
4
+ //# sourceMappingURL=context-plan.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { planContextRead } from '../services/context-delegation.js';
2
+ /** Metadata-only planning surface. Does not read files or launch a model. */
3
+ export const contextPlanCommand = {
4
+ name: 'context-plan',
5
+ description: 'Plan bounded bulk-read delegation from metadata (no file reads or model calls)',
6
+ options: [
7
+ { name: 'bytes', type: 'number', required: true, description: 'Total source UTF-8 bytes' },
8
+ { name: 'files', type: 'number', default: 1, description: 'Source file count' },
9
+ { name: 'mode', type: 'string', default: 'legacy', choices: ['legacy', 'observe', 'enforce'], description: 'Routing mode' },
10
+ { name: 'intent', type: 'string', default: 'analysis', choices: ['analysis', 'edit', 'debug', 'architecture'], description: 'Read purpose' },
11
+ { name: 'worker-available', type: 'boolean', default: false, description: 'Host has a governed worker adapter' },
12
+ { name: 'offset', type: 'number', description: 'Targeted read offset' },
13
+ { name: 'limit', type: 'number', description: 'Targeted read limit' },
14
+ { name: 'depth', type: 'number', default: 0, description: 'Current delegation depth' },
15
+ ],
16
+ action: async (ctx) => {
17
+ try {
18
+ const f = ctx.flags;
19
+ const plan = planContextRead({
20
+ inputBytes: Number(f.bytes), fileCount: Number(f.files ?? 1),
21
+ mode: (f.mode ?? 'legacy'), intent: (f.intent ?? 'analysis'),
22
+ // The parser camelCases flag names; accept both spellings like the other hooks commands.
23
+ workerAvailable: f['worker-available'] === true || f.workerAvailable === true, depth: Number(f.depth ?? 0),
24
+ ...(f.offset === undefined ? {} : { offset: Number(f.offset) }),
25
+ ...(f.limit === undefined ? {} : { limit: Number(f.limit) }),
26
+ });
27
+ console.log(JSON.stringify(plan));
28
+ return { success: true, data: plan };
29
+ }
30
+ catch {
31
+ console.error('Invalid context planning metadata');
32
+ return { success: false, message: 'Invalid context planning metadata', exitCode: 1 };
33
+ }
34
+ },
35
+ };
36
+ //# sourceMappingURL=context-plan.js.map
@@ -8,6 +8,7 @@ import { output } from '../output.js';
8
8
  import { confirm } from '../prompt.js';
9
9
  import { callMCPTool, MCPClientError } from '../mcp-client.js';
10
10
  import { storeCommand } from './transfer-store.js';
11
+ import { contextPlanCommand } from './context-plan.js';
11
12
  import { readFileSync, statSync } from 'node:fs';
12
13
  import { getSecurityStatus as sharedGetSecurityStatus, getSwarmStatus as sharedGetSwarmStatus, getGitUncommittedCount as sharedGetGitUncommittedCount, } from '../funnel/local-signals.js';
13
14
  /**
@@ -3725,7 +3726,9 @@ const statuslineCommand = {
3725
3726
  const securityCompact = security.findings > 0
3726
3727
  ? `Findings:${security.findings}`
3727
3728
  : `Security:${security.status}`;
3728
- const line = `DDD:${progress.domainsCompleted}/${progress.totalDomains} ${securityCompact} Swarm:${swarm.activeAgents}/${swarm.maxAgents} Ctx:${system.contextPct}% Int:${system.intelligencePct}%`;
3729
+ // #1047: this tier is derived from memory pattern-count thresholds, not
3730
+ // Domain-Driven-Design domain completion — label it for what it is.
3731
+ const line = `Learning:${progress.domainsCompleted}/${progress.totalDomains} ${securityCompact} Swarm:${swarm.activeAgents}/${swarm.maxAgents} Ctx:${system.contextPct}% Int:${system.intelligencePct}%`;
3729
3732
  output.writeln(line);
3730
3733
  return { success: true, data: statusData };
3731
3734
  }
@@ -3895,7 +3898,10 @@ const statuslineCommand = {
3895
3898
  const patternsK = progress.patternsLearned >= 1000 ? `${(progress.patternsLearned / 1000).toFixed(1)}k` : String(progress.patternsLearned);
3896
3899
  perfIndicator = `${c.brightYellow}📚 ${patternsK} patterns${c.reset}`;
3897
3900
  }
3898
- const line1 = `${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
3901
+ // #1047: renamed from "DDD Domains" — this tier comes from memory
3902
+ // pattern-count thresholds (see getV3Progress above), not actual
3903
+ // Domain-Driven-Design domain completion. "Learning Tier" says what it is.
3904
+ const line1 = `${c.brightCyan}🏗️ Learning Tier${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
3899
3905
  `${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
3900
3906
  perfIndicator;
3901
3907
  const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
@@ -3909,10 +3915,19 @@ const statuslineCommand = {
3909
3915
  `${securityIcon} ${securityColor}${security.findings > 0 ? `Findings ${security.findings}` : `Security ${security.status}`}${c.reset} ` +
3910
3916
  `${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
3911
3917
  `${c.brightPurple}🧠 ${String(system.intelligencePct).padStart(3)}%${c.reset}`;
3912
- const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
3918
+ // #1047: "DDD ●XX%" previously showed a fake architecture-progress
3919
+ // percentage that was really just the memory pattern count run through
3920
+ // getV3Progress's bucket thresholds — it has no connection to actual DDD
3921
+ // domain completion. Show the real number it was derived from instead,
3922
+ // per the issue's own recommendation ("Memory entries: 290" instead of
3923
+ // "DDD ●80%").
3924
+ const memoryColor = progress.patternsLearned >= 50 ? c.brightGreen : progress.patternsLearned > 0 ? c.yellow : c.red;
3925
+ const patternsDisplay = progress.patternsLearned >= 1000
3926
+ ? `${(progress.patternsLearned / 1000).toFixed(1)}k`
3927
+ : String(progress.patternsLearned);
3913
3928
  const line3 = `${c.brightPurple}🔧 Architecture${c.reset} ` +
3914
3929
  `${c.cyan}ADRs${c.reset} ${c.dim}●0/0${c.reset} ${c.dim}│${c.reset} ` +
3915
- `${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
3930
+ `${c.cyan}Memory${c.reset} ${memoryColor}●${patternsDisplay}${c.reset} ${c.dim}│${c.reset} ` +
3916
3931
  `${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset}`;
3917
3932
  const vectorColor = agentdbStats.vectorCount > 0 ? c.brightGreen : c.dim;
3918
3933
  const testColor = testStats.testFiles > 0 ? c.brightGreen : c.dim;
@@ -4726,6 +4741,7 @@ export const hooksCommand = {
4726
4741
  coverageGapsCommand,
4727
4742
  // Token optimization
4728
4743
  tokenOptimizeCommand,
4744
+ contextPlanCommand,
4729
4745
  // Model routing (tiny-dancer integration)
4730
4746
  modelRouteCommand,
4731
4747
  modelOutcomeCommand,
@@ -121,7 +121,7 @@ const runCommand = {
121
121
  spinner.succeed('Workflow validated successfully');
122
122
  }
123
123
  else {
124
- spinner.succeed('Workflow started');
124
+ spinner.succeed('Workflow created');
125
125
  }
126
126
  if (ctx.flags.format === 'json') {
127
127
  output.printJson(result);
@@ -149,6 +149,8 @@ const runCommand = {
149
149
  });
150
150
  if (!dryRun) {
151
151
  output.writeln();
152
+ // #4609: workflow_run only creates the workflow; workflow_execute runs it.
153
+ output.printInfo(`Start it: claude-flow mcp exec -t workflow_execute -p '{"workflowId":"${result.workflowId}"}'`);
152
154
  output.printInfo(`Track progress: claude-flow workflow status ${result.workflowId}`);
153
155
  }
154
156
  return { success: true, data: result };
@@ -81,4 +81,8 @@ export type { CircuitBreakerConfig, CircuitState, } from './production/circuit-b
81
81
  export { MonitoringHooks, createMonitor, getMonitor, } from './production/monitoring.js';
82
82
  export type { MonitorConfig, MetricEvent, HealthStatus, PerformanceMetrics, } from './production/monitoring.js';
83
83
  export default CLI;
84
+ export { planContextRead, delegateContextRead, DEFAULT_CONTEXT_LIMITS } from './services/context-delegation.js';
85
+ export type { ContextMode, ContextIntent, ContextRead, ContextLimits, ContextPlan, ContextSource, ContextEvidence, ContextWorkerRequest, ContextWorkerReply, ContextAdapter, ContextReceipt, ContextResult } from './services/context-delegation.js';
86
+ export { createAnthropicContextAdapter } from './services/anthropic-context-adapter.js';
87
+ export type { AnthropicContextAdapterOptions, AnthropicContextAuthorization, AnthropicContextPricing, AnthropicContextUsage, AnthropicContextCallReceipt, GovernedAnthropicContextAdapter } from './services/anthropic-context-adapter.js';
84
88
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -611,4 +611,7 @@ export { CircuitBreaker, getCircuitBreaker, getAllCircuitStats, resetAllCircuits
611
611
  export { MonitoringHooks, createMonitor, getMonitor, } from './production/monitoring.js';
612
612
  // Default export
613
613
  export default CLI;
614
+ // Bounded, provider-neutral context delegation. Hosts retain policy and budget authority.
615
+ export { planContextRead, delegateContextRead, DEFAULT_CONTEXT_LIMITS } from './services/context-delegation.js';
616
+ export { createAnthropicContextAdapter } from './services/anthropic-context-adapter.js';
614
617
  //# sourceMappingURL=index.js.map
@@ -303,35 +303,52 @@ export const agentTools = [
303
303
  ...(routingResult.openrouterModel ? { openrouterModel: routingResult.openrouterModel } : {}),
304
304
  };
305
305
  const store = loadAgentStore();
306
- store.agents[agentId] = agent;
307
- saveAgentStore(store);
308
- // #2085 — also push to the swarm store's agents array so that
309
- // swarm_status reports the new agent. Without this, agent_spawn
310
- // and swarm_status read/write separate stores and agents added
311
- // post-init never show up in swarm_status.agents — confirmed for
312
- // all topologies (hierarchical, mesh, etc.).
306
+ // #2085 — the agent is also pushed to the swarm store's agents array so
307
+ // that swarm_status reports it. Resolve that swarm first: #4572 — an
308
+ // active swarm already holding maxAgents live agents refuses the spawn.
309
+ let swarmTools;
310
+ let swarmStore;
311
+ let targetSwarmId = input.swarmId || '';
313
312
  try {
314
- const { loadSwarmStore: _loadSwarmStore, saveSwarmStore: _saveSwarmStore } = await import('./swarm-tools.js');
315
- const swarmStore = _loadSwarmStore();
316
- let targetSwarmId = input.swarmId || '';
313
+ swarmTools = await import('./swarm-tools.js');
314
+ swarmStore = swarmTools.loadSwarmStore();
317
315
  if (!targetSwarmId) {
318
316
  // Default to the most-recently-created swarm.
319
317
  const all = Object.values(swarmStore.swarms);
320
318
  const latest = all.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())[0];
321
319
  targetSwarmId = latest?.swarmId || '';
322
320
  }
323
- if (targetSwarmId && swarmStore.swarms[targetSwarmId]) {
324
- const swarm = swarmStore.swarms[targetSwarmId];
321
+ }
322
+ catch { /* swarm store unavailable — agent still registered globally */ }
323
+ const swarm = targetSwarmId ? swarmStore?.swarms[targetSwarmId] : undefined;
324
+ const members = Array.isArray(swarm?.agents) ? swarm.agents : [];
325
+ if (swarm && swarm.status !== 'terminated' && !members.includes(agentId)) {
326
+ // Terminated agents stay listed in swarm.agents; they no longer hold a slot.
327
+ const live = members.filter((id) => store.agents[id] && store.agents[id].status !== 'terminated').length;
328
+ if (live >= swarm.maxAgents) {
329
+ return {
330
+ success: false,
331
+ error: `Swarm ${swarm.swarmId} is full: ${live}/${swarm.maxAgents} agents. Terminate an agent (agent_terminate) or init a swarm with a larger maxAgents.`,
332
+ swarmId: swarm.swarmId,
333
+ agentCount: live,
334
+ maxAgents: swarm.maxAgents,
335
+ };
336
+ }
337
+ }
338
+ store.agents[agentId] = agent;
339
+ saveAgentStore(store);
340
+ if (swarm && swarmTools && swarmStore) {
341
+ try {
325
342
  if (!Array.isArray(swarm.agents))
326
343
  swarm.agents = [];
327
344
  // Idempotent — don't duplicate if agent_spawn is retried.
328
345
  if (!swarm.agents.includes(agentId)) {
329
346
  swarm.agents.push(agentId);
330
- _saveSwarmStore(swarmStore);
347
+ swarmTools.saveSwarmStore(swarmStore);
331
348
  }
332
349
  }
350
+ catch { /* swarm store unwritable — agent still registered globally */ }
333
351
  }
334
- catch { /* swarm store unavailable — agent still registered globally */ }
335
352
  // Record agent in graph database (ADR-087, best-effort)
336
353
  try {
337
354
  const { addNode } = await import('../ruvector/graph-backend.js');
@@ -0,0 +1,16 @@
1
+ /**
2
+ * agentdb_episode-get / -list / -update / -delete (ADR-520).
3
+ *
4
+ * Episodes are the records session ends and `memory distill` write and that
5
+ * agentdb_episode-recall searches. Needs agentdb >= 3.3.0 (in-place update that keeps the id
6
+ * and re-indexes); older builds get a clear error instead of a partial operation.
7
+ *
8
+ * @module v3/cli/mcp-tools/agentdb-episode-tools
9
+ */
10
+ import type { MCPTool } from './types.js';
11
+ export declare const agentdbEpisodeGet: MCPTool;
12
+ export declare const agentdbEpisodeList: MCPTool;
13
+ export declare const agentdbEpisodeUpdate: MCPTool;
14
+ export declare const agentdbEpisodeDelete: MCPTool;
15
+ export declare const agentdbEpisodeCrudTools: MCPTool[];
16
+ //# sourceMappingURL=agentdb-episode-tools.d.ts.map