Skip to content

Commit 3f32f6a

Browse files
authored
Neuron redesign/v2 → main (#57)
* feat: Phase 1 — replace neuron v0.3.0 with layer0-based workspace Clear all existing neuron crates and replace with the new 6-layer architecture foundation. Layer 0 (protocol traits) is the first and only workspace member — Layers 1-5 will be added in subsequent phases. - Workspace Cargo.toml with layer0 as sole member - layer0/ crate copied verbatim (112 tests, 4 protocol traits, 2 cross-cutting interfaces, all message types) - docs/architecture/ with all source documents - NEURON-REDESIGN-PLAN.md with full 8-phase implementation plan - DEVELOPMENT-LOG.md with complete decision history - CLAUDE.md with workspace development rules * feat: Phase 2 — add neuron-state-memory and neuron-state-fs (Layer 3) Two StateStore implementations: - neuron-state-memory: HashMap<String, Value> behind RwLock. Scope isolation via composite keys. 15 tests. - neuron-state-fs: filesystem backend, scope → directory, key → JSON file. URL-encoded filenames. Persists across restarts. 15 tests. Both implement layer0::StateStore (and thus StateReader via blanket impl). Both pass object safety, concurrent access, and serde tests. * feat: Phase 3 — add neuron-env-local (Layer 4) Passthrough Environment implementation. Owns Arc<dyn Turn>, delegates directly with no isolation. EnvironmentSpec accepted but ignored. 6 tests covering execution, error propagation, and object safety. * feat: Phase 4 — add neuron-orch-local (Layer 2) In-process Orchestrator implementation. Dispatches turns to registered agents via HashMap. Concurrent dispatch_many via tokio::spawn. No durability, signal/query are no-ops. 9 tests covering dispatch, error propagation, partial failure, and object safety. * feat: Phase 5 — add neuron-hooks (Layer 5) Hook registry and composition. Ordered pipeline that dispatches events at hook points. Short-circuits on Halt/SkipTool/ModifyToolInput. Hook errors are logged but don't halt the pipeline. 8 tests covering dispatch, ordering, halt propagation, point filtering, and error handling. * docs: Phase 6 Turn Implementation Bridge design document Covers crate structure (neuron-turn, neuron-tool, neuron-context, neuron-provider-anthropic), internal types, Provider/ContextStrategy/ToolDyn traits, ReAct loop data flow, effect generation, and layer0 type mappings. Validated against all four source architecture documents. * feat(neuron-tool): add ToolDyn trait, ToolError, and ToolRegistry * feat(neuron-turn): scaffold crate with internal types * feat(neuron-turn): add Provider trait and ProviderError * feat(neuron-turn): add ContextStrategy trait and NeuronTurnConfig * feat(neuron-turn): add bidirectional type conversions (layer0 ↔ internal) * feat(neuron-turn): NeuronTurn struct with full ReAct loop implementing layer0::Turn * feat(neuron-context): add SlidingWindow context strategy * feat(neuron-provider-anthropic): Anthropic Messages API provider + integration tests * docs(neuron-context): fix broken intra-doc link * docs: composable operator architecture design Captures the full architectural redesign from Turn → Operator rename, neuron-turn toolkit split, operator/orchestrator boundary, 23-decision coverage map, distribution model, and provider-specific richness. * docs: composable operator implementation plan 8 phases: A (Turn→Operator rename), B (toolkit split), C (OpenAI+Ollama providers), D (single-shot operator), E (MCP), F (audit), G (API tests), H (proof of concept). * feat: rename Turn → Operator across entire workspace Renames trait Turn to Operator, TurnInput to OperatorInput, TurnOutput to OperatorOutput, TurnConfig to OperatorConfig, TurnMetadata to OperatorMetadata, TurnError to OperatorError, EchoTurn to EchoOperator. Updates all layer0 core files, neuron-env-local, neuron-orch-local, neuron-turn, and all test files. 218 tests pass, clippy clean, docs clean. * fix: update remaining Turn → Operator references in doc comments * refactor: split neuron-turn into toolkit + neuron-op-react neuron-turn is now the shared toolkit (Provider, types, ContextStrategy). The ReAct loop moves to neuron-op-react as ReactOperator<P>. NeuronTurn<P> → ReactOperator<P>, NeuronTurnConfig → ReactConfig. * feat: add neuron-provider-openai with OpenAI-specific features Supports Chat Completions API, string tool arguments, service tiers, reasoning_effort for o-series models, parallel_tool_calls, prompt caching token details. 8 unit tests. * feat: add neuron-provider-ollama with Ollama-specific features Supports /api/chat endpoint, object tool arguments, synthesized tool IDs, nanosecond timing metadata, keep_alive, hardware options. Zero cost for local inference. 10 unit tests. * feat: add neuron-op-single-shot — simplest operator, one model call Single model call, no tools, return immediately. Used for classification, summarization, extraction. 6 unit tests. * build: add nix flake for reproducible rust toolchain Fenix-based dev shell with stable Rust, cargo extensions (watch, edit, deny, audit), treefmt (rustfmt + nixfmt + taplo), and pre-commit hooks. * feat: add neuron-mcp — MCP client and server bridge Client discovers and registers remote MCP tools into ToolRegistry. Server exposes ToolRegistry as MCP tools. Both independently composable. * fix(neuron-mcp): add connect_sse, tighten visibility, improve tests - Add connect_sse() via streamable HTTP transport (supersedes SSE) - Make McpToolWrapper pub(crate) — callers use Arc<dyn ToolDyn> - Fix test names to reflect what they actually verify - Add test for missing description edge case * test: comprehensive coverage audit across all crates * test: cross-provider integration tests + composability proof of concept Cross-provider tests (ignored, need API keys) verify consistent OperatorOutput across Anthropic, OpenAI, and Ollama providers. PoC tests (run without keys) demonstrate provider swap, state swap, operator swap, and multi-agent orchestration patterns. * docs: secrets architecture design — three traits, composable registries, type-level enforcement * docs: secrets implementation plan — 7 phases, 16 new crates * docs: apply 7-point review corrections to secrets design and plan - Move error types out of layer0 into trait crates (neuron-secret, neuron-auth, neuron-crypto) - Add HookAction::ModifyToolOutput variant for RedactionHook - Replace Debug formatting in NoResolver with source_kind() helper - Fix EnvResolver to use SecretSource::Custom instead of OsKeystore - Narrow redaction patterns (AWS, Vault, GitHub only — no generic API key regex) - Remove workspace root dev-deps bloat (each crate tests itself) - RedactionHook returns ModifyToolOutput, not ModifyToolInput * docs: apply review round 2 — crate-local errors, event sink, hook wiring - Define SecretError/AuthError/CryptoError locally in each trait crate (with thiserror), remove all stale layer0::error imports - Add SecretSource::kind() method for telemetry-safe tags (replaces free source_kind() function) - Add SecretEventSink trait and wire into SecretRegistry - Add ModifyToolOutput wiring step in neuron-op-react hook executor - Document v0 scope: PostToolUse redaction only (PostInference later) - Document EnvResolver config schema contract - Fix S1.5 commit to reference hook.rs instead of error.rs * docs: fix credential_name bug, hook semantics, remove stale S7.3 - Add resolve_named(credential_name, source) to SecretRegistry so audit events get the human label, not source.kind() - Keep SecretResolver::resolve() clean (no name awareness in trait) - Document hook executor semantics: short-circuit means first non-Continue wins, Halt always wins, last-writer impossible - Expand S1.2 with exact PostToolUse match block and test requirement - Delete S7.3 (contradicted "no root dev-dep bloat" guidance) * feat(layer0): add secret data types, HookAction::ModifyToolOutput, CredentialRef.source * feat: add neuron-secret — SecretResolver trait, SecretValue, SecretRegistry * feat: add neuron-crypto — CryptoProvider trait for hardware/transit crypto * feat: add neuron-auth — AuthProvider trait, AuthToken, AuthProviderChain * feat: add secret resolver stubs — env, vault, aws, gcp, keystore, k8s * feat: add auth provider stubs — static, oidc, k8s, file * feat: add crypto provider stubs — vault transit, hardware/pkcs11 * feat: add neuron-hook-security — RedactionHook, ExfilGuardHook * fix: inline format arg in neuron-mcp to satisfy clippy * fix: pre-compile ExfilGuardHook regexes, use word boundaries for env detection * docs: add composition proof readiness design and plan * chore: ignore local worktree directory * docs: add redesign specifications * spec: define neuron-orch-kit wiring layer * chore: treefmt * feat: add neuron-orch-kit wiring runner * spec: add brain v1/v2 agentic system * docs: add AGENTS.md and rules stdlib * chore: add ralph loop scaffolding and CI * docs: brain v1 design * feat(brain): add brain v1 crate and looping workers * spec(brain): define v2 research backend contract * docs(spec): link brain v2 research backend spec * feat(brain): add v2 research backend jobs and MCP server * chore: mark brain v2 backend completed in fix_plan * feat(brain): persist v2 jobs and hash artifacts by bytes * spec(brain): define bundle versioning and acquisition roles * feat(brain): harden v2 research backend contract * chore(ci): mark CI queue item complete Verified via: ./scripts/verify.sh * docs: add root README quickstart Verified via: ./scripts/verify.sh * feat(neuron): add umbrella crate Verified via: ./scripts/verify.sh * spec(brain): define factory-ready specpack outputs Verified via: ./scripts/verify.sh * spec(brain): add specpack quality contract Verified via: ./scripts/verify.sh * feat(brain): add specpack tool surface and manifest validation Verified via: ./scripts/verify.sh * feat(brain): enforce SpecPack quality backpressure * spec(brain): add SpecPack traceability feature map * fix(ralph): support claude CLI and model env * chore(ralph): add one-shot runner and bypass permissions * fix(ralph): pass prompt via argv for claude * feat(brain): add artifact_import and artifact_write tools Implements spec/17-brain-artifact-ingest-and-write.md. - artifact_import: ingest source snapshots (utf-8 or base64) into a job directory; validates path traversal, returns sha256 over raw bytes - artifact_write: write/overwrite derived artifacts with same contract - Both tools reject absolute paths and .. traversal - Registered in backend_registry alongside existing artifact_list/read - 7 new offline tests covering: import utf-8, import base64, traversal rejection (both tools), absolute path rejection, overwrite + hash change * chore: mark artifact ingest done, advance queue to traceability * feat(brain): enforce feature_map traceability on specpack_finalize Implements spec 19: specpack_finalize now requires analysis/feature_map.json and validates that every capability_id exists in ledger.json, every spec_refs/trace_refs path exists in the specpack manifest, and every code_refs artifact_path exists in the job artifact index. Three offline tests cover: missing feature map, unknown capability id, and missing artifact ref. * chore: mark specpack traceability done, advance queue to job groups * feat(brain): add job groups and bundle merge Verified via: ./scripts/verify.sh * chore(ralph): improve codex runner and loop exit Verified via: ./scripts/verify.sh * chore(ralph): auto-commit after each iteration Verified via: ./scripts/verify.sh * chore(ralph): require worktree by default Verified via: ./scripts/verify.sh * chore(ralph): add worktree bootstrap wrapper Verified via: ./scripts/verify.sh * chore(verify): enforce workspace-wide gates - Run tests/clippy with --workspace --all-targets\n- Fix verify formatting check to be idempotence-based\n- Add minimal brain offline testing harness needed by workspace tests\n\nVerified via: ./scripts/verify.sh * docs(arch): clarify neuron vs platform scope - Add platform scope mapping and trend coverage\n- Link from architecture docs and update required reading\n- Add review rule for Ralph worktrees\n- Fix stale note about neuron-orch-kit existence\n\nVerified via: ./scripts/verify.sh * chore(ralph): rename fix_plan queue to ralph_queue Verified via: ./scripts/verify.sh * feat(orchestration): complete local signal/query semantics and effect pipeline proof * docs(orchestration): fix LocalOrch workflow tracking comment * chore(fmt): rustfmt * chore(ralph): improve empty-queue detection Verified via: ./scripts/verify.sh * fix(ralph): queue parsing on macOS awk Verified via: ./scripts/verify.sh * fix(ralph): correctly detect numbered queue items Verified via: ./scripts/verify.sh * feat(env-local): add local credential resolution and audit pipeline * chore(ralph): auto-commit 2026-02-28T00:40:56Z Verified via: ./scripts/verify.sh * feat: add agent memory system design (Hybrid GraphRAG on CozoDB) Design doc for neuron-state-graph crate implementing StateStore backed by CozoDB with Hybrid GraphRAG retrieval. Covers schema (5-layer, ~20 node types), retrieval pipeline (HNSW + BM25 → graph expand → RRF + MMR in Rust), scope isolation, compaction via sleep-time compute, and multi-agent memory sharing for research→spec→build pipelines. * feat: add neuron-state-graph implementation plan 16-task TDD implementation plan for CozoDB-backed StateStore with Hybrid GraphRAG retrieval. Covers crate skeleton, schema types, CozoDB engine wrapper, StateStore CRUD, graph operations, FTS, HNSW vector search, RRF+MMR retrieval pipeline, extension trait, effect variants, compaction, and integration tests. * chore: add deny.toml and .lychee.toml * fix(docs): update stale references in validation-and-coordination.md * chore: restore LICENSE and community files * docs: rewrite llms.txt for 6-layer architecture * docs(book): rewrite mdbook for redesign/v2 architecture * ci: add coverage, security, deny, links, and MSRV jobs * fix: add CDLA-Permissive-2.0 to deny.toml and allow workspace wildcards * fix: exclude target/ from lychee and accept valid HTTP ranges * chore: replace git-hooks.nix + pre-commit with prek - Remove git-hooks-nix flake input (drops Python pre-commit dependency) - Add prek (Rust pre-commit runner) to devShell - Hand-write .pre-commit-config.yaml with 4 hooks: - pre-commit: treefmt, clippy - pre-push: cargo test, cargo doc - Auto-install hooks on nix develop via shellHook * chore: remove brain crate and all brain-related content Brain has been extracted into a separate repository. This removes: - brain/ crate (source, tests, fixtures) - Brain specs (14–19) - Brain plan documents - Brain references in README, SPECS.md, rules, and PROMPT.md Also includes AliasedTool in neuron-tool and discover_tools_with_aliases in neuron-mcp, which were developed alongside the extraction. * chore: upgrade to Rust edition 2024 + resolver 3 - Update workspace and 8 crates from edition 2021 → 2024 - Update resolver 2 → 3 - Add rust-version = 1.85 to workspace - Fix unsafe set_var/remove_var (edition 2024 requirement) - Fix collapsible_if lints (edition 2024 default) * ci: restore docs, publish, and release-please workflows - docs.yml: mdbook deploy to GitHub Pages - publish.yml: manual cargo publish with topo-sorted crate order - release-please.yml: automated release PRs + publish - release-please-config.json: all 33 workspace crates registered - .release-please-manifest.json: initial versions at 0.1.0 * docs: clean up ralph_queue, mark redesign plan as historical, update llms.txt - Remove completed brain items referencing deleted specs from ralph_queue - Add deprecation header to NEURON-REDESIGN-PLAN.md - Update llms.txt reading order to point to specs and book first * chore: add per-crate READMEs, categories, keywords; bump all to v0.4.0 All 33 crates: - README.md added with badges, overview, usage examples, and feature flag tables - categories and keywords added to [package] in Cargo.toml - readme = "README.md" registered in [package] - All workspace fields normalized (license/repository/homepage.workspace = true) - version bumped 0.1.0 → 0.4.0 (avoids conflict with published v0.3.x on crates.io) - .release-please-manifest.json updated to 0.4.0 - neuron umbrella crate gains description field * chore(release): bump to 1.0.0-alpha.1; split effects; add turn-kit; docs+workflow fixes; publish dry-run prep * chore(release): add PR body draft * chore(release): set version to 0.4.0; update PR body * ci: fix link-check pre-publish excludes; apply treefmt * ci: merge lychee excludes into single array * ci: lychee exclude platform.openai; apply treefmt * ci: retrigger * ci: consolidate lychee excludes (platform.openai) * ci(fmt): treefmt normalized .lychee.toml * ci: use nix fmt + git diff for Nix format check * ci: retrigger after format-step fix * ci: rename workflow to lowercase to satisfy required context * ci: add aggregator job named ci to satisfy required context * ci: aggregator runs with if: always()
1 parent 4fb8c0d commit 3f32f6a

File tree

498 files changed

+48647
-51604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

498 files changed

+48647
-51604
lines changed

.claude/skills/doc-audit/SKILL.md

Lines changed: 0 additions & 123 deletions
This file was deleted.

.claude/skills/test-audit/SKILL.md

Lines changed: 0 additions & 165 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ labels: bug
66

77
## Crate
88

9-
Which crate is affected? (e.g., neuron-types, neuron-loop)
9+
Which crate is affected? (e.g., layer0, neuron-tool, neuron-orch-local, neuron-provider-anthropic)
1010

1111
## Version
1212

13-
What version are you using? (`cargo tree -p neuron-types` to check)
13+
What version are you using? (`cargo tree -p neuron` to check)
1414

1515
## Description
1616

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ What other approaches did you consider?
2222

2323
## Which Crate?
2424

25-
Where should this live? (e.g., neuron-types, neuron-tool, new crate)
25+
Where should this live? (e.g., layer0, neuron-tool, neuron-orch-local, new crate)

0 commit comments

Comments
 (0)