haansi 0.1.24 → 0.1.26

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/README.md +33 -19
  2. package/dist/haansi.js +738 -239
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,9 +1,18 @@
1
1
  # Haansi CLI
2
2
 
3
- Session collector and MCP server for Claude Code. Uploads Claude Code session data to the Haansi platform for mining, search, and knowledge retrieval.
3
+ Session collector and MCP server for **Claude Code** and **OpenAI Codex**. Uploads your coding-agent session data to the Haansi platform for mining, search, and knowledge retrieval, and registers the Haansi MCP server with either or both agents.
4
4
 
5
5
  Published to npm as `haansi`.
6
6
 
7
+ ## Supported agents
8
+
9
+ | Agent | Sessions read from | MCP config file |
10
+ | ------------ | ----------------------------------------- | ---------------------- |
11
+ | Claude Code | `~/.claude/projects/**/*.jsonl` | `~/.claude.json` |
12
+ | OpenAI Codex | `$CODEX_HOME/sessions/**/rollout-*.jsonl` | `~/.codex/config.toml` |
13
+
14
+ By default, commands act on every installed agent. Target a specific one with `--agent claude`, `--agent codex`, or `--agent both`. The choice is remembered in `~/.haansi/config.json`. Run `haansi agents` to see what's detected and selected.
15
+
7
16
  ## Installation
8
17
 
9
18
  ```bash
@@ -24,23 +33,25 @@ This prompts for your token, validates it against the API, and saves it to `~/.h
24
33
 
25
34
  ## Commands
26
35
 
27
- | Command | Description |
28
- | --------------------------------- | -------------------------------------------------------- |
29
- | `haansi init` | Authenticate and save your API token |
30
- | `haansi collect` | Upload new/changed Claude sessions (once) |
31
- | `haansi daemon` | Run the collector on a schedule (every 30 min) |
32
- | `haansi setup-daemon` | Install macOS launchd service for auto-start on login |
33
- | `haansi setup-mcp` | Add haansi-solutions MCP entry to `~/.claude.json` |
34
- | `haansi mcp-server` | Start the Haansi MCP server (stdio, used by Claude Code) |
35
- | `haansi config get [key]` | Show preferences (e.g. `session_mode`) |
36
- | `haansi config set <key> <val>` | Update a preference |
37
- | `haansi search-solutions <query>` | Semantic search over mined solutions |
38
- | `haansi list-solutions` | List recent mined solutions |
39
- | `haansi search-knowledge <query>` | Search knowledge artifacts |
40
- | `haansi save-knowledge` | Save a problem/solution for future retrieval |
36
+ | Command | Description |
37
+ | --------------------------------- | ------------------------------------------------------ |
38
+ | `haansi init` | Authenticate and save your API token |
39
+ | `haansi collect [--agent <sel>]` | Upload new/changed sessions (once) |
40
+ | `haansi agents` | List supported / installed / selected agents |
41
+ | `haansi daemon` | Run the collector on a schedule (every 30 min) |
42
+ | `haansi setup-daemon` | Install macOS launchd service for auto-start on login |
43
+ | `haansi setup-mcp [t] [--agent]` | Register MCP servers with Claude Code and/or Codex |
44
+ | `haansi mcp-server` | Start the Haansi MCP server (stdio, used by the agent) |
45
+ | `haansi config get [key]` | Show preferences (e.g. `session_mode`) |
46
+ | `haansi config set <key> <val>` | Update a preference |
47
+ | `haansi search-solutions <query>` | Semantic search over mined solutions |
48
+ | `haansi list-solutions` | List recent mined solutions |
49
+ | `haansi search-knowledge <query>` | Search knowledge artifacts |
50
+ | `haansi save-knowledge` | Save a problem/solution for future retrieval |
41
51
 
42
52
  ### Collect options
43
53
 
54
+ - `--agent <sel>` -- `claude`, `codex`, or `both` (default: installed agents)
44
55
  - `--force-all` -- Re-upload all sessions, not just new ones
45
56
  - `--dry-run` -- Scan without uploading
46
57
  - `--limit <n>` -- Upload at most n sessions
@@ -51,8 +62,9 @@ This prompts for your token, validates it against the API, and saves it to `~/.h
51
62
  | ------------------------- | ----------------------------------------- | ----------------------- |
52
63
  | `HAANSI_TOKEN` | API token (alternative to `haansi init`) | -- |
53
64
  | `HAANSI_API_URL` | API base URL | `https://api.haansi.co` |
54
- | `CLAUDE_PROJECT_PATH` | Collect from a specific project path only | -- |
55
- | `CLAUDE_COLLECT_SCHEDULE` | Cron expression for daemon | `*/30 * * * *` |
65
+ | `CODEX_HOME` | Codex home directory | `~/.codex` |
66
+ | `HAANSI_AGENTS` | Daemon: comma-separated agents to collect | (all installed) |
67
+ | `HAANSI_COLLECT_SCHEDULE` | Cron expression for daemon | `*/30 * * * *` |
56
68
 
57
69
  ### User preferences
58
70
 
@@ -72,10 +84,12 @@ Installs a launchd plist at `~/Library/LaunchAgents/co.haansi.daemon.plist`. Log
72
84
  ## MCP Server
73
85
 
74
86
  ```bash
75
- haansi setup-mcp
87
+ haansi setup-mcp # all installed agents
88
+ haansi setup-mcp --agent codex # Codex only
89
+ haansi setup-mcp --agent both # Claude Code + Codex
76
90
  ```
77
91
 
78
- Registers `haansi-solutions` in `~/.claude.json` so Claude Code auto-starts the MCP server, providing search and knowledge tools directly in the AI assistant.
92
+ Registers `haansi-solutions` (stdio) and `haansi-exchange` (http) with the selected agent(s): Claude Code via `~/.claude.json`, Codex via the `[mcp_servers.*]` tables in `~/.codex/config.toml`. Existing config is preserved — only the managed entries are added/updated. Restart the agent to pick up the change.
79
93
 
80
94
  ---
81
95