@kybernesis/brain-llm-claude 0.8.2 → 0.8.3

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -0
  3. package/package.json +3 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kybernesis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @kybernesis/brain-llm-claude
2
+
3
+ [![npm](https://img.shields.io/npm/v/@kybernesis/brain-llm-claude)](https://www.npmjs.com/package/@kybernesis/brain-llm-claude)
4
+
5
+ The default **`LLMProvider`** for [Cortex](../../README.md) — runs Claude through the local
6
+ [`claude` CLI](https://docs.claude.com/en/docs/claude-code) as a subprocess. It powers the
7
+ kernel's reasoning features: relationship and fact extraction, contradiction detection, user
8
+ profiles, and sleep-cycle reasoning.
9
+
10
+ **Used with [`@kybernesis/brain-core`](../brain-core).** It satisfies the `LLMProvider`
11
+ interface; you inject it, the kernel calls `callClaude` / `callClaudeJSON` through it.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ pnpm add @kybernesis/brain-llm-claude @kybernesis/brain-core
17
+ ```
18
+
19
+ Requires the `claude` CLI on `PATH` (authenticated). The kernel works without an LLM seam —
20
+ the reasoning features simply skip — so this provider is optional.
21
+
22
+ ## Usage
23
+
24
+ ```ts
25
+ import { createSubprocessProvider, isClaudeAvailable } from '@kybernesis/brain-llm-claude';
26
+ import { setLLMProvider } from '@kybernesis/brain-core';
27
+
28
+ if (await isClaudeAvailable()) {
29
+ setLLMProvider(createSubprocessProvider());
30
+ }
31
+ // brain-core's LLM-backed steps now run; without it they no-op.
32
+ ```
33
+
34
+ ## Behaviour
35
+
36
+ - Shells out to `claude --print` per call; resolves the model from
37
+ `CLAUDE_MODEL_ALIASES` in [`@kybernesis/brain-contracts`](../brain-contracts).
38
+ - **Never throws into the kernel** — spawn errors, non-zero exits, empty output, and timeouts
39
+ all resolve to `null` (the kernel treats a `null` LLM result as "skip"). Surface failures
40
+ via the `onError` hook (`reason: 'spawn' | 'exit' | 'empty' | 'timeout'`).
41
+ - `timeoutMs` (default `60_000`) sends `SIGTERM` to a hung process so a stuck `claude` can't
42
+ wedge a sleep cycle.
43
+
44
+ ```ts
45
+ setLLMProvider(createSubprocessProvider({
46
+ timeoutMs: 30_000,
47
+ onError: (reason, detail) => log.warn(`claude ${reason}`, detail),
48
+ }));
49
+ ```
50
+
51
+ ## Notes
52
+
53
+ - ESM-only, TypeScript strict.
54
+ - `maxTokens` is not supported by the CLI surface and is documented as a no-op.
55
+ - Part of [Cortex](../../README.md) — `@kybernesis/brain-*`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/brain-llm-claude",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Claude subprocess LLM provider for brain-core",
5
5
  "license": "MIT",
6
6
  "author": "David Cruwys (AppyDave)",
@@ -27,10 +27,10 @@
27
27
  "README.md"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@kybernesis/brain-core": "0.8.2"
30
+ "@kybernesis/brain-core": "0.8.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@kybernesis/brain-core": "0.8.2"
33
+ "@kybernesis/brain-core": "0.8.3"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"