agentic-flow 1.4.7 → 1.4.9

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/dist/cli-proxy.js CHANGED
@@ -30,6 +30,7 @@ import { logger } from "./utils/logger.js";
30
30
  import { parseArgs } from "./utils/cli.js";
31
31
  import { getAgent, listAgents } from "./utils/agentLoader.js";
32
32
  import { claudeAgent } from "./agents/claudeAgent.js";
33
+ import { handleReasoningBankCommand } from "./utils/reasoningbankCommands.js";
33
34
  import { handleConfigCommand } from "./cli/config-wizard.js";
34
35
  import { handleAgentCommand } from "./cli/agent-manager.js";
35
36
  import { ModelOptimizer } from "./utils/modelOptimizer.js";
@@ -53,7 +54,7 @@ class AgenticFlowCLI {
53
54
  process.exit(0);
54
55
  }
55
56
  // If no mode and no agent specified, show help
56
- if (!options.agent && options.mode !== 'list' && !['config', 'agent-manager', 'mcp-manager', 'proxy', 'claude-code', 'mcp'].includes(options.mode)) {
57
+ if (!options.agent && options.mode !== 'list' && !['config', 'agent-manager', 'mcp-manager', 'proxy', 'claude-code', 'mcp', 'reasoningbank'].includes(options.mode)) {
57
58
  this.printHelp();
58
59
  process.exit(0);
59
60
  }
@@ -132,6 +133,12 @@ class AgenticFlowCLI {
132
133
  process.on('SIGTERM', () => proc.kill('SIGTERM'));
133
134
  return;
134
135
  }
136
+ if (options.mode === 'reasoningbank') {
137
+ // Handle ReasoningBank commands
138
+ const subcommand = process.argv[3] || 'help';
139
+ await handleReasoningBankCommand(subcommand);
140
+ process.exit(0);
141
+ }
135
142
  // Apply model optimization if requested
136
143
  if (options.optimize && options.agent && options.task) {
137
144
  const recommendation = ModelOptimizer.optimize({
@@ -1,75 +1,168 @@
1
1
  import { parse } from 'yaml';
2
- import { readFileSync } from 'fs';
3
- import { join } from 'path';
2
+ import { readFileSync, existsSync } from 'fs';
3
+ import { join, dirname } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
4
7
  let configCache = null;
5
- const configPath = join(process.cwd(), 'src', 'reasoningbank', 'config', 'reasoningbank.yaml');
8
+ // Default configuration
9
+ const DEFAULT_CONFIG = {
10
+ retrieve: {
11
+ k: 3,
12
+ alpha: 0.65,
13
+ beta: 0.15,
14
+ gamma: 0.20,
15
+ delta: 0.10,
16
+ recency_half_life_days: 45,
17
+ min_score: 0.3
18
+ },
19
+ judge: {
20
+ model: 'claude-sonnet-4-5-20250929',
21
+ max_tokens: 512,
22
+ temperature: 0,
23
+ confidence_threshold: 0.5
24
+ },
25
+ distill: {
26
+ model: undefined,
27
+ max_tokens: undefined,
28
+ temperature: undefined,
29
+ max_items_success: 3,
30
+ max_items_failure: 2,
31
+ confidence_prior_success: 0.75,
32
+ confidence_prior_failure: 0.60
33
+ },
34
+ consolidate: {
35
+ duplicate_threshold: 0.95,
36
+ contradiction_threshold: 0.85,
37
+ trigger_threshold: 20,
38
+ prune_age_days: 180,
39
+ prune_min_confidence: 0.3,
40
+ min_confidence_keep: 0.5
41
+ },
42
+ matts: {
43
+ parallel_k: 3,
44
+ sequential_k: 5,
45
+ sequential_r: 5,
46
+ sequential_stop_on_success: true,
47
+ confidence_boost: 0.05
48
+ },
49
+ embeddings: {
50
+ provider: 'claude',
51
+ model: 'claude-3-5-sonnet-20241022',
52
+ dims: 1024,
53
+ dimensions: 1024,
54
+ cache_ttl_seconds: 3600
55
+ },
56
+ governance: {
57
+ scrub_pii: true,
58
+ pii_scrubber: true,
59
+ tenant_scoped: false
60
+ },
61
+ features: {
62
+ enable_pre_task_hook: true,
63
+ enable_post_task_hook: true,
64
+ enable_matts_parallel: true
65
+ }
66
+ };
67
+ // Try multiple paths to find config file
68
+ function findConfigPath() {
69
+ const paths = [
70
+ // Development: relative to source file
71
+ join(__dirname, '../config/reasoningbank.yaml'),
72
+ // npm package: relative to dist file
73
+ join(__dirname, '../../config/reasoningbank.yaml'),
74
+ // User override: current working directory
75
+ join(process.cwd(), '.swarm/reasoningbank.yaml'),
76
+ join(process.cwd(), 'reasoningbank.yaml')
77
+ ];
78
+ for (const path of paths) {
79
+ if (existsSync(path)) {
80
+ return path;
81
+ }
82
+ }
83
+ return null;
84
+ }
6
85
  export function loadConfig() {
7
86
  if (configCache)
8
87
  return configCache;
9
- const yamlContent = readFileSync(configPath, 'utf-8');
10
- const parsed = parse(yamlContent);
11
- // Handle nested reasoningbank: key
12
- const raw = parsed.reasoningbank || parsed;
13
- // Map the full config to our simplified interface
14
- configCache = {
15
- retrieve: {
16
- k: raw.retrieve?.k ?? 3,
17
- alpha: raw.retrieve?.alpha ?? 0.65,
18
- beta: raw.retrieve?.beta ?? 0.15,
19
- gamma: raw.retrieve?.gamma ?? 0.20,
20
- delta: raw.retrieve?.delta ?? 0.10,
21
- recency_half_life_days: raw.retrieve?.recency_half_life_days ?? 45,
22
- min_score: raw.retrieve?.min_score ?? 0.3
23
- },
24
- judge: {
25
- model: raw.judge?.model ?? 'claude-sonnet-4-5-20250929',
26
- max_tokens: raw.judge?.max_tokens ?? 512,
27
- temperature: raw.judge?.temperature ?? 0,
28
- confidence_threshold: raw.judge?.fallback_confidence ?? 0.5
29
- },
30
- distill: {
31
- model: raw.distill?.model,
32
- max_tokens: raw.distill?.max_tokens,
33
- temperature: raw.distill?.temperature,
34
- max_items_success: raw.distill?.max_items_per_trajectory ?? 3,
35
- max_items_failure: 2,
36
- confidence_prior_success: raw.distill?.success_confidence_prior ?? 0.75,
37
- confidence_prior_failure: raw.distill?.failure_confidence_prior ?? 0.60
38
- },
39
- consolidate: {
40
- duplicate_threshold: raw.consolidate?.dedup_similarity_threshold ?? 0.95,
41
- contradiction_threshold: raw.consolidate?.contradiction_threshold ?? 0.85,
42
- trigger_threshold: raw.consolidate?.run_every_new_items ?? 20,
43
- prune_age_days: raw.consolidate?.prune_age_days ?? 180,
44
- prune_min_confidence: raw.consolidate?.min_confidence_keep ?? 0.3,
45
- min_confidence_keep: raw.consolidate?.min_confidence_keep ?? 0.5
46
- },
47
- matts: {
48
- parallel_k: raw.matts?.parallel?.k ?? 3,
49
- sequential_k: raw.matts?.sequential?.r ?? 5,
50
- sequential_r: raw.matts?.sequential?.r ?? 5,
51
- sequential_stop_on_success: raw.matts?.sequential?.stop_on_success ?? true,
52
- confidence_boost: 0.05
53
- },
54
- embeddings: {
55
- provider: raw.embeddings?.provider ?? 'claude',
56
- model: raw.embeddings?.model ?? 'claude-3-5-sonnet-20241022',
57
- dims: raw.embeddings?.dimensions ?? 1024,
58
- dimensions: raw.embeddings?.dimensions ?? 1024,
59
- cache_ttl_seconds: raw.embeddings?.cache_ttl_seconds ?? 3600
60
- },
61
- governance: {
62
- scrub_pii: raw.governance?.pii_scrubber ?? true,
63
- pii_scrubber: raw.governance?.pii_scrubber ?? true,
64
- tenant_scoped: raw.governance?.tenant_scoped ?? false
65
- },
66
- features: {
67
- enable_pre_task_hook: raw.features?.enable_pre_task_hook ?? true,
68
- enable_post_task_hook: raw.features?.enable_post_task_hook ?? true,
69
- enable_matts_parallel: raw.features?.enable_matts_parallel ?? true
70
- }
71
- };
72
- return configCache;
88
+ const configPath = findConfigPath();
89
+ // If no config file found, use defaults
90
+ if (!configPath) {
91
+ configCache = DEFAULT_CONFIG;
92
+ return configCache;
93
+ }
94
+ try {
95
+ const yamlContent = readFileSync(configPath, 'utf-8');
96
+ const parsed = parse(yamlContent);
97
+ // Handle nested reasoningbank: key
98
+ const raw = parsed.reasoningbank || parsed;
99
+ // Map the full config to our simplified interface
100
+ configCache = {
101
+ retrieve: {
102
+ k: raw.retrieve?.k ?? 3,
103
+ alpha: raw.retrieve?.alpha ?? 0.65,
104
+ beta: raw.retrieve?.beta ?? 0.15,
105
+ gamma: raw.retrieve?.gamma ?? 0.20,
106
+ delta: raw.retrieve?.delta ?? 0.10,
107
+ recency_half_life_days: raw.retrieve?.recency_half_life_days ?? 45,
108
+ min_score: raw.retrieve?.min_score ?? 0.3
109
+ },
110
+ judge: {
111
+ model: raw.judge?.model ?? 'claude-sonnet-4-5-20250929',
112
+ max_tokens: raw.judge?.max_tokens ?? 512,
113
+ temperature: raw.judge?.temperature ?? 0,
114
+ confidence_threshold: raw.judge?.fallback_confidence ?? 0.5
115
+ },
116
+ distill: {
117
+ model: raw.distill?.model,
118
+ max_tokens: raw.distill?.max_tokens,
119
+ temperature: raw.distill?.temperature,
120
+ max_items_success: raw.distill?.max_items_per_trajectory ?? 3,
121
+ max_items_failure: 2,
122
+ confidence_prior_success: raw.distill?.success_confidence_prior ?? 0.75,
123
+ confidence_prior_failure: raw.distill?.failure_confidence_prior ?? 0.60
124
+ },
125
+ consolidate: {
126
+ duplicate_threshold: raw.consolidate?.dedup_similarity_threshold ?? 0.95,
127
+ contradiction_threshold: raw.consolidate?.contradiction_threshold ?? 0.85,
128
+ trigger_threshold: raw.consolidate?.run_every_new_items ?? 20,
129
+ prune_age_days: raw.consolidate?.prune_age_days ?? 180,
130
+ prune_min_confidence: raw.consolidate?.min_confidence_keep ?? 0.3,
131
+ min_confidence_keep: raw.consolidate?.min_confidence_keep ?? 0.5
132
+ },
133
+ matts: {
134
+ parallel_k: raw.matts?.parallel?.k ?? 3,
135
+ sequential_k: raw.matts?.sequential?.r ?? 5,
136
+ sequential_r: raw.matts?.sequential?.r ?? 5,
137
+ sequential_stop_on_success: raw.matts?.sequential?.stop_on_success ?? true,
138
+ confidence_boost: 0.05
139
+ },
140
+ embeddings: {
141
+ provider: raw.embeddings?.provider ?? 'claude',
142
+ model: raw.embeddings?.model ?? 'claude-3-5-sonnet-20241022',
143
+ dims: raw.embeddings?.dimensions ?? 1024,
144
+ dimensions: raw.embeddings?.dimensions ?? 1024,
145
+ cache_ttl_seconds: raw.embeddings?.cache_ttl_seconds ?? 3600
146
+ },
147
+ governance: {
148
+ scrub_pii: raw.governance?.pii_scrubber ?? true,
149
+ pii_scrubber: raw.governance?.pii_scrubber ?? true,
150
+ tenant_scoped: raw.governance?.tenant_scoped ?? false
151
+ },
152
+ features: {
153
+ enable_pre_task_hook: raw.features?.enable_pre_task_hook ?? true,
154
+ enable_post_task_hook: raw.features?.enable_post_task_hook ?? true,
155
+ enable_matts_parallel: raw.features?.enable_matts_parallel ?? true
156
+ }
157
+ };
158
+ return configCache;
159
+ }
160
+ catch (error) {
161
+ // If config file exists but can't be read, use defaults
162
+ console.warn(`[ReasoningBank] Could not load config from ${configPath}, using defaults:`, error instanceof Error ? error.message : String(error));
163
+ configCache = DEFAULT_CONFIG;
164
+ return configCache;
165
+ }
73
166
  }
74
167
  export function clearConfigCache() {
75
168
  configCache = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-flow",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "Production-ready AI agent orchestration platform with 66 specialized agents, 213 MCP tools, ReasoningBank learning memory, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",