xiaomo
97840e25ab
chore: add .knowledge/ cards + knowledge.yaml
...
7 curated knowledge cards extracted from RFCs and docs:
- architecture: core pipeline, extension points, process isolation
- sense: compute behavior, Sense→Workflow, config
- workflow: engine, threads, WorkflowSpec
- adapter: AgentFn protocol, available adapters, extract layer
- coding-conventions: functional-first, Result type, naming
- monorepo: package structure, dependency rules
- knowledge-layer: sync/query CLI, embedding service
knowledge.yaml indexes .knowledge/**/*.md only.
2026-04-29 09:29:29 +00:00
xiaomo
526ca68c99
Merge pull request 'refactor: deduplicate spawn-safe into @uncaged/nerve-core' ( #249 ) from fix/247-spawn-safe-dedup into main
2026-04-29 09:17:32 +00:00
小橘 🍊(NEKO Team)
3d02ea20ad
fix(core): consolidate spawn-safe into nerve-core
...
Move spawnSafe, nerveCommandEnv, and related types to @uncaged/nerve-core.
Update adapter-cursor, adapter-hermes, and workflow-utils to consume from core.
Refs #247
Made-with: Cursor
2026-04-29 09:14:28 +00:00
xiaomo
07f1a3d146
Merge pull request 'feat: real embedding integration + remove AgentRegistry ( #244 , #245 )' ( #246 ) from feat/244-phase-c into main
2026-04-29 09:04:41 +00:00
xiaoju
ede59ebcc2
feat(core): remove AgentRegistry, roles declare adapter directly
...
RoleSpec uses adapter: AgentFn; timeouts are configured via adapter factories.
nerve.yaml no longer accepts agents:; extract merge is global to role only.
Added cursorAdapter/hermesAdapter defaults; removed daemon registry and deps.
Signed-off-by: 小橘 🍊 (NEKO Team)
Made-with: Cursor
2026-04-29 08:40:37 +00:00
xiaoju
7de75b5df7
rfc-003: remove timeout from RoleSpec, it's an adapter concern
...
RoleSpec now has exactly 3 fields: adapter, prompt, meta.
Timeout belongs to adapter config — different timeouts = different adapter instances.
Refs #245
小橘 🍊 (NEKO Team)
2026-04-29 08:34:00 +00:00
xiaoju
4be465918c
rfc-003: adapter as direct function reference, not string
...
- RoleSpec.adapter: string → AgentFn (direct import)
- Each adapter exports default instance + factory
- No adapter map, no registry, no lookup — compile-time safety
- TypeScript catches missing adapters at import time
Refs #245
小橘 🍊 (NEKO Team)
2026-04-29 08:23:59 +00:00
xiaoju
732669fab5
rfc-003: simplify agent layer — remove registry, roles declare adapter directly
...
- Remove nerve.yaml agents config (keep only extract + knowledge)
- RoleSpec.agent → RoleSpec.adapter
- buildWorkflowSpec receives adapter map directly
- Extract merge: 3-level → 2-level (global → role)
- Update open questions (embedding service resolved)
小橘 🍊 (NEKO Team)
2026-04-29 08:11:54 +00:00
xiaoju
7bb6990dc5
test(knowledge): update tests for async embed service integration
...
- Mock embed service in sync/query tests (1024-dim vectors)
- Fix Buffer.from for sqlite Uint8Array in loadAllChunks
- Add pretest to workflow-utils for build order
All tests passing.
Refs #234
2026-04-29 07:57:33 +00:00
xiaoju
ce5462cb59
feat(knowledge): integrate real embedding service
...
Replace placeholder fake embeddings with real embed service calls:
- Add embed-service.ts (remote API + cosine similarity + fallback)
- knowledge-db stores externally-provided embeddings
- sync.ts/query.ts now async, call embed service
- CLI commands updated for async API
WIP: tests need updating for async changes
Refs #234
2026-04-29 07:43:05 +00:00
xiaomo
84334b7b09
Merge pull request 'feat: RFC-003 Adapter Plugin Architecture + Dynamic Prompts' ( #243 ) from feat/rfc-003-adapter-packages into main
2026-04-29 07:33:46 +00:00
xiaoju
b7d9a37981
feat: RFC-003 adapter plugin architecture + dynamic prompts
...
AgentRegistry plugin model:
- createAgentRegistry(agents, adapterFactories) — second param for adapter map
- Echo adapter built-in, cursor/hermes via factory injection
- Unknown type throws with available adapter list
Dynamic prompts:
- RoleSpec.prompt: string | ((start, messages) => Promise<string>)
- compileWorkflowSpec handles both static and dynamic prompts
Adapter packages:
- @uncaged/nerve-adapter-cursor — cursor-agent CLI spawn
- @uncaged/nerve-adapter-hermes — hermes CLI subagent spawn
- Each with own spawn-safe (inline, avoids circular dep)
- Moved spawn logic from workflow-utils, kept role factories as thin wrappers
Kernel integration:
- defaultAgentAdapterFactories() registers cursor + hermes
- Hot-reload passes factories on rebuild
Ref: #234
2026-04-29 07:24:19 +00:00
xiaoju
18584641bd
docs(rfc): RFC-003 — adapter packages + dynamic prompts
...
- Adapter packages: each adapter in own package (@nerve/adapter-cursor, etc.)
- AgentRegistry accepts adapter factories at construction (plugin model)
- Migration path: move spawn logic from workflow-utils to adapter packages
- Dynamic prompts: RoleSpec.prompt supports string | async function
- Workspace only installs adapters it uses
Ref: #234
2026-04-29 07:08:34 +00:00
xiaomo
03e9d20501
Merge pull request 'feat: RFC-003 Phase 6 — Knowledge Layer + Review Fixes' ( #242 ) from feat/rfc-003-phase-6-knowledge into main
2026-04-29 06:56:52 +00:00
xiaoju
623fb3cd3a
fix(cli): knowledge query --repo flag, remove -r alias (conflicts with global remote flag)
...
- Rename -r to --repo for knowledge query scope
- Update RFC docs to match
- Fix biome format issues
- Add assertZodMetaSchemas export
- KNOWN_AGENT_ADAPTER_IDS: add cursor/hermes/codex
Self-tested: nerve knowledge sync + query work correctly
2026-04-29 06:02:24 +00:00
xiaoju
62434847c4
feat(cli,core): RFC-003 Phase 6 — Knowledge Layer + review fixes
...
Knowledge Layer:
- knowledge.yaml parser in core (include/exclude globs)
- Chunking: markdown (by heading), TypeScript/JS (by function/block)
- knowledge.db: SQLite storage for chunks + embeddings (node:sqlite)
- CLI: nerve knowledge sync, nerve knowledge query
- Scoping: -r (specific repo), -g (global search), mutually exclusive
- Repo registry (~/.nerve-knowledge-registry.json) for global search
- Placeholder embedding (content hash) until remote service ready
- Word-overlap similarity for query ranking
Review fixes (from PR #241 feedback):
- KNOWN_AGENT_ADAPTER_IDS: add cursor/hermes/codex + sync docs
- collectWorkflowSpecAgentReferences: document regex comment false-positive
- assertZodMetaSchemas: one-time compile-time validation utility
Closes #240
Ref: #234
2026-04-29 05:39:00 +00:00
xiaomo
3d89fc4a7a
Merge pull request 'feat: RFC-003 Agent Configuration Layer (Phase 1-5)' ( #241 ) from feat/rfc-003-phase-1 into main
2026-04-29 05:31:57 +00:00
xiaoju
a1dda1d731
feat(daemon,cli): RFC-003 Phase 5 — Integration (hot-reload + validate)
...
- Kernel: rebuild AgentRegistry on config hot-reload, log agent_registry_reload
- Running threads unaffected, new threads use rebuilt registry
- nerve validate: check agent name refs in WorkflowSpec source files
- nerve validate: verify adapter type is known (KNOWN_AGENT_ADAPTER_IDS)
- nerve validate: require extract config when WorkflowSpec agent refs exist
- Tests: kernel reload (mock), validate (missing/valid/extract/adapter)
Closes #239
Ref: #234
2026-04-29 05:23:59 +00:00
xiaoju
1218b5ddbd
feat(core,daemon): RFC-003 Phase 4 — WorkflowSpec Compiler
...
- WorkflowSpec + RoleSpec types in packages/core
- compileWorkflowSpec: WorkflowSpec → WorkflowDefinition (daemon)
- resolveRoleTimeoutMs: two-level timeout (role override > agent default)
- parseDurationStringToMs extracted to shared duration.ts
- AgentRegistry.getAgentConfig for timeout lookup
- Tests: 10 new cases (compile shape, agent→extract flow, timeout resolution)
- Backward compat: hand-written Role<Meta> unchanged
Closes #238
Ref: #234
2026-04-29 05:11:29 +00:00
xiaoju
136aafa209
feat(workflow-utils): RFC-003 Phase 3 — Extract Layer
...
- llmExtractWithRetry: retry-once on parse failure with error context
- mergeExtractConfig: three-level merge (global → agent → role)
- extractMetaOrThrow + createLlmExtractFn: ExtractFn factory
- ZodMetaSchema bridges core Schema<T> with runtime Zod validation
- Tests: 8 new cases (success/retry/throw/merge/factory)
- core tsconfig: add DOM lib for AbortSignal declaration emit
Closes #237
Ref: #234
2026-04-29 04:59:47 +00:00
xiaoju
88bd30a1e4
feat(daemon): RFC-003 Phase 2 — AgentRegistry + echo adapter
...
- createAgentRegistry(agents) returns { get(name): AgentFn }
- get() throws with agent name in message if not found
- Echo adapter (type: 'echo') returns prompt as-is for testing
- Tests: 5 cases covering get/throw/echo/multi-agent/AbortSignal
Closes #236
Ref: #234
2026-04-29 04:49:22 +00:00
xiaoju
36e5aed1b1
feat(core): RFC-003 Phase 1 — agent config types + nerve.yaml schema
...
- Add AgentFn, WorkflowContext (workdir + AbortSignal), ExtractFn, ExtractError
- Add AgentConfig, ExtractConfig types to NerveConfig
- Extend parseNerveConfig: agents (kebab-case keys) + extract sections
- Export all new types from @nerve/core
- Add config parse tests (7 new tests)
- Update all existing test fixtures with agents/extract fields
Closes #235
Ref: #234
2026-04-29 04:43:08 +00:00
xiaomo
fe90b492c0
Merge pull request 'RFC-003: Agent Configuration Layer' ( #233 ) from rfc/003-agent-config-layer into main
2026-04-29 04:29:46 +00:00
xiaoju
7a4e16381c
docs(rfc): address review — resolve open questions, add error handling/hot-reload/context/validation
...
- model: auto = delegate to adapter's default strategy
- ExtractFn: retry once + throw ExtractError, three-level merge (global → agent → role)
- Agent hot-reload: AgentRegistry rebuilds on config change, running threads unaffected
- WorkflowContext: add workdir + AbortSignal
- Configuration validation: nerve validate checks agent name refs
- WorkflowSpec compile: runtime lazy compile at daemon startup/hot-reload
- Compatibility: existing hand-written Role functions continue to work (not breaking)
- Resolved 3 of 5 open questions, 2 remaining (long-term memory, embedding service)
Refs #233
2026-04-29 04:26:48 +00:00
xiaoju
aecced587c
docs(rfc): knowledge layer — built-in, local-first, repo-scoped
...
Replaces the Alysaril delegation with a built-in knowledge feature:
- knowledge.yaml at repo root with include/exclude
- knowledge.db (SQLite) stores chunks + embeddings locally
- Remote service only for embedding computation + content-hash cache
- In-memory cosine search (sufficient for project scale)
- CLI: nerve knowledge sync/query with -r and -g flags
Refs #233
2026-04-29 04:12:09 +00:00
xiaoju
3950f0e278
docs(rfc): add Knowledge Layer section — delegate to Alysaril
...
Project knowledge is not a nerve feature. Nerve runtime does not hardcode
knowledge paths; loading is a prompt concern. Adds Alysaril as the
independent knowledge base tool.
小橘 <xiaoju@shazhou.work >
2026-04-29 03:25:43 +00:00
xiaoju
ea07c2c667
docs(rfc): RFC-003 agent configuration layer
...
Separates agent infrastructure (nerve.yaml) from workflow business logic.
Key decisions:
- Agent = domain capability, Role = scenario specialization
- Unified AgentFn protocol: (prompt, context) → string
- Independent extract layer for structured output
- Two-layer timeout (agent default, role override)
- No runtime fallback, fail fast
小橘 <xiaoju@shazhou.work >
2026-04-29 01:26:41 +00:00
xiaomo
7afed2aa0d
Merge pull request 'fix(cli): include __start__ message in nerve thread show' ( #232 ) from fix/231-thread-show-start-message into main
2026-04-28 15:36:32 +00:00
xiaoju
ce79dbea7e
fix(cli): include __start__ message in nerve thread show
...
When 'nerve thread show' is called without --before, the initial user
prompt (__start__ message) is now displayed first, followed by the most
recent role rounds within the budget.
- Add getThreadStartMessage() to LogStore
- Modify buildThreadCommandOutput to accept optional startRow
- Pass start message from threadShowCommand when before===0
- Add tests for new behavior
Fixes #231
2026-04-28 15:08:23 +00:00
xiaomo
773a23bf9c
Merge pull request 'feat(cli): init generates pnpm workspace with TypeScript senses' ( #230 ) from feat/229-init-workspace-pnpm into main
2026-04-28 12:34:20 +00:00
xiaoju
2e739bef6e
feat(cli): init generates pnpm workspace with TypeScript senses
...
- Add pnpm-workspace.yaml generation (workflows/*, senses/*)
- Add scripts.build: 'pnpm -r build' to root package.json
- Convert cpu-usage sense from index.js → src/index.ts with types
- Move schema.ts to src/schema.ts
- Add sense-level package.json with esbuild build script
- Run pnpm build after install during init
- Add --ignore-workspace to create sense install
- Update e2e tests for new file structure
Fixes #229
2026-04-28 11:22:31 +00:00
xingyue
a0a91d1699
Merge pull request 'refactor(workflow-utils): reorganize — roles top-level, shared internals in shared/' ( #228 ) from refactor/227-workflow-utils-reorg into main
2026-04-28 08:51:05 +00:00
xiaomo
1a4f94c913
refactor(workflow-utils): reorganize — roles top-level, shared internals in shared/
...
- Split role-factories.ts into role-cursor/hermes/llm/react.ts
- Move shared internals (spawn-safe, cursor-agent, hermes-agent, llm-*, etc.) to shared/
- Absorb start-step.ts (6 lines) into role-types.ts
- Absorb hermes-options.ts into shared/hermes-agent.ts
- Extract formatLlmError into shared/format-error.ts
- Deduplicate cursor merge helpers with generic pick()
- Public API (index.ts exports) unchanged
Fixes #227
2026-04-28 08:47:09 +00:00
xiaomo
984389eb2b
Merge pull request 'feat(cli): scaffold sense as TypeScript + esbuild bundle' ( #226 ) from feat/225-sense-typescript-scaffold into main
2026-04-28 08:37:52 +00:00
xiaoju
8205255c6a
feat(cli): scaffold sense as TypeScript + esbuild bundle
...
- nerve create sense now generates src/index.ts and src/schema.ts
- Adds package.json with esbuild build script
- Runs pnpm install && pnpm build after scaffolding
- Updates nerve-dev skill docs with new sense structure
- Updates tests for new TypeScript scaffold
Fixes #225
2026-04-28 07:42:15 +00:00
xiaomo
814d94f9de
Merge pull request 'fix(workflow-utils): omit --model/--provider when not explicitly set' ( #223 ) from fix/222-hermes-role-no-default-model into main
2026-04-28 07:02:25 +00:00
xiaoju
1efdc4dcd1
fix(workflow-utils): omit --model/--provider when not explicitly set
...
Hermes role defaulted model/provider to 'auto', causing 404 on
custom providers. Now defaults to undefined and only passes
--model/--provider args when explicitly provided.
Fixes #222
2026-04-28 06:52:16 +00:00
xiaoju
8a1d61985d
Merge pull request 'fix(workflow-utils): correct hermes CLI args' ( #220 ) from fix/216-hermes-cli-args into main
2026-04-28 05:28:56 +00:00
xiaomo
1933934340
Merge pull request 'refactor(daemon): workflows must be bundled to dist/, daemon only loads dist/index.js' ( #221 ) from refactor/219-workflow-bundle-dist into main
2026-04-28 05:27:20 +00:00
xiaoju
e56a01d88a
refactor(daemon): workflows must be bundled to dist/, daemon only loads dist/index.js
...
- workflow-worker: loadWorkflowDefinition only looks for dist/index.js
- file-watcher: watch workflows/*/dist/**/*.js instead of *.ts
- file-watcher: sense watch uses .js regex pattern
- nerve create workflow: scaffold includes package.json with esbuild build script
- Updated all related tests
Fixes #219
2026-04-28 05:25:38 +00:00
xiaomo
5a7246cb98
fix(workflow-utils): correct hermes CLI args ( #216 )
...
- 'run' → 'chat' (hermes has no 'run' subcommand)
- '-p' → '-q' (single query mode uses -q/--query)
- '--skill' → '-s' (correct flag is -s/--skills)
2026-04-28 05:18:09 +00:00
xiaomo
bda0c69261
Merge pull request 'fix(daemon): unskip and fix 16 daemon tests' ( #215 ) from fix/213-daemon-tests into main
2026-04-28 04:50:31 +00:00
xingyue
0388c6010a
fix(daemon): unskip and fix 16 daemon tests
...
- kernel-workflow-integration (8): mock children now respond to compute
messages with signal replies, matching real worker behavior
- kernel (2): add ready + compute response to mocks, flush with
runAllTimersAsync
- phase6-integration (3) + kernel-integration (3): replace setInterval
polling with async/await setTimeout loop, increase timeouts
All 165 daemon tests pass, zero skips.
Closes #213
2026-04-28 12:46:12 +08:00
xiaomo
03decf0751
Merge pull request 'feat(cli): nerve init installs @uncaged/nerve-skills and generates agent hints' ( #212 ) from feat/211-init-install-skills into main
2026-04-28 04:35:56 +00:00
xiaomo
c765becc91
Merge pull request 'chore(daemon): skip 16 flaky/broken kernel tests' ( #214 ) from chore/skip-flaky-daemon-tests into main
2026-04-28 04:35:44 +00:00
xiaoju
a03ab64c3e
chore(daemon): skip 16 flaky/broken kernel tests
...
8 flaky tests (worker spawn timing issues):
- phase6-integration: 3 tests
- kernel-integration: 3 tests
- kernel: 2 tests
8 broken tests (routeResult undefined bug):
- kernel-workflow-integration: 8 tests
Tracked in #TBD for proper fix.
2026-04-28 04:32:10 +00:00
xiaoju
c45921cd83
feat(cli): nerve init installs @uncaged/nerve-skills and generates .cursor/rules/nerve-skills.mdc
...
Fixes #211
2026-04-28 04:22:53 +00:00
xiaoju
facb25a959
docs(nerve-dev): update workflow section with role factories, meta routing principle, prompt.ts pattern
...
- Role factory templates (createCursorRole, createHermesRole, createLlmRole, createReActRole)
- Meta = moderator routing only, not data bus between roles
- prompt.ts pure functions instead of readFileSync + prompt.md
- Updated workflow-utils API table
- Real sense-generator example throughout
小橘 🍊 (NEKO Team)
2026-04-28 03:41:47 +00:00
xiaoju
7ee7c4503a
feat(workflow-utils): export readNerveYaml and nerveAgentContext
...
Re-export context helpers from the package entry so consumers can import them from @uncaged/nerve-workflow-utils.
Made-with: Cursor
2026-04-28 02:20:03 +00:00
xiaomo
b4c78a62aa
Merge pull request 'feat(workflow-utils): role factory templates #208 ' ( #209 ) from feat/208-role-factories into main
2026-04-28 01:55:14 +00:00