wisen 0.2.0__tar.gz

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 (98) hide show
  1. wisen-0.2.0/LICENSE +21 -0
  2. wisen-0.2.0/PKG-INFO +236 -0
  3. wisen-0.2.0/README.md +188 -0
  4. wisen-0.2.0/pyproject.toml +57 -0
  5. wisen-0.2.0/setup.cfg +4 -0
  6. wisen-0.2.0/tests/test_claude_cli.py +99 -0
  7. wisen-0.2.0/tests/test_cloud.py +1041 -0
  8. wisen-0.2.0/tests/test_egress.py +332 -0
  9. wisen-0.2.0/tests/test_evals.py +286 -0
  10. wisen-0.2.0/tests/test_fixtures.py +75 -0
  11. wisen-0.2.0/tests/test_gardener.py +1172 -0
  12. wisen-0.2.0/tests/test_ingest.py +43 -0
  13. wisen-0.2.0/tests/test_jobs.py +604 -0
  14. wisen-0.2.0/tests/test_search.py +39 -0
  15. wisen-0.2.0/tests/test_sources.py +77 -0
  16. wisen-0.2.0/tests/test_stage_b.py +747 -0
  17. wisen-0.2.0/tests/test_store.py +170 -0
  18. wisen-0.2.0/tests/test_synthesis.py +54 -0
  19. wisen-0.2.0/tests/test_telegram.py +477 -0
  20. wisen-0.2.0/wisen/__init__.py +3 -0
  21. wisen-0.2.0/wisen/chat/__init__.py +0 -0
  22. wisen-0.2.0/wisen/chat/agent.py +400 -0
  23. wisen-0.2.0/wisen/chat/search.py +538 -0
  24. wisen-0.2.0/wisen/cli.py +356 -0
  25. wisen-0.2.0/wisen/cloud/__init__.py +15 -0
  26. wisen-0.2.0/wisen/cloud/auth.py +52 -0
  27. wisen-0.2.0/wisen/cloud/backup.py +72 -0
  28. wisen-0.2.0/wisen/cloud/client.py +147 -0
  29. wisen-0.2.0/wisen/cloud/mailbox.py +1051 -0
  30. wisen-0.2.0/wisen/cloud/push.py +58 -0
  31. wisen-0.2.0/wisen/cloud/rem.py +153 -0
  32. wisen-0.2.0/wisen/cloud/server.py +516 -0
  33. wisen-0.2.0/wisen/cloud/telegram.py +213 -0
  34. wisen-0.2.0/wisen/cloud/worker.py +647 -0
  35. wisen-0.2.0/wisen/config.py +47 -0
  36. wisen-0.2.0/wisen/connectors/__init__.py +0 -0
  37. wisen-0.2.0/wisen/connectors/agent_configs.py +160 -0
  38. wisen-0.2.0/wisen/connectors/claude_code.py +235 -0
  39. wisen-0.2.0/wisen/connectors/codex.py +182 -0
  40. wisen-0.2.0/wisen/connectors/cursor.py +208 -0
  41. wisen-0.2.0/wisen/connectors/gemini_cli.py +168 -0
  42. wisen-0.2.0/wisen/connectors/generic_export.py +115 -0
  43. wisen-0.2.0/wisen/connectors/git_commits.py +204 -0
  44. wisen-0.2.0/wisen/connectors/opencode.py +129 -0
  45. wisen-0.2.0/wisen/connectors/pi.py +387 -0
  46. wisen-0.2.0/wisen/dashboard/icon-192.png +0 -0
  47. wisen-0.2.0/wisen/dashboard/icon-512.png +0 -0
  48. wisen-0.2.0/wisen/dashboard/icon.svg +1 -0
  49. wisen-0.2.0/wisen/dashboard/index.html +784 -0
  50. wisen-0.2.0/wisen/dashboard/login.html +47 -0
  51. wisen-0.2.0/wisen/dashboard/manifest.webmanifest +15 -0
  52. wisen-0.2.0/wisen/dashboard/sw.js +31 -0
  53. wisen-0.2.0/wisen/egress.py +140 -0
  54. wisen-0.2.0/wisen/evals/__init__.py +0 -0
  55. wisen-0.2.0/wisen/evals/__main__.py +3 -0
  56. wisen-0.2.0/wisen/evals/cases.py +65 -0
  57. wisen-0.2.0/wisen/evals/cli.py +124 -0
  58. wisen-0.2.0/wisen/evals/judge.py +67 -0
  59. wisen-0.2.0/wisen/evals/metrics.py +100 -0
  60. wisen-0.2.0/wisen/evals/miner.py +276 -0
  61. wisen-0.2.0/wisen/evals/replay.py +164 -0
  62. wisen-0.2.0/wisen/evals/runner.py +126 -0
  63. wisen-0.2.0/wisen/evals/verification.py +344 -0
  64. wisen-0.2.0/wisen/export.py +28 -0
  65. wisen-0.2.0/wisen/gardener/__init__.py +11 -0
  66. wisen-0.2.0/wisen/gardener/agent.py +245 -0
  67. wisen-0.2.0/wisen/gardener/applier.py +272 -0
  68. wisen-0.2.0/wisen/gardener/git.py +159 -0
  69. wisen-0.2.0/wisen/gardener/loop.py +473 -0
  70. wisen-0.2.0/wisen/gardener/publisher.py +169 -0
  71. wisen-0.2.0/wisen/gardener/targets.py +294 -0
  72. wisen-0.2.0/wisen/ingestion/__init__.py +0 -0
  73. wisen-0.2.0/wisen/ingestion/normalizer.py +75 -0
  74. wisen-0.2.0/wisen/ingestion/pipeline.py +86 -0
  75. wisen-0.2.0/wisen/jobs.py +636 -0
  76. wisen-0.2.0/wisen/llm.py +47 -0
  77. wisen-0.2.0/wisen/main.py +211 -0
  78. wisen-0.2.0/wisen/migrate_mongo.py +75 -0
  79. wisen-0.2.0/wisen/packets.py +428 -0
  80. wisen-0.2.0/wisen/proposals.py +465 -0
  81. wisen-0.2.0/wisen/redact.py +63 -0
  82. wisen-0.2.0/wisen/store.py +526 -0
  83. wisen-0.2.0/wisen/synthesis/__init__.py +0 -0
  84. wisen-0.2.0/wisen/synthesis/agent.py +200 -0
  85. wisen-0.2.0/wisen/synthesis/claude_cli.py +122 -0
  86. wisen-0.2.0/wisen/synthesis/job.py +100 -0
  87. wisen-0.2.0/wisen/synthesis/prompt.py +218 -0
  88. wisen-0.2.0/wisen/synthesis/schema.py +253 -0
  89. wisen-0.2.0/wisen/usage.py +169 -0
  90. wisen-0.2.0/wisen/voice/__init__.py +0 -0
  91. wisen-0.2.0/wisen/voice/agent.py +101 -0
  92. wisen-0.2.0/wisen/voice/token.py +28 -0
  93. wisen-0.2.0/wisen.egg-info/PKG-INFO +236 -0
  94. wisen-0.2.0/wisen.egg-info/SOURCES.txt +96 -0
  95. wisen-0.2.0/wisen.egg-info/dependency_links.txt +1 -0
  96. wisen-0.2.0/wisen.egg-info/entry_points.txt +2 -0
  97. wisen-0.2.0/wisen.egg-info/requires.txt +27 -0
  98. wisen-0.2.0/wisen.egg-info/top_level.txt +1 -0
wisen-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vela
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.
wisen-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: wisen
3
+ Version: 0.2.0
4
+ Summary: A continuous-learning harness for coding agents: it learns from your real agent sessions with a private daily reflection, a chat you can ask about your work, and instruction files that keep improving as your agents work
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/Vela3202019/wisen
7
+ Project-URL: Repository, https://github.com/Vela3202019/wisen
8
+ Project-URL: Issues, https://github.com/Vela3202019/wisen/issues
9
+ Project-URL: Changelog, https://github.com/Vela3202019/wisen/releases
10
+ Keywords: coding-agents,claude-code,codex,llm,reflection,agents
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: httpx>=0.27
26
+ Requires-Dist: pydantic>=2.12
27
+ Requires-Dist: pydantic-ai[anthropic,google,openai]>=2.57.0
28
+ Requires-Dist: python-dotenv>=1.0.0
29
+ Provides-Extra: server
30
+ Requires-Dist: fastapi>=0.115.0; extra == "server"
31
+ Requires-Dist: uvicorn[standard]>=0.30.0; extra == "server"
32
+ Requires-Dist: certifi>=2024.0.0; extra == "server"
33
+ Provides-Extra: cloud
34
+ Requires-Dist: fastapi>=0.115.0; extra == "cloud"
35
+ Requires-Dist: uvicorn[standard]>=0.30.0; extra == "cloud"
36
+ Requires-Dist: pywebpush>=2.0; extra == "cloud"
37
+ Requires-Dist: cryptography>=42; extra == "cloud"
38
+ Provides-Extra: voice
39
+ Requires-Dist: livekit-agents[google]~=1.5; extra == "voice"
40
+ Requires-Dist: livekit>=0.17; extra == "voice"
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest>=8.0; extra == "dev"
43
+ Requires-Dist: ruff>=0.5; extra == "dev"
44
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
45
+ Provides-Extra: migrate
46
+ Requires-Dist: pymongo>=4.6; extra == "migrate"
47
+ Dynamic: license-file
48
+
49
+ <div align="center">
50
+
51
+ <img src="docs/assets/logo.svg" width="112" height="112" alt="wisen logo: a loose line sketching a range of hills">
52
+
53
+ # wisen
54
+
55
+ **You've corrected your coding agent on the same thing four times this week.
56
+ wisen reads your sessions and turns the corrections that keep coming back into
57
+ fixes to your `CLAUDE.md` and `AGENTS.md`, each one yours to approve.**
58
+
59
+ <img src="docs/assets/wisen-flow.gif" width="760" alt="wisen demo: a day's reflection surfaces a correction you made four times, the Gardener proposes one CLAUDE.md change, you approve it, and it becomes a branch you merge">
60
+
61
+ <sub>[Full walkthrough](docs/walkthrough.html) (a standalone HTML page: download it and open it in a browser)</sub>
62
+
63
+ ```bash
64
+ pipx install wisen && wisen synthesize
65
+ ```
66
+
67
+ <sub>Not on PyPI yet: the package lands with the first release. Until then, install from source as in the [Quickstart](#quickstart).</sub>
68
+
69
+ [![CI](https://github.com/Vela3202019/wisen/actions/workflows/ci.yml/badge.svg)](https://github.com/Vela3202019/wisen/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml) [![Built with pydantic-ai](https://img.shields.io/badge/built%20with-pydantic--ai-E92063.svg)](https://ai.pydantic.dev)
70
+
71
+ <a href="https://claude.com/claude-code" title="Claude Code"><img src="docs/assets/agents/claude-code.svg" width="28" height="28" alt="Claude Code"></a>
72
+ <a href="https://openai.com/codex/" title="Codex"><img src="docs/assets/agents/codex.svg" width="28" height="28" alt="Codex"></a>
73
+ <a href="https://cursor.com" title="Cursor"><img src="docs/assets/agents/cursor.svg" width="28" height="28" alt="Cursor"></a>
74
+ <a href="https://github.com/google-gemini/gemini-cli" title="Gemini CLI"><img src="docs/assets/agents/gemini-cli.svg" width="28" height="28" alt="Gemini CLI"></a>
75
+ <a href="https://opencode.ai" title="opencode"><img src="docs/assets/agents/opencode.svg" width="28" height="28" alt="opencode"></a>
76
+ <a href="https://pi.dev" title="Pi"><img src="docs/assets/agents/pi.svg" width="28" height="28" alt="Pi"></a>
77
+
78
+ </div>
79
+
80
+ ---
81
+
82
+ You spend hours a day with coding agents: corrections, rephrases, rejected
83
+ tool calls, the occasional flow state. Then it all evaporates. wisen reads
84
+ those sessions where your agents already keep them, writes one *reflection*
85
+ for the day, and proposes small fixes to the instruction files your agents
86
+ read. You approve each fix, and later sessions show whether it helped.
87
+
88
+ ## Quickstart
89
+
90
+ You need Python 3.11+ and one LLM API key. The default model is
91
+ `openai:gpt-5.6-terra`, so `OPENAI_API_KEY`; any pydantic-ai provider works
92
+ (see [Configuration](docs/configuration.md)).
93
+
94
+ ```bash
95
+ git clone https://github.com/Vela3202019/wisen && cd wisen
96
+ pip install -e ".[server]"
97
+ export OPENAI_API_KEY=sk-... # or put it in a repo-root .env
98
+ wisen synthesize # reflect on yesterday (one real LLM call)
99
+ wisen serve # API on :8000: reflections and chat
100
+ ```
101
+
102
+ Every command and install extra is in [docs/commands.md](docs/commands.md).
103
+
104
+ ## Features
105
+
106
+ - **Eight sources.** Claude Code, Codex, Cursor, opencode, Gemini CLI, Pi,
107
+ generic exports and git commits, read into one session shape.
108
+ - **One reflection a day.** Moods, friction points, one insight and
109
+ recommendations. Days with nothing new are skipped.
110
+ - **Chat that investigates.** Ask "how was my week?" and it searches your
111
+ reflections, transcripts and configs before answering
112
+ ([docs/chat.md](docs/chat.md)).
113
+ - **The Gardener.** Proposes small changes to your `CLAUDE.md`, `AGENTS.md`
114
+ and skill files. Each one is a git branch you approve and merge yourself
115
+ ([docs/gardener.md](docs/gardener.md)).
116
+ - **Voice briefing.** Hear the morning reflection out loud (the `[voice]` extra).
117
+ - **Your own server, optional.** The dashboard on your phone, push
118
+ notifications, an approval inbox and a Telegram bot. It never sees a
119
+ transcript ([docs/server.md](docs/server.md)).
120
+ - **Any model, or your subscription.** Any pydantic-ai model string; synthesis
121
+ can also run on a Claude Pro/Max subscription through the Claude Code CLI.
122
+ - **No database server.** One SQLite file (`~/.wisen/wisen.db`), created on
123
+ first use.
124
+
125
+ ## Claude Code plugin
126
+
127
+ wisen ships as a Claude Code plugin, so the loop lives inside the sessions it
128
+ learns from. Install the CLI first (see [Quickstart](#quickstart)), then:
129
+
130
+ ```bash
131
+ claude plugin marketplace add Vela3202019/wisen
132
+ claude plugin install wisen@vela
133
+ ```
134
+
135
+ What it adds:
136
+
137
+ - **At session start**, one line of context when the Gardener has proposals
138
+ waiting or approved branches you have not merged. Nothing when there is
139
+ nothing to say, and nothing when `wisen` is not installed.
140
+ - **`/wisen:proposals`**: the approval inbox in chat. Shows each proposal's
141
+ target, rationale and diff; approves or rejects only the one you name.
142
+ - **`/wisen:reflect`**: runs or reads a day's reflection and summarises it.
143
+ - **`/wisen:setup`**: installs and configures the CLI on a machine that does
144
+ not have it.
145
+
146
+ The plugin is the `plugin/` directory; the marketplace is `.claude-plugin/marketplace.json`
147
+ at the repo root. `claude plugin validate .` checks both.
148
+
149
+ ## How it works
150
+
151
+ - **Read.** Connectors parse each agent's on-disk history into one shape and
152
+ skip anything missing or malformed.
153
+ - **Observe.** The Observer reads the day's turns and picks out the charged
154
+ moments: rejections, rephrase storms, hedges.
155
+ - **Reflect.** The Synthesizer turns those notes into the day's reflection,
156
+ stored in SQLite.
157
+ - **Use it.** The chat agent, the dashboard and the voice briefing read the
158
+ reflection; the Gardener turns recurring friction into proposals.
159
+ - **Measure.** Two weeks after you merge a proposal, the eval loop compares
160
+ before and after, and proposes a revert if things got worse.
161
+
162
+ The full pipeline, with a diagram and a map of the code, is in
163
+ [docs/how-it-works.md](docs/how-it-works.md).
164
+
165
+ A real reflection, abridged:
166
+
167
+ ```jsonc
168
+ // 2026-07-20.json
169
+ {
170
+ "your_mood": { "label": "deep-focus",
171
+ "summary": "Determined execution — dispatched 4 bugs, wrote a design doc,
172
+ reviewed 2 PRs, 5 commits across 5 hours with zero hesitation." },
173
+ "agent_mood": { "label": "confident",
174
+ "summary": "Took ownership without hedging — zero 'I think', zero
175
+ clarifications across 3 sessions, incl. a 213-turn debug session." },
176
+ "alignment_score": 0.85,
177
+ "insight": "The 70% rephrase rate on your end didn't indicate friction — it
178
+ was tight-ship compression the agent could follow.",
179
+ "friction_points": [
180
+ { "type": "unclear-prompt",
181
+ "description": "150 rephrases across 213 turns. The agent handled it,
182
+ but this is a load pattern worth examining." } ],
183
+ "recommendations": [
184
+ { "target": "workflow",
185
+ "action": "If you switch models mid-session again, note why in a
186
+ one-liner so the pattern becomes analyzable." } ]
187
+ }
188
+ ```
189
+
190
+ ## Privacy
191
+
192
+ - **Stays on your machine:** raw transcripts, git history and agent configs
193
+ (wisen does not copy them), the SQLite file and your API keys.
194
+ - **Goes to the model provider you pick:** excerpts of the day's sessions
195
+ (each turn cut to 400 characters, and a turn can include tool output), up to 20 config
196
+ files, commit messages, and chat search results. With `claude-cli:…`
197
+ synthesis, that provider is Anthropic under your own account. Voice sends
198
+ your speech to Google's Gemini.
199
+ - **Goes to your own server, if you pair one:** derived results, which can
200
+ quote short pieces of your sessions; in stage B also the Observer's notes
201
+ and the text of the files the Gardener may edit, never raw transcripts or
202
+ tool output. Everything passes one egress gate
203
+ that checks a typed schema, masks secrets and caps text length, and
204
+ `wisen egress` shows what left today.
205
+
206
+ The exact limits, every packet type, stage B, Telegram and the full list of
207
+ network calls are in [docs/privacy.md](docs/privacy.md).
208
+
209
+ ## Documentation
210
+
211
+ - [Configuration](docs/configuration.md): models, API keys, paths
212
+ - [Commands and extras](docs/commands.md)
213
+ - [How it works](docs/how-it-works.md)
214
+ - [Chat](docs/chat.md)
215
+ - [The Gardener](docs/gardener.md)
216
+ - [Your own server](docs/server.md), with setup details in [deploy/README.md](deploy/README.md)
217
+ - [What leaves your machine](docs/privacy.md)
218
+ - [Development](docs/development.md): project status, tests, upgrading from MongoDB
219
+
220
+ ## Project status
221
+
222
+ A personal project under active development; expect the schema and CLI to
223
+ move. Plans live in [docs/plan/](docs/plan/).
224
+
225
+ ## Contributing
226
+
227
+ Dev setup, offline tests and a guide to adding a connector for a new agent
228
+ are in [CONTRIBUTING.md](CONTRIBUTING.md). Connectors are small, so a first
229
+ contribution is too. Please follow the
230
+ [Code of Conduct](CODE_OF_CONDUCT.md), report security problems as
231
+ [SECURITY.md](SECURITY.md) describes, and see [CHANGELOG.md](CHANGELOG.md) for
232
+ what changed in each release.
233
+
234
+ ## License
235
+
236
+ [MIT](LICENSE)
wisen-0.2.0/README.md ADDED
@@ -0,0 +1,188 @@
1
+ <div align="center">
2
+
3
+ <img src="docs/assets/logo.svg" width="112" height="112" alt="wisen logo: a loose line sketching a range of hills">
4
+
5
+ # wisen
6
+
7
+ **You've corrected your coding agent on the same thing four times this week.
8
+ wisen reads your sessions and turns the corrections that keep coming back into
9
+ fixes to your `CLAUDE.md` and `AGENTS.md`, each one yours to approve.**
10
+
11
+ <img src="docs/assets/wisen-flow.gif" width="760" alt="wisen demo: a day's reflection surfaces a correction you made four times, the Gardener proposes one CLAUDE.md change, you approve it, and it becomes a branch you merge">
12
+
13
+ <sub>[Full walkthrough](docs/walkthrough.html) (a standalone HTML page: download it and open it in a browser)</sub>
14
+
15
+ ```bash
16
+ pipx install wisen && wisen synthesize
17
+ ```
18
+
19
+ <sub>Not on PyPI yet: the package lands with the first release. Until then, install from source as in the [Quickstart](#quickstart).</sub>
20
+
21
+ [![CI](https://github.com/Vela3202019/wisen/actions/workflows/ci.yml/badge.svg)](https://github.com/Vela3202019/wisen/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml) [![Built with pydantic-ai](https://img.shields.io/badge/built%20with-pydantic--ai-E92063.svg)](https://ai.pydantic.dev)
22
+
23
+ <a href="https://claude.com/claude-code" title="Claude Code"><img src="docs/assets/agents/claude-code.svg" width="28" height="28" alt="Claude Code"></a>
24
+ <a href="https://openai.com/codex/" title="Codex"><img src="docs/assets/agents/codex.svg" width="28" height="28" alt="Codex"></a>
25
+ <a href="https://cursor.com" title="Cursor"><img src="docs/assets/agents/cursor.svg" width="28" height="28" alt="Cursor"></a>
26
+ <a href="https://github.com/google-gemini/gemini-cli" title="Gemini CLI"><img src="docs/assets/agents/gemini-cli.svg" width="28" height="28" alt="Gemini CLI"></a>
27
+ <a href="https://opencode.ai" title="opencode"><img src="docs/assets/agents/opencode.svg" width="28" height="28" alt="opencode"></a>
28
+ <a href="https://pi.dev" title="Pi"><img src="docs/assets/agents/pi.svg" width="28" height="28" alt="Pi"></a>
29
+
30
+ </div>
31
+
32
+ ---
33
+
34
+ You spend hours a day with coding agents: corrections, rephrases, rejected
35
+ tool calls, the occasional flow state. Then it all evaporates. wisen reads
36
+ those sessions where your agents already keep them, writes one *reflection*
37
+ for the day, and proposes small fixes to the instruction files your agents
38
+ read. You approve each fix, and later sessions show whether it helped.
39
+
40
+ ## Quickstart
41
+
42
+ You need Python 3.11+ and one LLM API key. The default model is
43
+ `openai:gpt-5.6-terra`, so `OPENAI_API_KEY`; any pydantic-ai provider works
44
+ (see [Configuration](docs/configuration.md)).
45
+
46
+ ```bash
47
+ git clone https://github.com/Vela3202019/wisen && cd wisen
48
+ pip install -e ".[server]"
49
+ export OPENAI_API_KEY=sk-... # or put it in a repo-root .env
50
+ wisen synthesize # reflect on yesterday (one real LLM call)
51
+ wisen serve # API on :8000: reflections and chat
52
+ ```
53
+
54
+ Every command and install extra is in [docs/commands.md](docs/commands.md).
55
+
56
+ ## Features
57
+
58
+ - **Eight sources.** Claude Code, Codex, Cursor, opencode, Gemini CLI, Pi,
59
+ generic exports and git commits, read into one session shape.
60
+ - **One reflection a day.** Moods, friction points, one insight and
61
+ recommendations. Days with nothing new are skipped.
62
+ - **Chat that investigates.** Ask "how was my week?" and it searches your
63
+ reflections, transcripts and configs before answering
64
+ ([docs/chat.md](docs/chat.md)).
65
+ - **The Gardener.** Proposes small changes to your `CLAUDE.md`, `AGENTS.md`
66
+ and skill files. Each one is a git branch you approve and merge yourself
67
+ ([docs/gardener.md](docs/gardener.md)).
68
+ - **Voice briefing.** Hear the morning reflection out loud (the `[voice]` extra).
69
+ - **Your own server, optional.** The dashboard on your phone, push
70
+ notifications, an approval inbox and a Telegram bot. It never sees a
71
+ transcript ([docs/server.md](docs/server.md)).
72
+ - **Any model, or your subscription.** Any pydantic-ai model string; synthesis
73
+ can also run on a Claude Pro/Max subscription through the Claude Code CLI.
74
+ - **No database server.** One SQLite file (`~/.wisen/wisen.db`), created on
75
+ first use.
76
+
77
+ ## Claude Code plugin
78
+
79
+ wisen ships as a Claude Code plugin, so the loop lives inside the sessions it
80
+ learns from. Install the CLI first (see [Quickstart](#quickstart)), then:
81
+
82
+ ```bash
83
+ claude plugin marketplace add Vela3202019/wisen
84
+ claude plugin install wisen@vela
85
+ ```
86
+
87
+ What it adds:
88
+
89
+ - **At session start**, one line of context when the Gardener has proposals
90
+ waiting or approved branches you have not merged. Nothing when there is
91
+ nothing to say, and nothing when `wisen` is not installed.
92
+ - **`/wisen:proposals`**: the approval inbox in chat. Shows each proposal's
93
+ target, rationale and diff; approves or rejects only the one you name.
94
+ - **`/wisen:reflect`**: runs or reads a day's reflection and summarises it.
95
+ - **`/wisen:setup`**: installs and configures the CLI on a machine that does
96
+ not have it.
97
+
98
+ The plugin is the `plugin/` directory; the marketplace is `.claude-plugin/marketplace.json`
99
+ at the repo root. `claude plugin validate .` checks both.
100
+
101
+ ## How it works
102
+
103
+ - **Read.** Connectors parse each agent's on-disk history into one shape and
104
+ skip anything missing or malformed.
105
+ - **Observe.** The Observer reads the day's turns and picks out the charged
106
+ moments: rejections, rephrase storms, hedges.
107
+ - **Reflect.** The Synthesizer turns those notes into the day's reflection,
108
+ stored in SQLite.
109
+ - **Use it.** The chat agent, the dashboard and the voice briefing read the
110
+ reflection; the Gardener turns recurring friction into proposals.
111
+ - **Measure.** Two weeks after you merge a proposal, the eval loop compares
112
+ before and after, and proposes a revert if things got worse.
113
+
114
+ The full pipeline, with a diagram and a map of the code, is in
115
+ [docs/how-it-works.md](docs/how-it-works.md).
116
+
117
+ A real reflection, abridged:
118
+
119
+ ```jsonc
120
+ // 2026-07-20.json
121
+ {
122
+ "your_mood": { "label": "deep-focus",
123
+ "summary": "Determined execution — dispatched 4 bugs, wrote a design doc,
124
+ reviewed 2 PRs, 5 commits across 5 hours with zero hesitation." },
125
+ "agent_mood": { "label": "confident",
126
+ "summary": "Took ownership without hedging — zero 'I think', zero
127
+ clarifications across 3 sessions, incl. a 213-turn debug session." },
128
+ "alignment_score": 0.85,
129
+ "insight": "The 70% rephrase rate on your end didn't indicate friction — it
130
+ was tight-ship compression the agent could follow.",
131
+ "friction_points": [
132
+ { "type": "unclear-prompt",
133
+ "description": "150 rephrases across 213 turns. The agent handled it,
134
+ but this is a load pattern worth examining." } ],
135
+ "recommendations": [
136
+ { "target": "workflow",
137
+ "action": "If you switch models mid-session again, note why in a
138
+ one-liner so the pattern becomes analyzable." } ]
139
+ }
140
+ ```
141
+
142
+ ## Privacy
143
+
144
+ - **Stays on your machine:** raw transcripts, git history and agent configs
145
+ (wisen does not copy them), the SQLite file and your API keys.
146
+ - **Goes to the model provider you pick:** excerpts of the day's sessions
147
+ (each turn cut to 400 characters, and a turn can include tool output), up to 20 config
148
+ files, commit messages, and chat search results. With `claude-cli:…`
149
+ synthesis, that provider is Anthropic under your own account. Voice sends
150
+ your speech to Google's Gemini.
151
+ - **Goes to your own server, if you pair one:** derived results, which can
152
+ quote short pieces of your sessions; in stage B also the Observer's notes
153
+ and the text of the files the Gardener may edit, never raw transcripts or
154
+ tool output. Everything passes one egress gate
155
+ that checks a typed schema, masks secrets and caps text length, and
156
+ `wisen egress` shows what left today.
157
+
158
+ The exact limits, every packet type, stage B, Telegram and the full list of
159
+ network calls are in [docs/privacy.md](docs/privacy.md).
160
+
161
+ ## Documentation
162
+
163
+ - [Configuration](docs/configuration.md): models, API keys, paths
164
+ - [Commands and extras](docs/commands.md)
165
+ - [How it works](docs/how-it-works.md)
166
+ - [Chat](docs/chat.md)
167
+ - [The Gardener](docs/gardener.md)
168
+ - [Your own server](docs/server.md), with setup details in [deploy/README.md](deploy/README.md)
169
+ - [What leaves your machine](docs/privacy.md)
170
+ - [Development](docs/development.md): project status, tests, upgrading from MongoDB
171
+
172
+ ## Project status
173
+
174
+ A personal project under active development; expect the schema and CLI to
175
+ move. Plans live in [docs/plan/](docs/plan/).
176
+
177
+ ## Contributing
178
+
179
+ Dev setup, offline tests and a guide to adding a connector for a new agent
180
+ are in [CONTRIBUTING.md](CONTRIBUTING.md). Connectors are small, so a first
181
+ contribution is too. Please follow the
182
+ [Code of Conduct](CODE_OF_CONDUCT.md), report security problems as
183
+ [SECURITY.md](SECURITY.md) describes, and see [CHANGELOG.md](CHANGELOG.md) for
184
+ what changed in each release.
185
+
186
+ ## License
187
+
188
+ [MIT](LICENSE)
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wisen"
7
+ version = "0.2.0"
8
+ description = "A continuous-learning harness for coding agents: it learns from your real agent sessions with a private daily reflection, a chat you can ask about your work, and instruction files that keep improving as your agents work"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ keywords = ["coding-agents", "claude-code", "codex", "llm", "reflection", "agents"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: MacOS",
19
+ "Operating System :: POSIX :: Linux",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development",
26
+ ]
27
+ dependencies = [
28
+ "httpx>=0.27",
29
+ "pydantic>=2.12",
30
+ "pydantic-ai[google,openai,anthropic]>=2.57.0",
31
+ "python-dotenv>=1.0.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ server = ["fastapi>=0.115.0", "uvicorn[standard]>=0.30.0", "certifi>=2024.0.0"]
36
+ cloud = ["fastapi>=0.115.0", "uvicorn[standard]>=0.30.0", "pywebpush>=2.0", "cryptography>=42"]
37
+ voice = ["livekit-agents[google]~=1.5", "livekit>=0.17"]
38
+ dev = ["pytest>=8.0", "ruff>=0.5", "pre-commit>=3.0"]
39
+ migrate = ["pymongo>=4.6"]
40
+
41
+ [project.scripts]
42
+ wisen = "wisen.cli:main"
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/Vela3202019/wisen"
46
+ Repository = "https://github.com/Vela3202019/wisen"
47
+ Issues = "https://github.com/Vela3202019/wisen/issues"
48
+ Changelog = "https://github.com/Vela3202019/wisen/releases"
49
+
50
+ [tool.ruff.lint]
51
+ ignore = ["E731", "E741"]
52
+
53
+ [tool.setuptools.packages.find]
54
+ include = ["wisen*"]
55
+
56
+ [tool.setuptools.package-data]
57
+ "wisen.dashboard" = ["*.html", "*.js", "*.webmanifest", "*.svg", "*.png"]
wisen-0.2.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,99 @@
1
+ """
2
+ Test the claude -p structured-output adapter's parsing/validation (no live CLI call).
3
+ Run: python3 -m tests.test_claude_cli
4
+ """
5
+ import json
6
+
7
+ from wisen.synthesis.claude_cli import _extract_json_object, _model_name, _parse_result
8
+ from wisen.synthesis.schema import DayObservation
9
+
10
+
11
+ def _valid_observation() -> dict:
12
+ return {
13
+ "mood_signals_user": "terse, directive",
14
+ "mood_signals_agent": "hedging early, confident later",
15
+ "topics_raw": ["synthesis", "cli adapter"],
16
+ "key_moments": [
17
+ {"session_source": "claude-code", "quote": "go", "significance": "approval"}
18
+ ],
19
+ "commit_drift": "discussed adapter, shipped adapter",
20
+ "config_changes_observed": [],
21
+ "friction_observed": [],
22
+ "yesterday_recs_followed": [],
23
+ "yesterday_recs_ignored": [],
24
+ "model_usage_observed": ["claude-code: claude-sonnet-4-6"],
25
+ "day_summary": "built the subscription synthesis path",
26
+ }
27
+
28
+
29
+ def _envelope(result_text: str) -> str:
30
+ """Mimic `claude -p --output-format json`: an array of events ending in a result
31
+ event whose `result` field is the model's text response."""
32
+ return json.dumps([
33
+ {"type": "system", "subtype": "init", "session_id": "x"},
34
+ {"type": "assistant", "message": {"content": [{"type": "text", "text": result_text}]}},
35
+ {"type": "result", "subtype": "success", "is_error": False, "result": result_text},
36
+ ])
37
+
38
+
39
+ def test_parse_clean_json():
40
+ obs = _parse_result(_envelope(json.dumps(_valid_observation())), DayObservation)
41
+ assert isinstance(obs, DayObservation)
42
+ assert obs.topics_raw == ["synthesis", "cli adapter"]
43
+ print("✓ parse: clean JSON result → DayObservation")
44
+
45
+
46
+ def test_parse_json_with_prose_and_fences():
47
+ # Model sometimes wraps JSON in prose / markdown fences despite instructions.
48
+ noisy = "Here's the Reflection:\n```json\n" + json.dumps(_valid_observation()) + "\n```\nDone."
49
+ obs = _parse_result(_envelope(noisy), DayObservation)
50
+ assert obs.day_summary == "built the subscription synthesis path"
51
+ print("✓ parse: JSON embedded in prose/fences is extracted")
52
+
53
+
54
+ def test_parse_missing_result():
55
+ blob = json.dumps([{"type": "result", "subtype": "success"}]) # no `result` field
56
+ try:
57
+ _parse_result(blob, DayObservation)
58
+ except ValueError:
59
+ print("✓ parse: missing result text raises ValueError")
60
+ else:
61
+ raise AssertionError("expected ValueError for missing result text")
62
+
63
+
64
+ def test_parse_schema_violation():
65
+ bad = _valid_observation()
66
+ del bad["day_summary"] # required field
67
+ try:
68
+ _parse_result(_envelope(json.dumps(bad)), DayObservation)
69
+ except ValueError as e:
70
+ assert "day_summary" in str(e)
71
+ print("✓ parse: schema violation raises")
72
+ else:
73
+ raise AssertionError("expected validation error for missing required field")
74
+
75
+
76
+ def test_extract_no_json():
77
+ try:
78
+ _extract_json_object("sorry, I cannot do that")
79
+ except ValueError:
80
+ print("✓ extract: no JSON object raises ValueError")
81
+ else:
82
+ raise AssertionError("expected ValueError when no JSON present")
83
+
84
+
85
+ def test_model_name_strips_prefix():
86
+ import os
87
+ os.environ["WISEN_SYNTH_MODEL"] = "claude-cli:claude-sonnet-4-6"
88
+ assert _model_name() == "claude-sonnet-4-6"
89
+ print("✓ model_name: strips claude-cli: prefix")
90
+
91
+
92
+ if __name__ == "__main__":
93
+ test_parse_clean_json()
94
+ test_parse_json_with_prose_and_fences()
95
+ test_parse_missing_result()
96
+ test_parse_schema_violation()
97
+ test_extract_no_json()
98
+ test_model_name_strips_prefix()
99
+ print("\nall claude_cli tests passed")