agentleFS
JovancodingJovancoding/Network-AI/CLAUDE.md

Network-AI

CLAUDE.md78 starsChanged 7 months agoMITView on GitHub

This file is read automatically by Claude Code when working in this repository. Network-AI is a TypeScript/Node.js multi-agent orchestrator — shared state, guardrails, budgets, and cross-framework coordination. Version 5.15.4. All tests must pass before any commit. No test should be skipped or marked .only.

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All tests must pass before any commit.

    line 22
  2. Very specific:

    Blackboard pattern: All agent coordination goes through LockedBlackboard — propose() → validate() → commit() with file-system mutex.

    line 59
  3. Very specific:

    Adapter system: All adapters extend BaseAdapter.

    line 61
  4. Very specific:

    Audit trail: Every write, permission grant, and state transition is logged to data/audit_log.jsonl via SecureAuditLogger.

    line 62
  5. Distinctive:

    No new runtime dependencies without explicit approval

    line 69
  6. Distinctive:

    Keep adapter files self-contained — no cross-adapter imports

    line 71
  7. Distinctive:

    No hardcoded secrets, keys, or credentials anywhere

    line 91
  8. Very specific:

    Create adapters/<name>-adapter.ts extending BaseAdapter

    line 98
  9. Very specific:

    Add tests in test-adapters.ts

    line 101
  10. Distinctive:

    Update README adapter table

    line 102

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — Project Instructions for Claude Code

This file is read automatically by Claude Code when working in this repository.

Project Overview

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

Build & Test Commands

npm install                   # Install dependencies
npx tsc --noEmit              # Type-check (zero errors expected)
npm run test:all              # Run all 3,679 tests across 41 suites
npm test                      # Core orchestrator tests only
npm run test:security         # Security module tests
npm run test:adapters         # All 32 adapter tests
npm run test:priority         # Priority & preemption tests
npm run test:cli              # CLI layer tests

All tests must pass before any commit. No test should be skipped or marked .only.

Project Structure

  • index.ts — Core engine: SwarmOrchestrator, AuthGuardian, FederatedBudget, QualityGateAgent, all exports
  • security.ts — Security module: SecureTokenManager, InputSanitizer, RateLimiter, DataEncryptor, SecureAuditLogger
  • lib/locked-blackboard.ts — LockedBlackboard with atomic propose → validate → commit and file-system mutex
  • lib/fsm-journey.ts — JourneyFSM behavioral control plane
  • lib/compliance-monitor.ts — Real-time agent behavior surveillance
  • lib/adapter-hooks.ts — AdapterHookManager: beforeExecute/afterExecute/onError lifecycle hooks + matcher-based filtering
  • lib/skill-composer.ts — SkillComposer: chain/batch/loop/verify meta-operations
  • lib/semantic-search.ts — SemanticMemory: BYOE vector store with cosine similarity
  • lib/phase-pipeline.ts — PhasePipeline: multi-phase workflows with approval gates
  • lib/confidence-filter.ts — ConfidenceFilter: multi-agent result scoring and filtering
  • lib/fan-out.ts — FanOutFanIn: parallel agent spawning with pluggable aggregation
  • lib/agent-runtime.ts — AgentRuntime: sandboxed execution with SandboxPolicy, ShellExecutor, FileAccessor, ApprovalGate
  • lib/console-ui.ts — ConsoleUI: interactive terminal dashboard with ANSI TUI
  • lib/strategy-agent.ts — StrategyAgent: meta-orchestrator with AgentPool, WorkloadPartitioner, adaptive scaling
  • lib/goal-decomposer.ts — GoalDecomposer, TeamRunner, runTeam: LLM-powered goal → task DAG → parallel execution
  • lib/env-manager.ts — EnvironmentManager: promotion chain dev→st→sit→qa→preprod→prod, backup/restore, env diff, NETWORK_AI_ENV routing
  • lib/circuit-breaker.ts — CircuitBreaker CLOSED/OPEN/HALF_OPEN state machine; CircuitOpenError; per-adapter in AdapterRegistry with fallbackChain
  • lib/telemetry-provider.ts — ITelemetryProvider BYOT interface; NullTelemetryProvider, CapturingTelemetryProvider; createOtelHooks() factory for AdapterHookManager
  • lib/claude-hooks.ts — ClaudeHookBridge: AuthGuardian-gated coding-agent tool calls (Claude Code PreToolUse/PostToolUse hooks), observe/enforce modes, network-ai hook CLI
  • lib/mcp-elicitation.ts — StdioElicitationChannel + createElicitationApprovalCallback: native in-client approval prompts over MCP elicitation (fail closed)
  • lib/a2a-server.ts — A2AServer: expose the orchestrator as a Google A2A agent (agent card + tasks/send, Bearer-gated)
  • lib/context-composer.ts — ContextComposer: token-budgeted, relevance-ranked context assembly (semantic/lexical × recency half-life × scope affinity, position-aware layout); estimateTokens()
  • lib/mcp-tools-context.ts — ContextMcpTools: context_pack + blackboard_search MCP tools (signal-over-noise retrieval)
  • adapters/ — 32 framework adapters (LangChain, AutoGen, CrewAI, MCP, Codex, Gemini, OpenAI Responses, Claude Agent SDK, MiniMax, NemoClaw, APS, Hermes, Orchestrator, etc.)
  • bin/cli.ts — CLI entry point (npx network-ai)
  • bin/mcp-server.ts — MCP server (SSE + stdio transport)
  • bin/console.ts — Interactive console with pipe mode (npx network-ai-console)
  • scripts/ — Python helper scripts (blackboard, permissions, token management)
  • types/ — TypeScript declaration files
  • data/ — Runtime data (gitignored): audit log, pending changes

Key Architecture Patterns

  • Blackboard pattern: All agent coordination goes through LockedBlackboard — propose() → validate() → commit() with file-system mutex. Never write directly.
  • Permission gating: AuthGuardian uses weighted scoring (justification 40%, trust 30%, risk 30%). Always require permission before sensitive resource access.
  • Adapter system: All adapters extend BaseAdapter. Each is dependency-free (BYOC — bring your own client). Do not add runtime dependencies to adapters.
  • Audit trail: Every write, permission grant, and state transition is logged to data/audit_log.jsonl via SecureAuditLogger.

Code Conventions

  • TypeScript strict mode, target ES2022
  • No any types — use proper generics or unknown
  • JSDoc on all exported functions and classes
  • No new runtime dependencies without explicit approval
  • Input validation required on all public API entry points
  • Keep adapter files self-contained — no cross-adapter imports

MCP Server

Network-AI exposes 24 tools over MCP (stdio and SSE transports):

# Stdio (for Claude Code / Cursor / Glama):
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | npx network-ai

# SSE:
npx network-ai-server --port 3001

Tools: blackboard_read, blackboard_write, blackboard_list, blackboard_delete, blackboard_exists, budget_status, budget_spend, budget_reset, token_create, token_validate, token_revoke, audit_query, config_get, config_set, agent_list, agent_spawn, agent_stop, fsm_transition, and more.

Security Requirements

  • AES-256-GCM encryption for data at rest
  • HMAC-SHA256 / Ed25519 signed tokens with TTL
  • No hardcoded secrets, keys, or credentials anywhere
  • Path traversal and injection protections on all file operations
  • Rate limiting on all public-facing endpoints

Common Workflows

Adding a new adapter:

  1. Create adapters/<name>-adapter.ts extending BaseAdapter
  2. Implement executeAgent(), getCapabilities(), lifecycle methods
  3. Register in adapters/adapter-registry.ts and adapters/index.ts
  4. Add tests in test-adapters.ts
  5. Update README adapter table

Bumping a version: See RELEASING.md for the full checklist. Key files: package.json, skill.json, openapi.yaml, README.md badge, CHANGELOG.md, SECURITY.md, .github/SECURITY.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.