@honcho-ai/claude-honcho 0.3.1 → 0.3.2

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 (61) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +95 -12
  3. package/dist/chunk-1nsms6f4.js +50 -0
  4. package/dist/chunk-1nsms6f4.js.map +10 -0
  5. package/dist/{chunk-jr0fd6n2.js → chunk-1xa1wr00.js} +2 -2
  6. package/dist/{chunk-9pntsn3x.js → chunk-43gww8dc.js} +1 -1
  7. package/dist/chunk-81cb25yy.js +35 -0
  8. package/dist/{chunk-6yybt92z.js.map → chunk-81cb25yy.js.map} +1 -1
  9. package/dist/{chunk-yfrrc1d5.js → chunk-acwn3613.js} +64 -106
  10. package/dist/chunk-acwn3613.js.map +13 -0
  11. package/dist/{chunk-49wja30f.js → chunk-d99xh4kg.js} +1 -1
  12. package/dist/{chunk-xdntcesh.js → chunk-g0m354bn.js} +758 -210
  13. package/dist/{chunk-xdntcesh.js.map → chunk-g0m354bn.js.map} +8 -4
  14. package/dist/{chunk-4ryv9310.js → chunk-mm5vjhpr.js} +240 -210
  15. package/dist/{chunk-4ryv9310.js.map → chunk-mm5vjhpr.js.map} +2 -2
  16. package/dist/{chunk-d2gc13m0.js → chunk-pdnbydfe.js} +10 -12
  17. package/dist/{chunk-d2gc13m0.js.map → chunk-pdnbydfe.js.map} +2 -2
  18. package/dist/{chunk-xtdvbfxw.js → chunk-qp4ng9m0.js} +6 -6
  19. package/dist/{chunk-xtdvbfxw.js.map → chunk-qp4ng9m0.js.map} +2 -2
  20. package/dist/{chunk-4zgbdwm4.js → chunk-w3tnmcx7.js} +6 -6
  21. package/dist/{chunk-4zgbdwm4.js.map → chunk-w3tnmcx7.js.map} +1 -1
  22. package/dist/hooks/post-tool-use.js +22 -21
  23. package/dist/hooks/post-tool-use.js.map +3 -3
  24. package/dist/hooks/pre-compact.js +21 -65
  25. package/dist/hooks/pre-compact.js.map +3 -4
  26. package/dist/hooks/pre-tool-honcho.js +5 -5
  27. package/dist/hooks/pre-tool-honcho.js.map +1 -1
  28. package/dist/hooks/save-user-message.js +45 -27
  29. package/dist/hooks/save-user-message.js.map +4 -3
  30. package/dist/hooks/session-end.js +13 -13
  31. package/dist/hooks/session-end.js.map +2 -2
  32. package/dist/hooks/session-start.js +38 -38
  33. package/dist/hooks/session-start.js.map +2 -2
  34. package/dist/hooks/stop.js +20 -20
  35. package/dist/hooks/stop.js.map +1 -1
  36. package/dist/hooks/user-prompt.js +367 -10
  37. package/dist/hooks/user-prompt.js.map +5 -3
  38. package/dist/mcp-server.js +550 -739
  39. package/dist/mcp-server.js.map +3 -3
  40. package/dist/skills/backfill-runner.js +545 -47
  41. package/dist/skills/backfill-runner.js.map +9 -4
  42. package/dist/skills/setup-runner.js +47 -194
  43. package/dist/skills/setup-runner.js.map +4 -6
  44. package/dist/skills/status-runner.js +16 -17
  45. package/dist/skills/status-runner.js.map +2 -2
  46. package/package.json +1 -1
  47. package/dist/chunk-084dpgp3.js +0 -556
  48. package/dist/chunk-084dpgp3.js.map +0 -10
  49. package/dist/chunk-6yybt92z.js +0 -106
  50. package/dist/chunk-dxbm7kmf.js +0 -331
  51. package/dist/chunk-dxbm7kmf.js.map +0 -10
  52. package/dist/chunk-gnp95nzg.js +0 -438
  53. package/dist/chunk-gnp95nzg.js.map +0 -12
  54. package/dist/chunk-jgtvcc65.js +0 -90
  55. package/dist/chunk-jgtvcc65.js.map +0 -10
  56. package/dist/chunk-wm6hvkcv.js +0 -245
  57. package/dist/chunk-wm6hvkcv.js.map +0 -10
  58. package/dist/chunk-yfrrc1d5.js.map +0 -12
  59. /package/dist/{chunk-jr0fd6n2.js.map → chunk-1xa1wr00.js.map} +0 -0
  60. /package/dist/{chunk-9pntsn3x.js.map → chunk-43gww8dc.js.map} +0 -0
  61. /package/dist/{chunk-49wja30f.js.map → chunk-d99xh4kg.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honcho",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Persistent memory for Claude Code sessions using Honcho by Plastic Labs",
5
5
  "author": {
6
6
  "name": "Plastic Labs",
package/README.md CHANGED
@@ -44,9 +44,10 @@ Give Claude Code long-term memory that survives context wipes, session restarts,
44
44
 
45
45
  ## Prerequisites
46
46
 
47
- A Honcho API key from [app.honcho.dev](https://app.honcho.dev). Nothing else --
48
- the plugin ships as a self-contained bundle and runs on the Node runtime Claude
49
- Code already provides.
47
+ - A Honcho API key from [app.honcho.dev](https://app.honcho.dev)
48
+ - [Node.js](https://nodejs.org) on your PATH
49
+
50
+ The plugin ships as a self-contained bundle -- no other dependencies needed.
50
51
 
51
52
  ## Quick Start
52
53
 
@@ -120,7 +121,7 @@ to the peer name you chose in your environment: it will carry across different p
120
121
  - **Git Awareness** — Detects branch switches, commits, and changes made outside Claude
121
122
  - **Flexible Sessions** — Map sessions per directory, per git branch, or per chat instance
122
123
  - **AI Self-Awareness** — Claude knows what it was working on, even after restarts
123
- - **Cross-Tool Context** — Link workspaces across Claude Code, Cursor, and other hosts so context flows between tools
124
+ - **Configurable Memory Injection** — Choose exactly what context is injected at session start and per turn
124
125
  - **Team Support** — Multiple people can share a workspace and build context together
125
126
  - **MCP Tools** — Search memory, query knowledge about you, and save insights
126
127
 
@@ -128,13 +129,20 @@ to the peer name you chose in your environment: it will carry across different p
128
129
 
129
130
  The honcho plugin provides these tools via MCP:
130
131
 
131
- | Tool | Description |
132
- | ------------------- | ------------------------------------------------ |
133
- | `search` | Semantic search across session messages |
134
- | `chat` | Query Honcho's knowledge about the user |
135
- | `create_conclusion` | Save insights about the user to memory |
136
- | `get_config` | View current configuration and status |
137
- | `set_config` | Change any configuration field programmatically |
132
+ | Tool | Description |
133
+ | -------------------- | -------------------------------------------------------------- |
134
+ | `search` | Semantic search across session messages and saved conclusions |
135
+ | `chat` | Query Honcho's knowledge about the user (dialectic reasoning) |
136
+ | `create_conclusion` | Save insights about the user to memory |
137
+ | `list_conclusions` | List saved conclusions |
138
+ | `query_conclusions` | Semantic search over saved conclusions |
139
+ | `delete_conclusion` | Delete a conclusion by ID |
140
+ | `get_briefing` | Load the session briefing: session summary + peer card |
141
+ | `get_context` | Retrieve the full context object (representation + peer card) |
142
+ | `get_representation` | Retrieve the user's representation string |
143
+ | `get_config` | View current configuration and status |
144
+ | `set_config` | Change any configuration field programmatically |
145
+ | `honcho_remember` | Fan-out dialectic recall (only registered when `rememberTool: true`) |
138
146
 
139
147
  ## Skills
140
148
 
@@ -144,6 +152,7 @@ The honcho plugin provides these tools via MCP:
144
152
  | `/honcho:config` | Interactive configuration menu |
145
153
  | `/honcho:setup` | First-time setup — validate API key and create config |
146
154
  | `/honcho:interview` | Interview to capture stable, cross-project user preferences |
155
+ | `/honcho:briefing` | Load the session briefing via a visible tool call |
147
156
  | `/honcho:import` | Backfill past Claude Code sessions into Honcho memory |
148
157
  | `/honcho:insights` | Distill memory into CLAUDE.md edits, style rules, skill ideas |
149
158
 
@@ -181,6 +190,8 @@ All configuration lives in a single global file at `~/.honcho/config.json`. You
181
190
 
182
191
  // Message handling
183
192
  "saveMessages": true,
193
+ "saveToolUse": false, // Save [Tool] action summaries (default: false)
194
+ "saveGitEvents": false, // Save [Git External] state-change events (default: false)
184
195
  "messageUpload": {
185
196
  "maxUserTokens": null, // Truncate user messages (null = no limit)
186
197
  "maxAssistantTokens": null, // Truncate assistant messages (null = no limit)
@@ -193,6 +204,16 @@ All configuration lives in a single global file at `~/.honcho/config.json`. You
193
204
  "ttlSeconds": 300, // Cache TTL for context
194
205
  "skipDialectic": false // Skip dialectic chat() calls in user-prompt hook
195
206
  },
207
+ "reasoningLevel": "medium", // Default dialectic reasoning tier: "minimal" | "low" | "medium" | "high" | "max"
208
+
209
+ // Memory injection (see "Memory Injection" below)
210
+ "injection": {
211
+ "sessionStart": ["directives", "summary", "peerCard"],
212
+ "perTurn": ["userContext"]
213
+ },
214
+
215
+ // On-demand recall tool (see "The honcho_remember Tool" below)
216
+ "rememberTool": false,
196
217
 
197
218
  // Observation mode
198
219
  "observationMode": "unified", // "unified" (default) | "directional"
@@ -204,7 +225,8 @@ All configuration lives in a single global file at `~/.honcho/config.json`. You
204
225
  },
205
226
 
206
227
  // Miscellaneous
207
- "localContext": { "maxEntries": 50 }, // Max entries in claude-context.md
228
+ "redactPatterns": [], // Extra regexes redacted from tool summaries (additive to built-in secret patterns)
229
+ "statusline": "on", // Memory statusline visibility: "on" | "off"
208
230
  "enabled": true,
209
231
  "logging": true,
210
232
 
@@ -223,6 +245,67 @@ Session strategy controls how Honcho maps your conversations to sessions. Change
223
245
  | `git-branch` | Session name includes the current git branch. Switching branches switches sessions. | Feature-branch workflows where context per branch matters |
224
246
  | `chat-instance` | Each Claude Code chat gets its own session. No continuity between restarts. | Ephemeral usage, experimentation, or when you want a clean slate each time |
225
247
 
248
+ ### Memory Injection
249
+
250
+ The `injection` config block controls exactly what memory is injected into Claude's context, on two surfaces: **once at session start** and **per prompt**. Each surface selects zero or more components; retrieval knobs shape what those components emit. Configure it with `/honcho:config` (memory injection settings), `set_config`, or by editing `~/.honcho/config.json`.
251
+
252
+ **Session-start components** (default: `["directives", "summary", "peerCard"]`):
253
+
254
+ | Component | What it injects |
255
+ | --- | --- |
256
+ | `directives` | Static memory-usage guidance — treat injected memory as background, use `chat`/`search` for recall, save insights with `create_conclusion` |
257
+ | `summary` | The session's long summary narrative (skipped on a fresh session) |
258
+ | `peerCard` | Your peer card — a structured identity/attribute list |
259
+ | `peerRepresentation` | Your full derived representation, injected at full length |
260
+ | `briefing` | A nudge for Claude to call the `get_briefing` MCP tool instead of injecting the summary and peer card inline — the tool call renders as an expandable row in the UI. Use it *in place of* `summary`/`peerCard`, not alongside them |
261
+
262
+ **Per-turn components** (default: `["userContext"]`):
263
+
264
+ | Component | What it injects |
265
+ | --- | --- |
266
+ | `userContext` | A fresh, prompt-scoped context fetch for *you* — conclusions selected by semantic search, shaped by the retrieval knobs below |
267
+ | `assistantContext` | The same context fetch for the AI peer — what Honcho has derived about the assistant itself |
268
+ | `sessionContext` | Recent raw messages from the currently mapped Honcho session, which can span other Claude instances sharing the session name |
269
+ | `dialectic` | A reasoned `chat()` answer over your representation, seeded from `dialecticTemplate`. Off by default — much slower than a context fetch |
270
+
271
+ **Retrieval knobs:**
272
+
273
+ | Field | Default | Description |
274
+ | --- | --- | --- |
275
+ | `searchTopK` | `10` | Top-K conclusions pulled by the context fetch's semantic search |
276
+ | `maxConclusions` | `15` | Max conclusions injected per context fetch |
277
+ | `searchMaxDistance` | `0.6` | Max cosine distance for the semantic search — lower is stricter |
278
+ | `searchQuerySource` | `"prompt"` | What drives the per-turn search: the raw `"prompt"` or extracted `"topics"` |
279
+ | `sessionContextTokens` | `1500` | Token budget for the `sessionContext` message fetch |
280
+ | `dialecticTemplate` | compact factual recall | Query template for the `dialectic` component; the prompt is substituted into `%{user_query}` |
281
+ | `dialecticReasoning` | `"medium"` | Reasoning tier for the per-turn `dialectic` call — separate from the top-level `reasoningLevel` |
282
+
283
+ If injected context feels off-topic, lower `searchMaxDistance`; if too sparse, raise it or bump `searchTopK`.
284
+
285
+ **Visibility:** per-turn components report a one-line summary in the terminal by default. To print a component's full injected payload, list it in `showContents`:
286
+
287
+ ```json
288
+ { "injection": { "showContents": ["userContext", "sessionContext"] } }
289
+ ```
290
+
291
+ ### The `honcho_remember` Tool
292
+
293
+ An experimental on-demand recall tool. When enabled, Claude gets a `honcho_remember` MCP tool that fans out up to 5 parallel dialectic queries about you and returns per-question answers — useful before starting a task, when catching up ("where were we?"), or whenever your history could shape the response.
294
+
295
+ To enable it, just ask Claude: *"Set my Honcho rememberTool config to true"* (it uses the `set_config` tool). Or set it in `~/.honcho/config.json`:
296
+
297
+ ```json
298
+ {
299
+ "hosts": {
300
+ "claude_code": { "rememberTool": true }
301
+ }
302
+ }
303
+ ```
304
+
305
+ Then restart Claude Code — MCP tools register at startup.
306
+
307
+ When it's on, the injected session-start directives steer Claude to use it proactively as the primary recall path.
308
+
226
309
  ### Observation Mode
227
310
 
228
311
  Controls how Honcho stores and retrieves conclusions about you. Change it via `set_config` or edit `config.json` directly. Requires a Claude Code restart.
@@ -0,0 +1,50 @@
1
+ // src/redact.ts
2
+ var DEFAULT_RULES = [
3
+ {
4
+ pattern: /\b(\w*(?:PASSWORD|PASSWD|PWD|SECRET|TOKEN|API_?KEY|ACCESS_KEY|CREDENTIALS?)\w*)\s*=\s*("[^"]*"|'[^']*'|[^\s;|&"']+)/gi,
5
+ replacement: "$1=***"
6
+ },
7
+ {
8
+ pattern: /(--(?:password|passwd|pwd|token|api-?key|secret|auth)[= ])(?:"[^"]*"|'[^']*'|[^\s;|&"']+)/gi,
9
+ replacement: "$1***"
10
+ },
11
+ {
12
+ pattern: /(authorization:\s*(?:bearer|basic|token)\s+)[^\s"']+/gi,
13
+ replacement: "$1***"
14
+ },
15
+ {
16
+ pattern: /([a-z][a-z0-9+.-]*:\/\/[^/\s:@]+:)[^@\s]+@/gi,
17
+ replacement: "$1***@"
18
+ },
19
+ {
20
+ pattern: /\b(?:hch[_-]?[A-Za-z0-9_-]{16,}|AKIA[0-9A-Z]{16}|sk-[A-Za-z0-9_-]{16,}|(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|glpat-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36})\b/g,
21
+ replacement: "***"
22
+ }
23
+ ];
24
+ function validateRedactPattern(source) {
25
+ try {
26
+ new RegExp(source);
27
+ return null;
28
+ } catch (e) {
29
+ return `Invalid regex ${JSON.stringify(source)}: ${e instanceof Error ? e.message : String(e)}`;
30
+ }
31
+ }
32
+ function redactSecrets(text, extraPatterns) {
33
+ let result = text;
34
+ for (const rule of DEFAULT_RULES) {
35
+ result = result.replace(rule.pattern, rule.replacement);
36
+ }
37
+ for (const source of extraPatterns ?? []) {
38
+ try {
39
+ result = result.replace(new RegExp(source, "gi"), "***");
40
+ } catch {
41
+ continue;
42
+ }
43
+ }
44
+ return result;
45
+ }
46
+
47
+ export { validateRedactPattern, redactSecrets };
48
+
49
+ //# debugId=69506780623A432464756E2164756E21
50
+ //# sourceMappingURL=chunk-1nsms6f4.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/redact.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Best-effort secret redaction for tool-capture summaries.\n * Regex-based, so novel secret formats pass through; users extend the\n * defaults via the `redactPatterns` config.\n */\n\ninterface RedactRule {\n pattern: RegExp;\n replacement: string;\n}\n\nconst DEFAULT_RULES: RedactRule[] = [\n // KEY=value assignments with a secret-bearing key (PGPASSWORD=..., AWS_SECRET_ACCESS_KEY=...)\n {\n pattern: /\\b(\\w*(?:PASSWORD|PASSWD|PWD|SECRET|TOKEN|API_?KEY|ACCESS_KEY|CREDENTIALS?)\\w*)\\s*=\\s*(\"[^\"]*\"|'[^']*'|[^\\s;|&\"']+)/gi,\n replacement: \"$1=***\",\n },\n // --password / --token style CLI flags\n {\n pattern: /(--(?:password|passwd|pwd|token|api-?key|secret|auth)[= ])(?:\"[^\"]*\"|'[^']*'|[^\\s;|&\"']+)/gi,\n replacement: \"$1***\",\n },\n // Authorization headers\n {\n pattern: /(authorization:\\s*(?:bearer|basic|token)\\s+)[^\\s\"']+/gi,\n replacement: \"$1***\",\n },\n // Credentials embedded in URLs (scheme://user:pass@host)\n {\n pattern: /([a-z][a-z0-9+.-]*:\\/\\/[^/\\s:@]+:)[^@\\s]+@/gi,\n replacement: \"$1***@\",\n },\n // Well-known token shapes: Honcho, AWS, OpenAI/Anthropic-style sk-, GitHub, Slack, GitLab, npm\n {\n pattern: /\\b(?:hch[_-]?[A-Za-z0-9_-]{16,}|AKIA[0-9A-Z]{16}|sk-[A-Za-z0-9_-]{16,}|(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|glpat-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36})\\b/g,\n replacement: \"***\",\n },\n];\n\n/**\n * Validate a user-supplied pattern string. Returns an error message, or null\n * if it compiles. Used by set_config so bad regexes are rejected at write time.\n */\nexport function validateRedactPattern(source: string): string | null {\n try {\n new RegExp(source);\n return null;\n } catch (e) {\n return `Invalid regex ${JSON.stringify(source)}: ${e instanceof Error ? e.message : String(e)}`;\n }\n}\n\n/**\n * Redact secrets from `text`. `extraPatterns` (from config `redactPatterns`)\n * are additive to the built-in defaults; matches are replaced whole with ***.\n * Patterns that fail to compile are skipped — set_config validates on write,\n * so this only guards hand-edited config files.\n */\nexport function redactSecrets(text: string, extraPatterns?: string[]): string {\n let result = text;\n for (const rule of DEFAULT_RULES) {\n result = result.replace(rule.pattern, rule.replacement);\n }\n for (const source of extraPatterns ?? []) {\n try {\n result = result.replace(new RegExp(source, \"gi\"), \"***\");\n } catch {\n continue;\n }\n }\n return result;\n}\n"
6
+ ],
7
+ "mappings": ";AAWA,IAAM,gBAA8B;AAAA,EAElC;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AACF;AAMO,SAAS,qBAAqB,CAAC,QAA+B;AAAA,EACnE,IAAI;AAAA,IACF,IAAI,OAAO,MAAM;AAAA,IACjB,OAAO;AAAA,IACP,OAAO,GAAG;AAAA,IACV,OAAO,iBAAiB,KAAK,UAAU,MAAM,MAAM,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AAAA;AAAA;AAUzF,SAAS,aAAa,CAAC,MAAc,eAAkC;AAAA,EAC5E,IAAI,SAAS;AAAA,EACb,WAAW,QAAQ,eAAe;AAAA,IAChC,SAAS,OAAO,QAAQ,KAAK,SAAS,KAAK,WAAW;AAAA,EACxD;AAAA,EACA,WAAW,UAAU,iBAAiB,CAAC,GAAG;AAAA,IACxC,IAAI;AAAA,MACF,SAAS,OAAO,QAAQ,IAAI,OAAO,QAAQ,IAAI,GAAG,KAAK;AAAA,MACvD,MAAM;AAAA,MACN;AAAA;AAAA,EAEJ;AAAA,EACA,OAAO;AAAA;",
8
+ "debugId": "69506780623A432464756E2164756E21",
9
+ "names": []
10
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isLoggingEnabled
3
- } from "./chunk-yfrrc1d5.js";
3
+ } from "./chunk-acwn3613.js";
4
4
 
5
5
  // src/log.ts
6
6
  import { homedir } from "os";
@@ -178,4 +178,4 @@ function logAsync(operation, message, results) {
178
178
  export { blocks, circles, stars, braille, brackets, symbols, arrows, setLogContext, logHook, logApiCall, logFlow, logAsync };
179
179
 
180
180
  //# debugId=ACAEB76FCF128E0164756E2164756E21
181
- //# sourceMappingURL=chunk-jr0fd6n2.js.map
181
+ //# sourceMappingURL=chunk-1xa1wr00.js.map
@@ -32,4 +32,4 @@ function clearSessionFiles(sessionId) {
32
32
  export { setMemoryState, setSessionLink, clearSessionFiles };
33
33
 
34
34
  //# debugId=CF0B8025EA4748F964756E2164756E21
35
- //# sourceMappingURL=chunk-9pntsn3x.js.map
35
+ //# sourceMappingURL=chunk-43gww8dc.js.map
@@ -0,0 +1,35 @@
1
+ import {
2
+ setDetectedHost2,
3
+ getConfigDir2,
4
+ getConfigPath2,
5
+ configExists2,
6
+ loadConfig2,
7
+ loadConfigFromEnv2,
8
+ saveConfig2,
9
+ saveRootField2,
10
+ getClaudeSettingsPath2,
11
+ getClaudeSettingsDir2,
12
+ getSessionName2,
13
+ getContextRefreshConfig2,
14
+ getHonchoClientOptions2,
15
+ getEndpointInfo2
16
+ } from "./chunk-g0m354bn.js";
17
+ export {
18
+ configExists2 as configExists,
19
+ getClaudeSettingsDir2 as getClaudeSettingsDir,
20
+ getClaudeSettingsPath2 as getClaudeSettingsPath,
21
+ getConfigDir2 as getConfigDir,
22
+ getConfigPath2 as getConfigPath,
23
+ getContextRefreshConfig2 as getContextRefreshConfig,
24
+ getEndpointInfo2 as getEndpointInfo,
25
+ getHonchoClientOptions2 as getHonchoClientOptions,
26
+ getSessionName2 as getSessionName,
27
+ loadConfig2 as loadConfig,
28
+ loadConfigFromEnv2 as loadConfigFromEnv,
29
+ saveConfig2 as saveConfig,
30
+ saveRootField2 as saveRootField,
31
+ setDetectedHost2 as setDetectedHost
32
+ };
33
+
34
+ //# debugId=A9EEEEAAE85E8F7464756E2164756E21
35
+ //# sourceMappingURL=chunk-81cb25yy.js.map
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "74FE6A08FB8BBD3464756E2164756E21",
7
+ "debugId": "A9EEEEAAE85E8F7464756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -1,48 +1,3 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- function __accessProp(key) {
7
- return this[key];
8
- }
9
- var __toESMCache_node;
10
- var __toESMCache_esm;
11
- var __toESM = (mod, isNodeMode, target) => {
12
- var canCache = mod != null && typeof mod === "object";
13
- if (canCache) {
14
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
- var cached = cache.get(mod);
16
- if (cached)
17
- return cached;
18
- }
19
- target = mod != null ? __create(__getProtoOf(mod)) : {};
20
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
- for (let key of __getOwnPropNames(mod))
22
- if (!__hasOwnProp.call(to, key))
23
- __defProp(to, key, {
24
- get: __accessProp.bind(mod, key),
25
- enumerable: true
26
- });
27
- if (canCache)
28
- cache.set(mod, to);
29
- return to;
30
- };
31
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
32
- var __returnValue = (v) => v;
33
- function __exportSetter(name, newValue) {
34
- this[name] = __returnValue.bind(null, newValue);
35
- }
36
- var __export = (target, all) => {
37
- for (var name in all)
38
- __defProp(target, name, {
39
- get: all[name],
40
- enumerable: true,
41
- configurable: true,
42
- set: __exportSetter.bind(all, name)
43
- });
44
- };
45
-
46
1
  // src/config.ts
47
2
  import { homedir as homedir2 } from "os";
48
3
  import { join as join3, basename, dirname, resolve, sep } from "path";
@@ -91,7 +46,6 @@ import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync } fro
91
46
  var CACHE_DIR = join2(homedir(), ".honcho");
92
47
  var ID_CACHE_FILE = join2(CACHE_DIR, "cache.json");
93
48
  var CONTEXT_CACHE_FILE = join2(CACHE_DIR, "context-cache.json");
94
- var CLAUDE_CONTEXT_FILE = join2(CACHE_DIR, "claude-context.md");
95
49
  function ensureCacheDir() {
96
50
  if (!existsSync2(CACHE_DIR)) {
97
51
  mkdirSync(CACHE_DIR, { recursive: true });
@@ -190,51 +144,6 @@ function resetMessageCount() {
190
144
  cache.messageCount = 0;
191
145
  saveContextCache(cache);
192
146
  }
193
- function loadClaudeLocalContext() {
194
- ensureCacheDir();
195
- if (!existsSync2(CLAUDE_CONTEXT_FILE)) {
196
- return "";
197
- }
198
- try {
199
- return readFileSync(CLAUDE_CONTEXT_FILE, "utf-8");
200
- } catch {
201
- return "";
202
- }
203
- }
204
- function saveClaudeLocalContext(content) {
205
- ensureCacheDir();
206
- writeFileSync(CLAUDE_CONTEXT_FILE, content);
207
- }
208
- function appendClaudeWork(workDescription) {
209
- ensureCacheDir();
210
- const timestamp = new Date().toISOString();
211
- const entry = `
212
- - [${timestamp}] ${workDescription}`;
213
- let existing = loadClaudeLocalContext();
214
- if (!existing) {
215
- existing = `# CLAUDE Work Context
216
-
217
- Auto-generated log of CLAUDE's recent work.
218
-
219
- ## Recent Activity
220
- `;
221
- }
222
- let maxEntries = getLocalContextConfig().maxEntries;
223
- if (!maxEntries) {
224
- maxEntries = 10;
225
- }
226
- const lines = existing.split(`
227
- `);
228
- const activityStart = lines.findIndex((l) => l.includes("## Recent Activity"));
229
- if (activityStart !== -1) {
230
- const header = lines.slice(0, activityStart + 1);
231
- const activities = lines.slice(activityStart + 1).filter((l) => l.trim());
232
- const recentActivities = activities.slice(-(maxEntries - 1));
233
- existing = [...header, ...recentActivities].join(`
234
- `);
235
- }
236
- saveClaudeLocalContext(existing + entry);
237
- }
238
147
  var GIT_STATE_FILE = join2(CACHE_DIR, "git-state.json");
239
148
  function loadGitStateCache() {
240
149
  ensureCacheDir();
@@ -357,7 +266,54 @@ function clearClaudeContextOnly() {
357
266
  delete cache.claudeContext;
358
267
  saveContextCache(cache);
359
268
  }
360
-
269
+ // node_modules/@honcho-ai/harness-plugin-core/src/telemetry.ts
270
+ var HEADER_HOST = "X-Honcho-Host";
271
+ var HEADER_PLUGIN = "X-Honcho-Plugin";
272
+ var HEADER_AGENT_MODEL = "X-Honcho-Agent-Model";
273
+ function sanitize(value) {
274
+ if (typeof value !== "string")
275
+ return;
276
+ const s = value.replace(/[\r\n]+/g, " ").trim();
277
+ return s || undefined;
278
+ }
279
+ function token(name, ver) {
280
+ const clean = (v) => sanitize(v)?.replace(/[\s()/;]+/g, "-");
281
+ const n = clean(name);
282
+ const v = clean(ver);
283
+ if (n && v)
284
+ return `${n}/${v}`;
285
+ return n || v;
286
+ }
287
+ function hostHeaderValue(id = {}) {
288
+ const host = token(id.host, id.hostVersion);
289
+ if (!host)
290
+ return;
291
+ const platform = token(id.platform ?? process.platform, undefined);
292
+ return platform ? `${host} (${platform})` : host;
293
+ }
294
+ function pluginHeaderValue(id = {}) {
295
+ return token(id.plugin, id.pluginVersion);
296
+ }
297
+ function telemetryHeaders(id = {}, extra) {
298
+ const headers = {};
299
+ const host = hostHeaderValue(id);
300
+ const plugin = pluginHeaderValue(id);
301
+ const model = sanitize(id.model);
302
+ if (host)
303
+ headers[HEADER_HOST] = host;
304
+ if (plugin)
305
+ headers[HEADER_PLUGIN] = plugin;
306
+ if (model)
307
+ headers[HEADER_AGENT_MODEL] = model;
308
+ if (extra) {
309
+ for (const [k, v] of Object.entries(extra)) {
310
+ const value = sanitize(v);
311
+ if (value)
312
+ headers[k] = value;
313
+ }
314
+ }
315
+ return headers;
316
+ }
361
317
  // src/config.ts
362
318
  function sanitizeForSessionName(s) {
363
319
  return s.toLowerCase().replace(/[^a-z0-9-_]/g, "-");
@@ -491,12 +447,12 @@ function loadConfig(host) {
491
447
  try {
492
448
  const content = readFileSync2(CONFIG_FILE, "utf-8");
493
449
  const raw = JSON.parse(content);
494
- return resolveConfig(raw, resolvedHost);
450
+ return resolveConfig2(raw, resolvedHost);
495
451
  } catch {}
496
452
  }
497
453
  return loadConfigFromEnv(resolvedHost);
498
454
  }
499
- function resolveConfig(raw, host) {
455
+ function resolveConfig2(raw, host) {
500
456
  const hostBlock = raw.hosts?.[host] ?? raw.hosts?.[host.replace(/_/g, "-")] ?? raw.hosts?.[host.replace(/-/g, "_")];
501
457
  const apiKey = process.env.HONCHO_API_KEY || hostBlock?.apiKey || raw.apiKey;
502
458
  if (!apiKey)
@@ -534,7 +490,7 @@ function resolveConfig(raw, host) {
534
490
  messageUpload: hostBlock?.messageUpload ?? raw.messageUpload,
535
491
  contextRefresh: hostBlock?.contextRefresh ?? raw.contextRefresh,
536
492
  endpoint: hostBlock?.endpoint ?? raw.endpoint,
537
- localContext: hostBlock?.localContext ?? raw.localContext,
493
+ redactPatterns: hostBlock?.redactPatterns ?? raw.redactPatterns,
538
494
  injection: hostBlock?.injection ?? raw.injection,
539
495
  rememberTool: hostBlock?.rememberTool ?? raw.rememberTool,
540
496
  enabled: hostBlock?.enabled ?? raw.enabled,
@@ -634,7 +590,7 @@ function saveConfig(config) {
634
590
  setHostIfExplicit("observationMode", config.observationMode, existing.observationMode);
635
591
  setHostIfExplicit("messageUpload", config.messageUpload, existing.messageUpload);
636
592
  setHostIfExplicit("contextRefresh", config.contextRefresh, existing.contextRefresh);
637
- setHostIfExplicit("localContext", config.localContext, existing.localContext);
593
+ setHostIfExplicit("redactPatterns", config.redactPatterns, existing.redactPatterns);
638
594
  setHostIfExplicit("endpoint", config.endpoint, existing.endpoint);
639
595
  setHostIfExplicit("injection", config.injection, existing.injection);
640
596
  setHostIfExplicit("rememberTool", config.rememberTool, existing.rememberTool);
@@ -764,12 +720,6 @@ function setSessionForPath(cwd, sessionName) {
764
720
  config.sessions[cwd] = sessionName;
765
721
  saveConfig(config);
766
722
  }
767
- function getLocalContextConfig() {
768
- const config = loadConfig();
769
- return {
770
- maxEntries: config?.localContext?.maxEntries ?? 50
771
- };
772
- }
773
723
  function getInjectionConfig(config) {
774
724
  const injection = (config === undefined ? loadConfig() : config)?.injection;
775
725
  const resolved = { ...DEFAULT_INJECTION, ...injection ?? {} };
@@ -809,13 +759,21 @@ function getHonchoBaseUrlForEndpoint(endpoint) {
809
759
  function getHonchoBaseUrl(config) {
810
760
  return getHonchoBaseUrlForEndpoint(config.endpoint);
811
761
  }
762
+ function getTelemetryHeaders(host = getDetectedHost()) {
763
+ return telemetryHeaders({
764
+ host: host.replace(/_/g, "-"),
765
+ plugin: "claude-honcho",
766
+ pluginVersion: getPluginVersion()
767
+ });
768
+ }
812
769
  function getHonchoClientOptions(config) {
813
770
  return {
814
771
  apiKey: config.apiKey,
815
772
  baseURL: getHonchoBaseUrl(config),
816
773
  workspaceId: config.workspace,
817
774
  timeout: 120000,
818
- maxRetries: 1
775
+ maxRetries: 1,
776
+ defaultHeaders: getTelemetryHeaders()
819
777
  };
820
778
  }
821
779
  function getEndpointInfo(config) {
@@ -832,7 +790,7 @@ function getObservationMode(config) {
832
790
  return config.observationMode ?? "unified";
833
791
  }
834
792
 
835
- export { __toESM, __commonJS, __export, captureGitState, SESSION_START_COMPONENTS, PER_TURN_COMPONENTS, normalizePerTurn, REASONING_LEVELS, setDetectedHost, getDetectedHost, coerceBoolean, getCachedStdin, readStdinText, initHook, getConfigPath, configExists, getPluginVersion, loadConfig, saveConfig, saveRootField, getSessionForPath, getSessionName, setSessionForPath, getInjectionConfig, isLoggingEnabled, isPluginEnabled, getKnownHosts, getHonchoClientOptions, getEndpointInfo, getObservationMode, setCachedSessionId, getLastActiveCwd, getClaudeInstanceId, setClaudeInstanceId, getInstanceIdForCwd, incrementMessageCount, getMessageCount, resetMessageCount, appendClaudeWork, getCachedGitState, setCachedGitState, detectGitChanges, chunkContent, addMessagesBatched, clearIdCache, clearPeerCache, clearUserContextOnly, clearClaudeContextOnly };
793
+ export { captureGitState, SESSION_START_COMPONENTS, PER_TURN_COMPONENTS, normalizePerTurn, REASONING_LEVELS, setDetectedHost, getDetectedHost, coerceBoolean, getCachedStdin, readStdinText, initHook, getConfigPath, configExists, getPluginVersion, loadConfig, saveConfig, saveRootField, getSessionForPath, getSessionName, setSessionForPath, getInjectionConfig, isLoggingEnabled, isPluginEnabled, getKnownHosts, getHonchoClientOptions, getEndpointInfo, getObservationMode, setCachedSessionId, getLastActiveCwd, getClaudeInstanceId, setClaudeInstanceId, getInstanceIdForCwd, incrementMessageCount, getMessageCount, resetMessageCount, getCachedGitState, setCachedGitState, detectGitChanges, chunkContent, addMessagesBatched, clearIdCache, clearPeerCache, clearUserContextOnly, clearClaudeContextOnly };
836
794
 
837
- //# debugId=05755442764F032B64756E2164756E21
838
- //# sourceMappingURL=chunk-yfrrc1d5.js.map
795
+ //# debugId=7FF7A5020527A8CE64756E2164756E21
796
+ //# sourceMappingURL=chunk-acwn3613.js.map