Skip to content

Commit c192867

Browse files
author
jovanSAPFIONEER
committed
docs: update all documentation for v4.13.0 Phase 8
- SECURITY.md + .github/SECURITY.md: version table 4.13.x current, Phase 8 security entries (matcher hooks, approval gates, confidence filtering) - README.md: What's Included table + test table with Phase 8 rows, 1,924/23 suites - ARCHITECTURE.md: project structure tree with Phase 7+8 lib modules - references/adapter-system.md: 4 new sections (matcher filtering, phase pipeline, confidence filter, fan-out/fan-in) - SKILL.md: TypeScript engine note linking parallel strategies to Phase 8 modules - CLAUDE.md, CODEX.md: version + project structure - CONTRIBUTING.md: test count - copilot-instructions.md: Key Files with Phase 8
1 parent e6deda2 commit c192867

File tree

10 files changed

+180
-12
lines changed

10 files changed

+180
-12
lines changed

.github/SECURITY.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
| Version | Supported |
66
|---------|-----------|
7-
| 4.12.x | ✅ Yes — full support (current) |
8-
| 4.11.x | ✅ Security fixes only |
7+
| 4.13.x | ✅ Yes — full support (current) |
8+
| 4.12.x | ✅ Security fixes only |
99
| 4.9.x | ✅ Security fixes only |
1010
| 4.8.x | ✅ Security fixes only |
1111
| 4.7.x | ✅ Security fixes only |
@@ -44,6 +44,9 @@ Network-AI includes built-in security features:
4444
- **Deferred Adapter Initialization** (v4.12.0) -- adapters are materialized only on first use via `registerDeferred()`, preventing untrusted adapter code from running at startup
4545
- **Adapter Hook Middleware** (v4.12.0) -- `beforeExecute` / `afterExecute` / `onError` lifecycle hooks; enables request-level logging, tracing, and custom security gates without modifying adapters
4646
- **Flow Control** (v4.12.0) -- `pause()` / `resume()` / `setThrottle()` on the blackboard; prevents write floods and enables coordinated maintenance windows
47+
- **Matcher-Based Hook Filtering** (v4.13.0) -- `HookMatcher` with `agentPattern`, `actionPattern`, `toolPattern` globs, and custom `condition` functions; hooks only fire when all conditions pass, enabling fine-grained security policies per tool or agent pattern
48+
- **Phase Pipeline with Approval Gates** (v4.13.0) -- `PhasePipeline` orchestrates multi-phase workflows; `requiresApproval` boolean halts execution until explicit human approval is granted, enforcing human-in-the-loop for sensitive operations
49+
- **Confidence-Based Filtering** (v4.13.0) -- `ConfidenceFilter` rejects low-confidence agent findings below configurable thresholds and validates rejected results with secondary agents; aggregation strategies (unanimous, majority) enforce consensus before accepting multi-agent results
4750

4851
## Security Scan Results
4952

.github/copilot-instructions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ Network-AI is a TypeScript/Node.js multi-agent orchestrator — shared state, gu
2727
- `lib/locked-blackboard.ts` — LockedBlackboard with atomic propose → validate → commit
2828
- `lib/fsm-journey.ts` — JourneyFSM behavioral control plane
2929
- `lib/compliance-monitor.ts` — Real-time agent behavior surveillance
30-
- `lib/adapter-hooks.ts` — AdapterHookManager lifecycle hooks
30+
- `lib/adapter-hooks.ts` — AdapterHookManager lifecycle hooks + matcher-based filtering
3131
- `lib/skill-composer.ts` — SkillComposer meta-operations (chain/batch/loop/verify)
3232
- `lib/semantic-search.ts` — SemanticMemory BYOE vector store
33+
- `lib/phase-pipeline.ts` — PhasePipeline multi-phase workflows with approval gates
34+
- `lib/confidence-filter.ts` — ConfidenceFilter multi-agent result scoring and filtering
35+
- `lib/fan-out.ts` — FanOutFanIn parallel agent spawning with pluggable aggregation
3336
- `adapters/` — 17 framework adapters (LangChain, AutoGen, CrewAI, MCP, Codex, MiniMax, NemoClaw, APS, etc.)
3437

3538
## Build & Test

ARCHITECTURE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,13 @@ Network-AI/
291291
│ ├── blackboard-validator.ts # Content quality gate (Layer 1 + Layer 2)
292292
│ ├── qa-orchestrator.ts # QA orchestrator (scenario replay, regression, contradictions)
293293
│ ├── fsm-journey.ts # FSM state machine and compliance monitor
294-
│ └── swarm-utils.ts # Helper utilities
294+
│ ├── swarm-utils.ts # Helper utilities
295+
│ ├── adapter-hooks.ts # Lifecycle hooks + matcher-based filtering (v4.12–4.13)
296+
│ ├── skill-composer.ts # chain/batch/loop/verify meta-operations (v4.12)
297+
│ ├── semantic-search.ts # BYOE vector store with cosine similarity (v4.12)
298+
│ ├── phase-pipeline.ts # Multi-phase workflows with approval gates (v4.13)
299+
│ ├── confidence-filter.ts # Multi-agent result scoring and filtering (v4.13)
300+
│ └── fan-out.ts # Parallel agent spawning with pluggable aggregation (v4.13)
295301
├── scripts/ # Python helper scripts (local orchestration only)
296302
│ ├── blackboard.py # Shared state management with atomic commits
297303
│ ├── swarm_guard.py # Handoff tax prevention, budget tracking

CLAUDE.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is read automatically by Claude Code when working in this repository.
44

55
## Project Overview
66

7-
Network-AI is a TypeScript/Node.js multi-agent orchestrator — shared state, guardrails, budgets, and cross-framework coordination. Version 4.12.0.
7+
Network-AI is a TypeScript/Node.js multi-agent orchestrator — shared state, guardrails, budgets, and cross-framework coordination. Version 4.13.0.
88

99
## Build & Test Commands
1010

@@ -28,9 +28,12 @@ All tests must pass before any commit. No test should be skipped or marked `.onl
2828
- `lib/locked-blackboard.ts` — LockedBlackboard with atomic propose → validate → commit and file-system mutex
2929
- `lib/fsm-journey.ts` — JourneyFSM behavioral control plane
3030
- `lib/compliance-monitor.ts` — Real-time agent behavior surveillance
31-
- `lib/adapter-hooks.ts` — AdapterHookManager: beforeExecute/afterExecute/onError lifecycle hooks
31+
- `lib/adapter-hooks.ts` — AdapterHookManager: beforeExecute/afterExecute/onError lifecycle hooks + matcher-based filtering
3232
- `lib/skill-composer.ts` — SkillComposer: chain/batch/loop/verify meta-operations
3333
- `lib/semantic-search.ts` — SemanticMemory: BYOE vector store with cosine similarity
34+
- `lib/phase-pipeline.ts` — PhasePipeline: multi-phase workflows with approval gates
35+
- `lib/confidence-filter.ts` — ConfidenceFilter: multi-agent result scoring and filtering
36+
- `lib/fan-out.ts` — FanOutFanIn: parallel agent spawning with pluggable aggregation
3437
- `adapters/` — 17 framework adapters (LangChain, AutoGen, CrewAI, MCP, Codex, MiniMax, NemoClaw, APS, etc.)
3538
- `bin/cli.ts` — CLI entry point (`npx network-ai`)
3639
- `bin/mcp-server.ts` — MCP server (SSE + stdio transport)

CODEX.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is read automatically by OpenAI Codex CLI when working in this reposit
44

55
## Project Overview
66

7-
Network-AI is a TypeScript/Node.js multi-agent orchestrator — shared state, guardrails, budgets, and cross-framework coordination. Version 4.12.0.
7+
Network-AI is a TypeScript/Node.js multi-agent orchestrator — shared state, guardrails, budgets, and cross-framework coordination. Version 4.13.0.
88

99
## Build & Test Commands
1010

@@ -28,6 +28,12 @@ All tests must pass before any commit. No test should be skipped or marked `.onl
2828
- `lib/locked-blackboard.ts` — LockedBlackboard with atomic propose → validate → commit and file-system mutex
2929
- `lib/fsm-journey.ts` — JourneyFSM behavioral control plane
3030
- `lib/compliance-monitor.ts` — Real-time agent behavior surveillance
31+
- `lib/adapter-hooks.ts` — AdapterHookManager: lifecycle hooks + matcher-based filtering
32+
- `lib/skill-composer.ts` — SkillComposer: chain/batch/loop/verify meta-operations
33+
- `lib/semantic-search.ts` — SemanticMemory: BYOE vector store with cosine similarity
34+
- `lib/phase-pipeline.ts` — PhasePipeline: multi-phase workflows with approval gates
35+
- `lib/confidence-filter.ts` — ConfidenceFilter: multi-agent result scoring and filtering
36+
- `lib/fan-out.ts` — FanOutFanIn: parallel agent spawning with pluggable aggregation
3137
- `adapters/` — 17 framework adapters (LangChain, AutoGen, CrewAI, MCP, Codex, MiniMax, NemoClaw, APS, etc.)
3238
- `bin/cli.ts` — CLI entry point (`npx network-ai`)
3339
- `bin/mcp-server.ts` — MCP server (SSE + stdio transport)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Unsolicited PRs without a linked, approved issue will be closed.
1616

1717
### Code Quality
1818

19-
- All 1,778 existing tests must pass (`npm run test:all`)
19+
- All 1,924 existing tests must pass (`npm run test:all`)
2020
- Zero TypeScript compile errors (`npx tsc --noEmit`)
2121
- New features must include tests with >90% branch coverage
2222
- Follow existing code style and patterns

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![CodeQL](https://github.com/Jovancoding/Network-AI/actions/workflows/codeql.yml/badge.svg)](https://github.com/Jovancoding/Network-AI/actions/workflows/codeql.yml)
88
[![Release](https://img.shields.io/badge/release-v4.13.0-blue.svg)](https://github.com/Jovancoding/Network-AI/releases)
99
[![npm](https://img.shields.io/npm/dw/network-ai.svg?label=npm%20downloads)](https://www.npmjs.com/package/network-ai)
10-
[![Tests](https://img.shields.io/badge/tests-1778%20passing-brightgreen.svg)](#testing)
10+
[![Tests](https://img.shields.io/badge/tests-1924%20passing-brightgreen.svg)](#testing)
1111
[![Adapters](https://img.shields.io/badge/frameworks-17%20supported-blueviolet.svg)](#adapter-system)
1212
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
1313
[![Socket](https://socket.dev/api/badge/npm/package/network-ai)](https://socket.dev/npm/package/network-ai/overview)
@@ -94,6 +94,10 @@ Runs priority preemption, AuthGuardian permission gating, FSM governance, and co
9494
| ✅ Flow control | Pause / resume / throttle writes on the blackboard |
9595
| ✅ Skill composition | `chain()` / `batch()` / `loop()` / `verify()` meta-operations over agent calls |
9696
| ✅ Semantic memory search | BYOE vector store with cosine similarity over blackboard data |
97+
| ✅ Phase pipeline | Multi-phase workflows with human-in-the-loop approval gates |
98+
| ✅ Confidence filtering | Multi-agent result scoring, threshold validation, and consensus aggregation |
99+
| ✅ Matcher-based hooks | Glob patterns on agent/action/tool for targeted hook filtering |
100+
| ✅ Fan-out / fan-in | Parallel agent spawning with pluggable aggregation strategies |
97101
| ✅ TypeScript native | ES2022 strict mode, zero native dependencies |
98102

99103
---
@@ -389,7 +393,7 @@ npm run test:priority # Priority & preemption
389393
npm run test:cli # CLI layer
390394
```
391395

392-
**1,778 passing assertions across 22 test suites** (`npm run test:all`):
396+
**1,924 passing assertions across 23 test suites** (`npm run test:all`):
393397

394398
| Suite | Assertions | Covers |
395399
|---|---|---|
@@ -414,6 +418,7 @@ npm run test:cli # CLI layer
414418
| `test-cli.ts` | 65 | CLI layer: bb, auth, budget, audit commands |
415419
| `test-qa.ts` | 67 | QA orchestrator: scenarios, feedback loop, regression, contradictions |
416420
| `test-phase7.ts` | 94 | Deferred init, hook middleware, flow control, skill composer, semantic search |
421+
| `test-phase8.ts` | 146 | Phase pipeline, confidence filter, matcher-based hooks, fan-out/fan-in |
417422

418423
---
419424

SECURITY.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
| Version | Supported |
66
|---------|-----------||
7-
| 4.12.x | ✅ Yes — full support (current) |
8-
| 4.11.x | ✅ Security fixes only |
7+
| 4.13.x | ✅ Yes — full support (current) |
8+
| 4.12.x | ✅ Security fixes only |
99
| 4.9.x | ✅ Security fixes only |
1010
| 4.8.x | ✅ Security fixes only |
1111
| 4.7.x | ✅ Security fixes only |
@@ -44,6 +44,9 @@ Network-AI includes built-in security features:
4444
- **Deferred Adapter Initialization** (v4.12.0) -- adapters are materialized only on first use via `registerDeferred()`, preventing untrusted adapter code from running at startup
4545
- **Adapter Hook Middleware** (v4.12.0) -- `beforeExecute` / `afterExecute` / `onError` lifecycle hooks; enables request-level logging, tracing, and custom security gates without modifying adapters
4646
- **Flow Control** (v4.12.0) -- `pause()` / `resume()` / `setThrottle()` on the blackboard; prevents write floods and enables coordinated maintenance windows
47+
- **Matcher-Based Hook Filtering** (v4.13.0) -- `HookMatcher` with `agentPattern`, `actionPattern`, `toolPattern` globs, and custom `condition` functions; hooks only fire when all conditions pass, enabling fine-grained security policies per tool or agent pattern
48+
- **Phase Pipeline with Approval Gates** (v4.13.0) -- `PhasePipeline` orchestrates multi-phase workflows; `requiresApproval` boolean halts execution until explicit human approval is granted, enforcing human-in-the-loop for sensitive operations
49+
- **Confidence-Based Filtering** (v4.13.0) -- `ConfidenceFilter` rejects low-confidence agent findings below configurable thresholds and validates rejected results with secondary agents; aggregation strategies (unanimous, majority) enforce consensus before accepting multi-agent results
4750

4851
## Security Scan Results
4952

SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ Use for redundancy - take first successful result.
498498
### Strategy 4: Chain
499499
Sequential processing - output of one feeds into next.
500500

501+
> **TypeScript engine (v4.13.0):** These strategies map directly to the `FanOutFanIn` module (`lib/fan-out.ts`) which provides `merge`, `vote`, `firstSuccess`, and `consensus` fan-in strategies with concurrency control. For multi-phase workflows with approval gates, see `PhasePipeline` (`lib/phase-pipeline.ts`). For result scoring and threshold filtering, see `ConfidenceFilter` (`lib/confidence-filter.ts`). Matcher-based hooks (`lib/adapter-hooks.ts`) can target specific agents or tools via glob patterns.
502+
501503
### Example Parallel Workflow
502504

503505
> **Platform note:** `sessions_send` and `sessions_history` are **OpenClaw host platform built-ins**, not provided by this skill. This skill provides only the `swarm_guard.py` budget/handoff check that runs before each delegation.

references/adapter-system.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,140 @@ bb.getThrottle(); // 500
444444
// Constructor option
445445
const bb2 = new LockedBlackboard({ throttleMs: 100, conflictResolution: 'last-write-wins' });
446446
```
447+
448+
## Matcher-Based Hook Filtering (v4.13.0)
449+
450+
Target hooks to specific agents, actions, or tools using glob patterns:
451+
452+
```typescript
453+
import { AdapterHookManager, HookMatcher, matchGlob } from 'network-ai';
454+
455+
const hooks = new AdapterHookManager();
456+
457+
// Matcher: only fire for agents matching 'security-*' using tool 'file_*'
458+
const matcher: HookMatcher = {
459+
agentPattern: 'security-*',
460+
toolPattern: 'file_*',
461+
};
462+
463+
hooks.beforeExecute(async (ctx) => {
464+
console.log(`Security hook for ${ctx.agentId}`);
465+
}, { priority: 5, matcher });
466+
467+
// Custom condition function for dynamic filtering
468+
const dynamicMatcher: HookMatcher = {
469+
condition: (ctx) => ctx.payload?.handoff?.risk === 'high',
470+
};
471+
472+
hooks.beforeExecute(async (ctx) => {
473+
return { abort: true, reason: 'High-risk operations require approval' };
474+
}, { priority: 1, matcher: dynamicMatcher });
475+
```
476+
477+
- `agentPattern` — glob matched against `ctx.agentId`
478+
- `actionPattern` — glob matched against `ctx.action`
479+
- `toolPattern` — glob matched against `ctx.tool`
480+
- `condition` — arbitrary predicate `(ctx) => boolean`
481+
- All specified fields use AND logic; hook fires only when all match
482+
- `matchGlob(pattern, value)` and `matchToolPattern(pattern, tool)` are exported utilities
483+
484+
## Phase Pipeline (v4.13.0)
485+
486+
Orchestrate multi-phase workflows with approval gates:
487+
488+
```typescript
489+
import { PhasePipeline, PhaseDefinition } from 'network-ai';
490+
491+
const phases: PhaseDefinition[] = [
492+
{
493+
name: 'research',
494+
agents: ['researcher-1', 'researcher-2'],
495+
parallel: true,
496+
},
497+
{
498+
name: 'review',
499+
agents: ['reviewer'],
500+
requiresApproval: true, // halts until approved
501+
},
502+
{
503+
name: 'deploy',
504+
agents: ['deployer'],
505+
payloadFactory: (prev) => ({ ...prev, approved: true }),
506+
},
507+
];
508+
509+
const pipeline = new PhasePipeline(phases, executeFn, {
510+
autoApprove: false,
511+
approvalCallback: async (phase) => {
512+
// Human-in-the-loop: return true to proceed, false to reject
513+
return await askHuman(`Approve phase "${phase.name}"?`);
514+
},
515+
onPhaseStart: (name) => console.log(`Starting: ${name}`),
516+
onPhaseComplete: (name, result) => console.log(`Done: ${name}`),
517+
});
518+
519+
const result = await pipeline.run(initialPayload);
520+
// result.phases — per-phase results
521+
// result.status — 'completed' | 'rejected' | 'error'
522+
```
523+
524+
## Confidence Filter (v4.13.0)
525+
526+
Score, filter, and aggregate multi-agent results:
527+
528+
```typescript
529+
import { ConfidenceFilter, Finding } from 'network-ai';
530+
531+
const filter = new ConfidenceFilter({ threshold: 0.7 });
532+
533+
// Score individual findings
534+
const findings: Finding[] = [
535+
{ id: 'f1', source: 'agent-a', content: 'SQL injection found', confidence: 0.92 },
536+
{ id: 'f2', source: 'agent-b', content: 'Minor style issue', confidence: 0.45 },
537+
];
538+
539+
const result = filter.filter(findings);
540+
// result.accepted — [f1] (above threshold)
541+
// result.rejected — [f2] (below threshold)
542+
543+
// Validate rejected findings with a secondary agent
544+
const validated = await filter.validateRejected(result, async (finding) => {
545+
return { ...finding, confidence: 0.8 }; // secondary agent re-scores
546+
});
547+
548+
// Aggregate across multiple agents
549+
const aggregated = filter.aggregate(findings, 'majority');
550+
// Strategies: 'highest', 'average', 'unanimous', 'majority'
551+
```
552+
553+
## Fan-Out / Fan-In (v4.13.0)
554+
555+
Spawn parallel agents with concurrency control and pluggable aggregation:
556+
557+
```typescript
558+
import { FanOutFanIn, FanOutStep } from 'network-ai';
559+
560+
const fan = new FanOutFanIn(executeFn);
561+
562+
const steps: FanOutStep[] = [
563+
{ agentId: 'researcher-1', payload: { query: 'topic A' }, tag: 'r1' },
564+
{ agentId: 'researcher-2', payload: { query: 'topic B' }, tag: 'r2' },
565+
{ agentId: 'researcher-3', payload: { query: 'topic C' }, tag: 'r3' },
566+
];
567+
568+
// Fan-out with concurrency limit
569+
const results = await fan.fanOut(steps, { concurrency: 2, continueOnError: true });
570+
// results — TaggedResult[] with { tag, result, success, error? }
571+
572+
// Fan-in with strategy
573+
const merged = fan.fanIn(results, 'merge');
574+
// Strategies: 'merge', 'firstSuccess', 'vote', 'consensus'
575+
576+
// Or use run() for convenience (fan-out + fan-in in one call)
577+
const final = await fan.run(steps, 'vote', { concurrency: 2 });
578+
579+
// Custom reducer
580+
const custom = fan.fanIn(results, 'custom', (tagged) => {
581+
return { combined: tagged.map(t => t.result) };
582+
});
583+
```

0 commit comments

Comments
 (0)