claudescientist 5.1.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.
- claudescientist-5.1.0/LICENSE +21 -0
- claudescientist-5.1.0/PKG-INFO +262 -0
- claudescientist-5.1.0/README.md +228 -0
- claudescientist-5.1.0/pyproject.toml +92 -0
- claudescientist-5.1.0/src/claudescientist/__init__.py +68 -0
- claudescientist-5.1.0/src/claudescientist/__main__.py +3 -0
- claudescientist-5.1.0/src/claudescientist/_setup_io.py +384 -0
- claudescientist-5.1.0/src/claudescientist/agent_hosts.py +387 -0
- claudescientist-5.1.0/src/claudescientist/cli.py +163 -0
- claudescientist-5.1.0/src/claudescientist/codex_cli.py +34 -0
- claudescientist-5.1.0/src/claudescientist/codex_hooks.py +203 -0
- claudescientist-5.1.0/src/claudescientist/doctor.py +186 -0
- claudescientist-5.1.0/src/claudescientist/heldout.py +135 -0
- claudescientist-5.1.0/src/claudescientist/heldout_cli.py +11 -0
- claudescientist-5.1.0/src/claudescientist/plugin_setup.py +117 -0
- claudescientist-5.1.0/src/claudescientist/protections.py +115 -0
- claudescientist-5.1.0/src/claudescientist/py.typed +0 -0
- claudescientist-5.1.0/src/claudescientist/runtime.py +498 -0
- claudescientist-5.1.0/src/claudescientist/setup.py +946 -0
- claudescientist-5.1.0/src/cockpit/__init__.py +73 -0
- claudescientist-5.1.0/src/cockpit/action_router.py +68 -0
- claudescientist-5.1.0/src/cockpit/activity.py +603 -0
- claudescientist-5.1.0/src/cockpit/app.py +2430 -0
- claudescientist-5.1.0/src/cockpit/bars.py +74 -0
- claudescientist-5.1.0/src/cockpit/command_handler.py +153 -0
- claudescientist-5.1.0/src/cockpit/commands.py +143 -0
- claudescientist-5.1.0/src/cockpit/data.py +1008 -0
- claudescientist-5.1.0/src/cockpit/db.py +102 -0
- claudescientist-5.1.0/src/cockpit/details.py +363 -0
- claudescientist-5.1.0/src/cockpit/diagnostics.py +298 -0
- claudescientist-5.1.0/src/cockpit/export/__init__.py +34 -0
- claudescientist-5.1.0/src/cockpit/export/__main__.py +7 -0
- claudescientist-5.1.0/src/cockpit/export/cli.py +112 -0
- claudescientist-5.1.0/src/cockpit/export/dto/__init__.py +35 -0
- claudescientist-5.1.0/src/cockpit/export/dto/base.py +42 -0
- claudescientist-5.1.0/src/cockpit/export/dto/cascade.py +179 -0
- claudescientist-5.1.0/src/cockpit/export/dto/closure.py +323 -0
- claudescientist-5.1.0/src/cockpit/export/dto/diagnostic.py +157 -0
- claudescientist-5.1.0/src/cockpit/export/dto/draft.py +141 -0
- claudescientist-5.1.0/src/cockpit/export/dto/portfolio.py +126 -0
- claudescientist-5.1.0/src/cockpit/export/paths.py +57 -0
- claudescientist-5.1.0/src/cockpit/export/pipeline.py +151 -0
- claudescientist-5.1.0/src/cockpit/export/renderers/__init__.py +31 -0
- claudescientist-5.1.0/src/cockpit/export/renderers/base.py +24 -0
- claudescientist-5.1.0/src/cockpit/export/renderers/html.py +179 -0
- claudescientist-5.1.0/src/cockpit/export/renderers/markdown.py +75 -0
- claudescientist-5.1.0/src/cockpit/i18n.py +924 -0
- claudescientist-5.1.0/src/cockpit/intervention_controller.py +74 -0
- claudescientist-5.1.0/src/cockpit/layout.py +73 -0
- claudescientist-5.1.0/src/cockpit/mcp_server.py +145 -0
- claudescientist-5.1.0/src/cockpit/modals/__init__.py +20 -0
- claudescientist-5.1.0/src/cockpit/modals/bookmarks.py +181 -0
- claudescientist-5.1.0/src/cockpit/modals/confirm.py +58 -0
- claudescientist-5.1.0/src/cockpit/modals/export.py +198 -0
- claudescientist-5.1.0/src/cockpit/modals/help.py +58 -0
- claudescientist-5.1.0/src/cockpit/modals/pin_metric.py +96 -0
- claudescientist-5.1.0/src/cockpit/modals/text_input.py +51 -0
- claudescientist-5.1.0/src/cockpit/panes/__init__.py +17 -0
- claudescientist-5.1.0/src/cockpit/panes/activity_pane.py +229 -0
- claudescientist-5.1.0/src/cockpit/panes/detail_pane.py +271 -0
- claudescientist-5.1.0/src/cockpit/panes/events_pane.py +334 -0
- claudescientist-5.1.0/src/cockpit/panes/focus_pane.py +302 -0
- claudescientist-5.1.0/src/cockpit/panes/phase_strip.py +177 -0
- claudescientist-5.1.0/src/cockpit/panes/tabs_pane.py +697 -0
- claudescientist-5.1.0/src/cockpit/panes/timeline_pane.py +155 -0
- claudescientist-5.1.0/src/cockpit/panes/tree_pane.py +312 -0
- claudescientist-5.1.0/src/cockpit/phase.py +343 -0
- claudescientist-5.1.0/src/cockpit/refresh_coordinator.py +57 -0
- claudescientist-5.1.0/src/cockpit/row_detail.py +186 -0
- claudescientist-5.1.0/src/cockpit/screens/__init__.py +26 -0
- claudescientist-5.1.0/src/cockpit/screens/detail.py +358 -0
- claudescientist-5.1.0/src/cockpit/screens/splash.py +522 -0
- claudescientist-5.1.0/src/cockpit/screens/welcome.py +165 -0
- claudescientist-5.1.0/src/cockpit/settings.py +359 -0
- claudescientist-5.1.0/src/cockpit/text_width.py +125 -0
- claudescientist-5.1.0/src/cockpit/theme/__init__.py +55 -0
- claudescientist-5.1.0/src/cockpit/theme/cockpit.tcss +313 -0
- claudescientist-5.1.0/src/cockpit/theme/themes.py +219 -0
- claudescientist-5.1.0/src/cockpit/theme/tokens.py +145 -0
- claudescientist-5.1.0/src/cockpit/tui.py +69 -0
- claudescientist-5.1.0/src/memory_mcp/__init__.py +99 -0
- claudescientist-5.1.0/src/memory_mcp/bt_simulation.py +145 -0
- claudescientist-5.1.0/src/memory_mcp/db.py +174 -0
- claudescientist-5.1.0/src/memory_mcp/dev_server.py +40 -0
- claudescientist-5.1.0/src/memory_mcp/impl.py +62 -0
- claudescientist-5.1.0/src/memory_mcp/schema.sql +184 -0
- claudescientist-5.1.0/src/memory_mcp/server.py +16 -0
- claudescientist-5.1.0/src/memory_mcp/tools/__init__.py +5 -0
- claudescientist-5.1.0/src/memory_mcp/tools/_common.py +68 -0
- claudescientist-5.1.0/src/memory_mcp/tools/bt.py +693 -0
- claudescientist-5.1.0/src/memory_mcp/tools/calibration.py +109 -0
- claudescientist-5.1.0/src/memory_mcp/tools/failures.py +262 -0
- claudescientist-5.1.0/src/memory_mcp/tools/graph.py +147 -0
- claudescientist-5.1.0/src/memory_mcp/tools/literature.py +93 -0
- claudescientist-5.1.0/src/memory_mcp/tools/replay.py +298 -0
- claudescientist-5.1.0/src/prove_mcp/__init__.py +87 -0
- claudescientist-5.1.0/src/prove_mcp/db.py +169 -0
- claudescientist-5.1.0/src/prove_mcp/dev_server.py +40 -0
- claudescientist-5.1.0/src/prove_mcp/embedding.py +326 -0
- claudescientist-5.1.0/src/prove_mcp/impl.py +68 -0
- claudescientist-5.1.0/src/prove_mcp/schema.sql +100 -0
- claudescientist-5.1.0/src/prove_mcp/server.py +16 -0
- claudescientist-5.1.0/src/prove_mcp/tools/__init__.py +0 -0
- claudescientist-5.1.0/src/prove_mcp/tools/_common.py +53 -0
- claudescientist-5.1.0/src/prove_mcp/tools/corpus.py +380 -0
- claudescientist-5.1.0/src/prove_mcp/tools/correction.py +169 -0
- claudescientist-5.1.0/src/prove_mcp/tools/diagnosis.py +288 -0
- claudescientist-5.1.0/src/prove_mcp/tools/lean_bridge.py +418 -0
- claudescientist-5.1.0/src/prove_mcp/tools/nodes.py +242 -0
- claudescientist-5.1.0/src/prove_mcp/tools/retrieval.py +204 -0
- claudescientist-5.1.0/src/prove_mcp/tools/segmentation.py +108 -0
- claudescientist-5.1.0/src/verify_mcp/__init__.py +89 -0
- claudescientist-5.1.0/src/verify_mcp/budget.py +78 -0
- claudescientist-5.1.0/src/verify_mcp/db.py +243 -0
- claudescientist-5.1.0/src/verify_mcp/dev_server.py +40 -0
- claudescientist-5.1.0/src/verify_mcp/heldout.py +161 -0
- claudescientist-5.1.0/src/verify_mcp/heldout_cli.py +69 -0
- claudescientist-5.1.0/src/verify_mcp/impl.py +45 -0
- claudescientist-5.1.0/src/verify_mcp/leakage.py +158 -0
- claudescientist-5.1.0/src/verify_mcp/provenance.py +38 -0
- claudescientist-5.1.0/src/verify_mcp/run_manifest.py +277 -0
- claudescientist-5.1.0/src/verify_mcp/server.py +16 -0
- claudescientist-5.1.0/src/verify_mcp/tools/__init__.py +5 -0
- claudescientist-5.1.0/src/verify_mcp/tools/_common.py +48 -0
- claudescientist-5.1.0/src/verify_mcp/tools/budget.py +171 -0
- claudescientist-5.1.0/src/verify_mcp/tools/heldout.py +232 -0
- claudescientist-5.1.0/src/verify_mcp/tools/leakage.py +13 -0
- claudescientist-5.1.0/src/verify_mcp/tools/prereg.py +296 -0
- claudescientist-5.1.0/src/verify_mcp/tools/provenance.py +443 -0
- claudescientist-5.1.0/src/verify_mcp/tools/reporting.py +50 -0
- claudescientist-5.1.0/src/verify_mcp/tools/verification.py +263 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 whenpoem
|
|
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.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claudescientist
|
|
3
|
+
Version: 5.1.0
|
|
4
|
+
Summary: Research-agent augmentation layer for Claude Code with SQLite memory, verification MCPs, a proof trunk with NL workflow + Lean reinsurance, and a Textual cockpit TUI.
|
|
5
|
+
Keywords: claude-code,mcp,research,sqlite,textual,tui,proof,lean,statistics,formal-methods
|
|
6
|
+
Author: whenpoem
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Requires-Dist: fastmcp>=3.2.4
|
|
17
|
+
Requires-Dist: numpy>=1.26
|
|
18
|
+
Requires-Dist: pydantic>=2.13.1
|
|
19
|
+
Requires-Dist: textual>=8.2,<9.0
|
|
20
|
+
Requires-Dist: questionary>=2.0
|
|
21
|
+
Requires-Dist: sentence-transformers>=2.2 ; extra == 'all'
|
|
22
|
+
Requires-Dist: openai>=1.0 ; extra == 'all'
|
|
23
|
+
Requires-Dist: sentence-transformers>=2.2 ; extra == 'embed-local'
|
|
24
|
+
Requires-Dist: openai>=1.0 ; extra == 'embed-openai'
|
|
25
|
+
Requires-Dist: sentence-transformers>=2.2 ; extra == 'proof'
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Project-URL: Repository, https://github.com/whenpoem/aiscientist
|
|
28
|
+
Project-URL: Issues, https://github.com/whenpoem/aiscientist/issues
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Provides-Extra: embed-local
|
|
31
|
+
Provides-Extra: embed-openai
|
|
32
|
+
Provides-Extra: proof
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# ClaudeScientist
|
|
36
|
+
|
|
37
|
+
**A research co-pilot that remembers, verifies, and lets you steer.**
|
|
38
|
+
|
|
39
|
+
[](https://github.com/whenpoem/aiscientist/releases) [](https://www.python.org/) [](https://github.com/whenpoem/aiscientist/actions/workflows/ci.yml) [](LICENSE)
|
|
40
|
+
|
|
41
|
+
> 中文版本: [README.zh-CN.md](README.zh-CN.md)
|
|
42
|
+
|
|
43
|
+
ClaudeScientist plugs into Claude Code or Codex and adds what most AI scientist systems leave out: it remembers what you've tried, verifies your numbers before you publish them, and gives you a live terminal dashboard where you can watch the research unfold and step in at any time.
|
|
44
|
+
|
|
45
|
+
You give the agent a research question. It generates hypotheses, ranks them in a tournament, runs experiments with built-in safety checks, and tracks provenance for every number it produces. You watch the whole process in a second terminal and can reject, redirect, or approve at any point.
|
|
46
|
+
|
|
47
|
+
**Current version**: v5.1.0 is a trust-calibration and portability release.
|
|
48
|
+
Bradley-Terry rankings are refit from the complete ledger and no longer depend
|
|
49
|
+
on comparison order; their intervals are honestly labelled as uncalibrated
|
|
50
|
+
approximations. Bonferroni families are fixed when locked. Every central run
|
|
51
|
+
automatically fingerprints code, inputs, Git state, dependencies, seeds, and
|
|
52
|
+
runtime. A public Codex plugin bundles the core MCPs, Skills, hooks, and local
|
|
53
|
+
Cockpit without tying them to this repository's working directory. The v5.0
|
|
54
|
+
activity-streaming Cockpit remains intact; see
|
|
55
|
+
[ADR 0011](docs/adr/0011-cockpit-activity-streaming.md).
|
|
56
|
+
|
|
57
|
+
**v4.2.0 features retained** (see [retrospective-v4.2.md](docs/retrospective-v4.2.md)): tab grouping into Cross / Empirical / Proof, collapsible detail sections, pane-scoped `w`/`i`/`t` keys, the multi-provider vector backend (DashScope / Jina / Voyage / GLM tested via [ADR 0010](docs/adr/0010-multi-provider-embeddings.md), default local `Qwen/Qwen3-Embedding-0.6B`), reports-as-files (closure / draft / diagnostic / portfolio / cascade) per [ADR 0009](docs/adr/0009-reports-as-files-monitoring-as-tui.md), and the cold-start Welcome screen. See [architecture.md §13](docs/architecture.md#13-core-vs-domain-trunks-v40) for the two-trunk split.
|
|
58
|
+
|
|
59
|
+
## What it looks like
|
|
60
|
+
|
|
61
|
+
Open two terminals side by side. That's the whole UI.
|
|
62
|
+
|
|
63
|
+
<picture>
|
|
64
|
+
<img alt="Cockpit TUI screenshot" src="docs/assets/image2.png" width="800">
|
|
65
|
+
</picture>
|
|
66
|
+
|
|
67
|
+
*The cockpit TUI — hypothesis tree, evidence, ratings, and event stream in one terminal.*
|
|
68
|
+
|
|
69
|
+
The two terminals don't talk to each other directly — they both read and write the same SQLite file. This is the central design choice: every module collaborates through a shared database, not over the network.
|
|
70
|
+
|
|
71
|
+
| Role | Where | What it does |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| **Claude Code / Codex** | Terminal A | Drives the research: understands your question, calls tools, writes and runs code |
|
|
74
|
+
| **MCP servers** | Background | Provide the tools the agent calls — memory, verification, literature search, proof generation |
|
|
75
|
+
| **Hooks** | Auto-loaded at startup | Run safety checks before/after every tool call (block data leaks, log provenance) |
|
|
76
|
+
| **Cockpit TUI** | Terminal B | Shows live state; lets you approve, reject, or redirect hypotheses |
|
|
77
|
+
| **SQLite** | `.research-agent/state.db` | The single file that holds all state: hypotheses, evidence, ratings, metrics, events |
|
|
78
|
+
|
|
79
|
+
## What you can do with it
|
|
80
|
+
|
|
81
|
+
- **Track your research thinking.** Every hypothesis, piece of evidence, and branching decision lives in a persistent graph. Papers you read along the way are compressed and searchable. Come back next week — it's all there. Want to revisit a direction you pruned? Run a counterfactual replay without touching the live state.
|
|
82
|
+
- **Rank competing ideas.** A Bradley-Terry tournament compares hypotheses
|
|
83
|
+
head-to-head and produces an order-invariant leaderboard with explicitly
|
|
84
|
+
uncalibrated approximate posterior intervals. Use it with comparison coverage
|
|
85
|
+
and domain evidence, not as a significance test.
|
|
86
|
+
- **Lock your goalposts before experimenting.** Preregistration makes you commit to a metric, direction, and threshold before you see results. Multiple-comparison correction is applied automatically.
|
|
87
|
+
- **Make your numbers trustworthy.** Every reported number gets checked: Is it reproducible across random seeds? Which files produced it? Has anything changed since? Baseline comparisons are checked for fair compute budgets. A reviewer agent blocks any unverified claim from reaching a writeup.
|
|
88
|
+
- **Catch mistakes before they compound.** A failure ledger remembers every debugging session. Next time you hit a similar problem, the system surfaces how you fixed it before.
|
|
89
|
+
- **Watch and steer in real time.** The cockpit TUI shows the hypothesis tree, ratings, and event stream live. Press a key to reject a bad hypothesis or inject a note — interventions are picked up at the next turn.
|
|
90
|
+
- **Generate and verify statistical proofs** *(v4.0).* A proof trunk handles drafting, segmentation, diagnosis against known error patterns, and optional Lean 4 formal verification.
|
|
91
|
+
|
|
92
|
+
## Quick start
|
|
93
|
+
|
|
94
|
+
### Install the public Codex plugin
|
|
95
|
+
|
|
96
|
+
The plugin works from any research project; Codex does not need to start inside
|
|
97
|
+
the ClaudeScientist source checkout.
|
|
98
|
+
|
|
99
|
+
```powershell
|
|
100
|
+
uv tool run --from claudescientist==5.1.0 claudescientist setup --scope user
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This command installs the marketplace at the matching `v5.1.0` Git tag and
|
|
104
|
+
then installs the plugin. The Python package and Git tag must both be published
|
|
105
|
+
before this public command can work; source-checkout testing does not replace
|
|
106
|
+
that release step. See [docs/setup-codex-plugin.md](docs/setup-codex-plugin.md)
|
|
107
|
+
for the equivalent manual commands.
|
|
108
|
+
|
|
109
|
+
Start a new Codex task after installation. Approve/trust the plugin hooks when
|
|
110
|
+
Codex asks. MCP monitoring works without hook trust, but Cockpit interventions
|
|
111
|
+
remain **monitor-only** until the hooks are trusted.
|
|
112
|
+
|
|
113
|
+
From the research project you want to monitor:
|
|
114
|
+
|
|
115
|
+
```powershell
|
|
116
|
+
uv tool run --from claudescientist==5.1.0 claudescientist doctor --workspace .
|
|
117
|
+
uv tool run --from claudescientist==5.1.0 claudescientist cockpit --workspace . --lang zh
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Each project keeps independent state in its own `.research-agent/state.db`.
|
|
121
|
+
The public plugin enables only the four local core MCPs (`memory`, `verify`,
|
|
122
|
+
`prove`, `cockpit`). arXiv, OpenAlex, and Lean remain explicit opt-ins.
|
|
123
|
+
|
|
124
|
+
### Develop from this checkout
|
|
125
|
+
|
|
126
|
+
Install and run the setup wizard:
|
|
127
|
+
|
|
128
|
+
```powershell
|
|
129
|
+
uv sync
|
|
130
|
+
uv run python -m claudescientist.setup
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The wizard walks you through AI client selection (`claude`, `codex`, or
|
|
134
|
+
`both`), embedding backend, proof corpus seeding, held-out directory, Lean
|
|
135
|
+
toolchain, and auto-prune — all in one pass. Run it again any time; it skips
|
|
136
|
+
steps that are already done.
|
|
137
|
+
|
|
138
|
+
For non-interactive setup, set `CLAUDESCIENTIST_SETUP_AGENT_HOST=codex` or
|
|
139
|
+
`CLAUDESCIENTIST_SETUP_AGENT_HOST=both`. Codex support is project-local: setup
|
|
140
|
+
generates `.codex/config.toml`, `.codex/agents/*.toml`, and repo skills under
|
|
141
|
+
`.agents/skills/` from the existing Claude Code assets.
|
|
142
|
+
|
|
143
|
+
Literature search uses two external MCPs. arXiv is launched through
|
|
144
|
+
`uv tool run arxiv-mcp-server==0.5.0`; OpenAlex is launched through
|
|
145
|
+
`npx -y openalex-research-mcp@0.5.0`, so install Node.js/npm if you want the
|
|
146
|
+
OpenAlex-backed librarian tools.
|
|
147
|
+
|
|
148
|
+
<details><summary>Manual setup (without the wizard)</summary>
|
|
149
|
+
|
|
150
|
+
```powershell
|
|
151
|
+
uv sync --extra proof # pulls in sentence-transformers for the proof trunk
|
|
152
|
+
uv run python scripts/seed_proof_corpus.py
|
|
153
|
+
uv run python scripts/seed_proof_failures.py
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
</details>
|
|
157
|
+
|
|
158
|
+
For checkout development, open two terminals from the repo root:
|
|
159
|
+
|
|
160
|
+
```powershell
|
|
161
|
+
# Terminal A: Claude Code (from the repo root)
|
|
162
|
+
claude
|
|
163
|
+
|
|
164
|
+
# Or Terminal A: Codex (after choosing codex/both in setup)
|
|
165
|
+
codex -C .
|
|
166
|
+
|
|
167
|
+
# Terminal B: cockpit TUI (from the repo root)
|
|
168
|
+
uv run python -m cockpit.tui
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
For the Chinese UI on Windows Terminal:
|
|
172
|
+
|
|
173
|
+
```powershell
|
|
174
|
+
chcp 65001
|
|
175
|
+
$env:PYTHONUTF8=1
|
|
176
|
+
uv run python -m cockpit.tui --lang zh
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Press `L` inside the TUI to toggle English / Chinese labels.
|
|
180
|
+
|
|
181
|
+
In Codex, start ClaudeScientist skills with `/skills` or `$skill-name`.
|
|
182
|
+
Example:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
$research-sop investigate whether per-head dropout helps ViT scaling
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
In Codex, do not type `/research-sop`; that form is for Claude Code.
|
|
189
|
+
If `$research-sop` does not appear in project-local development mode, check that
|
|
190
|
+
`.agents/skills/research-sop/SKILL.md` exists and restart Codex. Installed plugin
|
|
191
|
+
skills work from any project directory.
|
|
192
|
+
|
|
193
|
+
Lean formal verification is a separate opt-in setup. In Codex, the generated
|
|
194
|
+
Lean MCP server is disabled until you finish that setup. See
|
|
195
|
+
[`docs/setup-lean.md`](docs/setup-lean.md).
|
|
196
|
+
|
|
197
|
+
## Where to go next
|
|
198
|
+
|
|
199
|
+
If you're new, read in this order:
|
|
200
|
+
|
|
201
|
+
1. **[`docs/overview.md`](docs/overview.md)** — the complete mental model: how the pieces fit, what happens end-to-end, the three design principles
|
|
202
|
+
2. **[`docs/workflows/first-research-task.md`](docs/workflows/first-research-task.md)** — walk through one full task from start to finish
|
|
203
|
+
3. **[`docs/architecture.md`](docs/architecture.md)** — the contracts between modules (treat as binding)
|
|
204
|
+
4. **[`docs/tool-reference.md`](docs/tool-reference.md)** — every MCP tool, with signature and usage guidance
|
|
205
|
+
5. **[`docs/setup-codex-plugin.md`](docs/setup-codex-plugin.md)** — portable Codex installation and Cockpit trust checks
|
|
206
|
+
|
|
207
|
+
More:
|
|
208
|
+
|
|
209
|
+
- Design rationale for each major decision → [`docs/adr/`](docs/adr/)
|
|
210
|
+
- Where the project is headed → [`docs/roadmap.md`](docs/roadmap.md)
|
|
211
|
+
- Historical plans → [`docs/archive/`](docs/archive/)
|
|
212
|
+
- Agent and contributor rules → [`AGENTS.md`](AGENTS.md)
|
|
213
|
+
|
|
214
|
+
## Runtime details
|
|
215
|
+
|
|
216
|
+
Default paths:
|
|
217
|
+
|
|
218
|
+
- Shared state: `.research-agent/state.db` under the active research workspace
|
|
219
|
+
- Generated reports: `reports/` under the active research workspace; gitignored by default,
|
|
220
|
+
force-add individual files only when you intentionally want to share them
|
|
221
|
+
- Held-out datasets: `%USERPROFILE%\.research-agent\heldout`, configurable via `RESEARCH_AGENT_HELDOUT_DIR`
|
|
222
|
+
- Embedding backend: `local` (sentence-transformers/Qwen/Qwen3-Embedding-0.6B); override with `RESEARCH_AGENT_EMBED_BACKEND=mock|openai`. Tests use `mock` automatically.
|
|
223
|
+
|
|
224
|
+
Dev server commands for individual MCP modules:
|
|
225
|
+
|
|
226
|
+
```powershell
|
|
227
|
+
uv run python -m memory_mcp.dev_server
|
|
228
|
+
uv run python -m verify_mcp.dev_server
|
|
229
|
+
uv run python -m prove_mcp.dev_server
|
|
230
|
+
uv run python -m cockpit.mcp_server
|
|
231
|
+
uv run python -m claudescientist.heldout register <name> <path>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Validation
|
|
235
|
+
|
|
236
|
+
Before shipping a change:
|
|
237
|
+
|
|
238
|
+
```powershell
|
|
239
|
+
uv run ruff check
|
|
240
|
+
uv run pytest tests/memory_mcp tests/verify_mcp tests/prove_mcp tests/hooks tests/cockpit tests/scripts tests/e2e
|
|
241
|
+
uv run python -m cockpit.tui --once --lang zh
|
|
242
|
+
uv run python -c "import memory_mcp.server; import verify_mcp.server; import prove_mcp.server; import cockpit.mcp_server; print('OK')"
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Current status
|
|
246
|
+
|
|
247
|
+
The repo works for local development and integration. A fresh end-to-end validation pass is needed before calling it production-ready.
|
|
248
|
+
|
|
249
|
+
A few things to know:
|
|
250
|
+
|
|
251
|
+
- **Auto-prune is dry-run by default.** Set `RESEARCH_AGENT_AUTO_PRUNE=1` to let it actually pause weak branches.
|
|
252
|
+
- **The cockpit is terminal-only.** No browser frontend, no web server.
|
|
253
|
+
- **The prover agent works without Lean.** The NL proof workflow runs on its own; Lean is extra insurance you can set up later via [`docs/setup-lean.md`](docs/setup-lean.md).
|
|
254
|
+
- **`mem_nodes.elo_score` is a legacy column.** New code should read `mem_bt_ratings.strength`.
|
|
255
|
+
|
|
256
|
+
Protection labels are deliberately explicit: `enforced` means code blocks the
|
|
257
|
+
normal operation; `agent_gated` means the agent workflow refuses or reviews it
|
|
258
|
+
but is not a security boundary; `advisory` means warning only. Run
|
|
259
|
+
`claudescientist doctor --workspace .` to see whether Cockpit intervention hooks
|
|
260
|
+
are trusted or the current session has degraded to monitor-only mode.
|
|
261
|
+
|
|
262
|
+
Full tool list and scope details: [`docs/tool-reference.md`](docs/tool-reference.md) and [`AGENTS.md`](AGENTS.md).
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# ClaudeScientist
|
|
2
|
+
|
|
3
|
+
**A research co-pilot that remembers, verifies, and lets you steer.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/whenpoem/aiscientist/releases) [](https://www.python.org/) [](https://github.com/whenpoem/aiscientist/actions/workflows/ci.yml) [](LICENSE)
|
|
6
|
+
|
|
7
|
+
> 中文版本: [README.zh-CN.md](README.zh-CN.md)
|
|
8
|
+
|
|
9
|
+
ClaudeScientist plugs into Claude Code or Codex and adds what most AI scientist systems leave out: it remembers what you've tried, verifies your numbers before you publish them, and gives you a live terminal dashboard where you can watch the research unfold and step in at any time.
|
|
10
|
+
|
|
11
|
+
You give the agent a research question. It generates hypotheses, ranks them in a tournament, runs experiments with built-in safety checks, and tracks provenance for every number it produces. You watch the whole process in a second terminal and can reject, redirect, or approve at any point.
|
|
12
|
+
|
|
13
|
+
**Current version**: v5.1.0 is a trust-calibration and portability release.
|
|
14
|
+
Bradley-Terry rankings are refit from the complete ledger and no longer depend
|
|
15
|
+
on comparison order; their intervals are honestly labelled as uncalibrated
|
|
16
|
+
approximations. Bonferroni families are fixed when locked. Every central run
|
|
17
|
+
automatically fingerprints code, inputs, Git state, dependencies, seeds, and
|
|
18
|
+
runtime. A public Codex plugin bundles the core MCPs, Skills, hooks, and local
|
|
19
|
+
Cockpit without tying them to this repository's working directory. The v5.0
|
|
20
|
+
activity-streaming Cockpit remains intact; see
|
|
21
|
+
[ADR 0011](docs/adr/0011-cockpit-activity-streaming.md).
|
|
22
|
+
|
|
23
|
+
**v4.2.0 features retained** (see [retrospective-v4.2.md](docs/retrospective-v4.2.md)): tab grouping into Cross / Empirical / Proof, collapsible detail sections, pane-scoped `w`/`i`/`t` keys, the multi-provider vector backend (DashScope / Jina / Voyage / GLM tested via [ADR 0010](docs/adr/0010-multi-provider-embeddings.md), default local `Qwen/Qwen3-Embedding-0.6B`), reports-as-files (closure / draft / diagnostic / portfolio / cascade) per [ADR 0009](docs/adr/0009-reports-as-files-monitoring-as-tui.md), and the cold-start Welcome screen. See [architecture.md §13](docs/architecture.md#13-core-vs-domain-trunks-v40) for the two-trunk split.
|
|
24
|
+
|
|
25
|
+
## What it looks like
|
|
26
|
+
|
|
27
|
+
Open two terminals side by side. That's the whole UI.
|
|
28
|
+
|
|
29
|
+
<picture>
|
|
30
|
+
<img alt="Cockpit TUI screenshot" src="docs/assets/image2.png" width="800">
|
|
31
|
+
</picture>
|
|
32
|
+
|
|
33
|
+
*The cockpit TUI — hypothesis tree, evidence, ratings, and event stream in one terminal.*
|
|
34
|
+
|
|
35
|
+
The two terminals don't talk to each other directly — they both read and write the same SQLite file. This is the central design choice: every module collaborates through a shared database, not over the network.
|
|
36
|
+
|
|
37
|
+
| Role | Where | What it does |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| **Claude Code / Codex** | Terminal A | Drives the research: understands your question, calls tools, writes and runs code |
|
|
40
|
+
| **MCP servers** | Background | Provide the tools the agent calls — memory, verification, literature search, proof generation |
|
|
41
|
+
| **Hooks** | Auto-loaded at startup | Run safety checks before/after every tool call (block data leaks, log provenance) |
|
|
42
|
+
| **Cockpit TUI** | Terminal B | Shows live state; lets you approve, reject, or redirect hypotheses |
|
|
43
|
+
| **SQLite** | `.research-agent/state.db` | The single file that holds all state: hypotheses, evidence, ratings, metrics, events |
|
|
44
|
+
|
|
45
|
+
## What you can do with it
|
|
46
|
+
|
|
47
|
+
- **Track your research thinking.** Every hypothesis, piece of evidence, and branching decision lives in a persistent graph. Papers you read along the way are compressed and searchable. Come back next week — it's all there. Want to revisit a direction you pruned? Run a counterfactual replay without touching the live state.
|
|
48
|
+
- **Rank competing ideas.** A Bradley-Terry tournament compares hypotheses
|
|
49
|
+
head-to-head and produces an order-invariant leaderboard with explicitly
|
|
50
|
+
uncalibrated approximate posterior intervals. Use it with comparison coverage
|
|
51
|
+
and domain evidence, not as a significance test.
|
|
52
|
+
- **Lock your goalposts before experimenting.** Preregistration makes you commit to a metric, direction, and threshold before you see results. Multiple-comparison correction is applied automatically.
|
|
53
|
+
- **Make your numbers trustworthy.** Every reported number gets checked: Is it reproducible across random seeds? Which files produced it? Has anything changed since? Baseline comparisons are checked for fair compute budgets. A reviewer agent blocks any unverified claim from reaching a writeup.
|
|
54
|
+
- **Catch mistakes before they compound.** A failure ledger remembers every debugging session. Next time you hit a similar problem, the system surfaces how you fixed it before.
|
|
55
|
+
- **Watch and steer in real time.** The cockpit TUI shows the hypothesis tree, ratings, and event stream live. Press a key to reject a bad hypothesis or inject a note — interventions are picked up at the next turn.
|
|
56
|
+
- **Generate and verify statistical proofs** *(v4.0).* A proof trunk handles drafting, segmentation, diagnosis against known error patterns, and optional Lean 4 formal verification.
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
### Install the public Codex plugin
|
|
61
|
+
|
|
62
|
+
The plugin works from any research project; Codex does not need to start inside
|
|
63
|
+
the ClaudeScientist source checkout.
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
uv tool run --from claudescientist==5.1.0 claudescientist setup --scope user
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This command installs the marketplace at the matching `v5.1.0` Git tag and
|
|
70
|
+
then installs the plugin. The Python package and Git tag must both be published
|
|
71
|
+
before this public command can work; source-checkout testing does not replace
|
|
72
|
+
that release step. See [docs/setup-codex-plugin.md](docs/setup-codex-plugin.md)
|
|
73
|
+
for the equivalent manual commands.
|
|
74
|
+
|
|
75
|
+
Start a new Codex task after installation. Approve/trust the plugin hooks when
|
|
76
|
+
Codex asks. MCP monitoring works without hook trust, but Cockpit interventions
|
|
77
|
+
remain **monitor-only** until the hooks are trusted.
|
|
78
|
+
|
|
79
|
+
From the research project you want to monitor:
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
uv tool run --from claudescientist==5.1.0 claudescientist doctor --workspace .
|
|
83
|
+
uv tool run --from claudescientist==5.1.0 claudescientist cockpit --workspace . --lang zh
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Each project keeps independent state in its own `.research-agent/state.db`.
|
|
87
|
+
The public plugin enables only the four local core MCPs (`memory`, `verify`,
|
|
88
|
+
`prove`, `cockpit`). arXiv, OpenAlex, and Lean remain explicit opt-ins.
|
|
89
|
+
|
|
90
|
+
### Develop from this checkout
|
|
91
|
+
|
|
92
|
+
Install and run the setup wizard:
|
|
93
|
+
|
|
94
|
+
```powershell
|
|
95
|
+
uv sync
|
|
96
|
+
uv run python -m claudescientist.setup
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The wizard walks you through AI client selection (`claude`, `codex`, or
|
|
100
|
+
`both`), embedding backend, proof corpus seeding, held-out directory, Lean
|
|
101
|
+
toolchain, and auto-prune — all in one pass. Run it again any time; it skips
|
|
102
|
+
steps that are already done.
|
|
103
|
+
|
|
104
|
+
For non-interactive setup, set `CLAUDESCIENTIST_SETUP_AGENT_HOST=codex` or
|
|
105
|
+
`CLAUDESCIENTIST_SETUP_AGENT_HOST=both`. Codex support is project-local: setup
|
|
106
|
+
generates `.codex/config.toml`, `.codex/agents/*.toml`, and repo skills under
|
|
107
|
+
`.agents/skills/` from the existing Claude Code assets.
|
|
108
|
+
|
|
109
|
+
Literature search uses two external MCPs. arXiv is launched through
|
|
110
|
+
`uv tool run arxiv-mcp-server==0.5.0`; OpenAlex is launched through
|
|
111
|
+
`npx -y openalex-research-mcp@0.5.0`, so install Node.js/npm if you want the
|
|
112
|
+
OpenAlex-backed librarian tools.
|
|
113
|
+
|
|
114
|
+
<details><summary>Manual setup (without the wizard)</summary>
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
uv sync --extra proof # pulls in sentence-transformers for the proof trunk
|
|
118
|
+
uv run python scripts/seed_proof_corpus.py
|
|
119
|
+
uv run python scripts/seed_proof_failures.py
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
For checkout development, open two terminals from the repo root:
|
|
125
|
+
|
|
126
|
+
```powershell
|
|
127
|
+
# Terminal A: Claude Code (from the repo root)
|
|
128
|
+
claude
|
|
129
|
+
|
|
130
|
+
# Or Terminal A: Codex (after choosing codex/both in setup)
|
|
131
|
+
codex -C .
|
|
132
|
+
|
|
133
|
+
# Terminal B: cockpit TUI (from the repo root)
|
|
134
|
+
uv run python -m cockpit.tui
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
For the Chinese UI on Windows Terminal:
|
|
138
|
+
|
|
139
|
+
```powershell
|
|
140
|
+
chcp 65001
|
|
141
|
+
$env:PYTHONUTF8=1
|
|
142
|
+
uv run python -m cockpit.tui --lang zh
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Press `L` inside the TUI to toggle English / Chinese labels.
|
|
146
|
+
|
|
147
|
+
In Codex, start ClaudeScientist skills with `/skills` or `$skill-name`.
|
|
148
|
+
Example:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
$research-sop investigate whether per-head dropout helps ViT scaling
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
In Codex, do not type `/research-sop`; that form is for Claude Code.
|
|
155
|
+
If `$research-sop` does not appear in project-local development mode, check that
|
|
156
|
+
`.agents/skills/research-sop/SKILL.md` exists and restart Codex. Installed plugin
|
|
157
|
+
skills work from any project directory.
|
|
158
|
+
|
|
159
|
+
Lean formal verification is a separate opt-in setup. In Codex, the generated
|
|
160
|
+
Lean MCP server is disabled until you finish that setup. See
|
|
161
|
+
[`docs/setup-lean.md`](docs/setup-lean.md).
|
|
162
|
+
|
|
163
|
+
## Where to go next
|
|
164
|
+
|
|
165
|
+
If you're new, read in this order:
|
|
166
|
+
|
|
167
|
+
1. **[`docs/overview.md`](docs/overview.md)** — the complete mental model: how the pieces fit, what happens end-to-end, the three design principles
|
|
168
|
+
2. **[`docs/workflows/first-research-task.md`](docs/workflows/first-research-task.md)** — walk through one full task from start to finish
|
|
169
|
+
3. **[`docs/architecture.md`](docs/architecture.md)** — the contracts between modules (treat as binding)
|
|
170
|
+
4. **[`docs/tool-reference.md`](docs/tool-reference.md)** — every MCP tool, with signature and usage guidance
|
|
171
|
+
5. **[`docs/setup-codex-plugin.md`](docs/setup-codex-plugin.md)** — portable Codex installation and Cockpit trust checks
|
|
172
|
+
|
|
173
|
+
More:
|
|
174
|
+
|
|
175
|
+
- Design rationale for each major decision → [`docs/adr/`](docs/adr/)
|
|
176
|
+
- Where the project is headed → [`docs/roadmap.md`](docs/roadmap.md)
|
|
177
|
+
- Historical plans → [`docs/archive/`](docs/archive/)
|
|
178
|
+
- Agent and contributor rules → [`AGENTS.md`](AGENTS.md)
|
|
179
|
+
|
|
180
|
+
## Runtime details
|
|
181
|
+
|
|
182
|
+
Default paths:
|
|
183
|
+
|
|
184
|
+
- Shared state: `.research-agent/state.db` under the active research workspace
|
|
185
|
+
- Generated reports: `reports/` under the active research workspace; gitignored by default,
|
|
186
|
+
force-add individual files only when you intentionally want to share them
|
|
187
|
+
- Held-out datasets: `%USERPROFILE%\.research-agent\heldout`, configurable via `RESEARCH_AGENT_HELDOUT_DIR`
|
|
188
|
+
- Embedding backend: `local` (sentence-transformers/Qwen/Qwen3-Embedding-0.6B); override with `RESEARCH_AGENT_EMBED_BACKEND=mock|openai`. Tests use `mock` automatically.
|
|
189
|
+
|
|
190
|
+
Dev server commands for individual MCP modules:
|
|
191
|
+
|
|
192
|
+
```powershell
|
|
193
|
+
uv run python -m memory_mcp.dev_server
|
|
194
|
+
uv run python -m verify_mcp.dev_server
|
|
195
|
+
uv run python -m prove_mcp.dev_server
|
|
196
|
+
uv run python -m cockpit.mcp_server
|
|
197
|
+
uv run python -m claudescientist.heldout register <name> <path>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Validation
|
|
201
|
+
|
|
202
|
+
Before shipping a change:
|
|
203
|
+
|
|
204
|
+
```powershell
|
|
205
|
+
uv run ruff check
|
|
206
|
+
uv run pytest tests/memory_mcp tests/verify_mcp tests/prove_mcp tests/hooks tests/cockpit tests/scripts tests/e2e
|
|
207
|
+
uv run python -m cockpit.tui --once --lang zh
|
|
208
|
+
uv run python -c "import memory_mcp.server; import verify_mcp.server; import prove_mcp.server; import cockpit.mcp_server; print('OK')"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Current status
|
|
212
|
+
|
|
213
|
+
The repo works for local development and integration. A fresh end-to-end validation pass is needed before calling it production-ready.
|
|
214
|
+
|
|
215
|
+
A few things to know:
|
|
216
|
+
|
|
217
|
+
- **Auto-prune is dry-run by default.** Set `RESEARCH_AGENT_AUTO_PRUNE=1` to let it actually pause weak branches.
|
|
218
|
+
- **The cockpit is terminal-only.** No browser frontend, no web server.
|
|
219
|
+
- **The prover agent works without Lean.** The NL proof workflow runs on its own; Lean is extra insurance you can set up later via [`docs/setup-lean.md`](docs/setup-lean.md).
|
|
220
|
+
- **`mem_nodes.elo_score` is a legacy column.** New code should read `mem_bt_ratings.strength`.
|
|
221
|
+
|
|
222
|
+
Protection labels are deliberately explicit: `enforced` means code blocks the
|
|
223
|
+
normal operation; `agent_gated` means the agent workflow refuses or reviews it
|
|
224
|
+
but is not a security boundary; `advisory` means warning only. Run
|
|
225
|
+
`claudescientist doctor --workspace .` to see whether Cockpit intervention hooks
|
|
226
|
+
are trusted or the current session has degraded to monitor-only mode.
|
|
227
|
+
|
|
228
|
+
Full tool list and scope details: [`docs/tool-reference.md`](docs/tool-reference.md) and [`AGENTS.md`](AGENTS.md).
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "claudescientist"
|
|
3
|
+
version = "5.1.0"
|
|
4
|
+
description = "Research-agent augmentation layer for Claude Code with SQLite memory, verification MCPs, a proof trunk with NL workflow + Lean reinsurance, and a Textual cockpit TUI."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "whenpoem" },
|
|
11
|
+
]
|
|
12
|
+
keywords = [
|
|
13
|
+
"claude-code",
|
|
14
|
+
"mcp",
|
|
15
|
+
"research",
|
|
16
|
+
"sqlite",
|
|
17
|
+
"textual",
|
|
18
|
+
"tui",
|
|
19
|
+
"proof",
|
|
20
|
+
"lean",
|
|
21
|
+
"statistics",
|
|
22
|
+
"formal-methods",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 4 - Beta",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
30
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
31
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"fastmcp>=3.2.4",
|
|
35
|
+
"numpy>=1.26",
|
|
36
|
+
"pydantic>=2.13.1",
|
|
37
|
+
"textual>=8.2,<9.0",
|
|
38
|
+
# questionary drives the interactive `python -m claudescientist.setup`
|
|
39
|
+
# wizard. ~30KB itself; pulls in prompt-toolkit (~450KB) which is a
|
|
40
|
+
# widely-shipped dep. Listed as a main requirement (rather than an
|
|
41
|
+
# extra) so first-run users can hit setup without an extra install
|
|
42
|
+
# step. Setup's --non-interactive path does NOT touch questionary.
|
|
43
|
+
"questionary>=2.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
claudescientist = "claudescientist.cli:main"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
# Live embedding backends for the proof trunk (`prove_mcp`). Tests stay on the
|
|
51
|
+
# deterministic mock backend (see tests/conftest.py); these extras are for
|
|
52
|
+
# real cold-start ingest of the proof corpus + diagnose_snippet retrievals.
|
|
53
|
+
embed-local = ["sentence-transformers>=2.2"]
|
|
54
|
+
embed-openai = ["openai>=1.0"]
|
|
55
|
+
proof = ["sentence-transformers>=2.2"] # alias: recommended local setup
|
|
56
|
+
all = ["sentence-transformers>=2.2", "openai>=1.0"]
|
|
57
|
+
|
|
58
|
+
[project.urls]
|
|
59
|
+
Repository = "https://github.com/whenpoem/aiscientist"
|
|
60
|
+
Issues = "https://github.com/whenpoem/aiscientist/issues"
|
|
61
|
+
|
|
62
|
+
[build-system]
|
|
63
|
+
requires = ["uv_build>=0.11.7,<0.12.0"]
|
|
64
|
+
build-backend = "uv_build"
|
|
65
|
+
|
|
66
|
+
[tool.uv.build-backend]
|
|
67
|
+
module-name = [
|
|
68
|
+
"claudescientist",
|
|
69
|
+
"cockpit",
|
|
70
|
+
"memory_mcp",
|
|
71
|
+
"prove_mcp",
|
|
72
|
+
"verify_mcp",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[dependency-groups]
|
|
76
|
+
dev = [
|
|
77
|
+
"pytest>=9.0.3",
|
|
78
|
+
"pytest-asyncio>=1.3.0",
|
|
79
|
+
"ruff>=0.15.10",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
testpaths = ["tests"]
|
|
84
|
+
addopts = "-ra"
|
|
85
|
+
|
|
86
|
+
[tool.ruff]
|
|
87
|
+
target-version = "py311"
|
|
88
|
+
line-length = 100
|
|
89
|
+
src = ["src", "tests", ".claude/hooks"]
|
|
90
|
+
|
|
91
|
+
[tool.ruff.lint]
|
|
92
|
+
select = ["E", "F", "I"]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""claudescientist - Foundation runtime layer for ClaudeScientist.
|
|
2
|
+
|
|
3
|
+
Owns project-wide path resolution, the SQLite connection helper, schema
|
|
4
|
+
migration bookkeeping, the cockpit-event emit primitive, the project-level
|
|
5
|
+
metric-recognition regexes, and the component bootstrap registry. Every
|
|
6
|
+
business module (memory_mcp, verify_mcp, cockpit) depends on this; this
|
|
7
|
+
module must not depend on any of them.
|
|
8
|
+
|
|
9
|
+
Public surface
|
|
10
|
+
--------------
|
|
11
|
+
runtime.state_db_path() Resolve the shared SQLite file path.
|
|
12
|
+
runtime.heldout_root() Resolve the sequestered-dataset root.
|
|
13
|
+
runtime.connect_sqlite() WAL-mode connection with row factory.
|
|
14
|
+
runtime.connect_existing_sqlite() Hook-safe existing-DB connection helper.
|
|
15
|
+
runtime.apply_schema_migration() Per-component schema apply + bookkeeping.
|
|
16
|
+
runtime.emit_cockpit_event() Append a row to cockpit_events in-tx.
|
|
17
|
+
runtime.METRIC_RE / NUMBER_RE Project-wide numeric-claim recognition.
|
|
18
|
+
runtime.extract_metric_tokens() Pull labelled metric values from text.
|
|
19
|
+
runtime.bootstrap_all() Bootstrap every registered component.
|
|
20
|
+
heldout.compute_manifest() Hash a directory into a content manifest.
|
|
21
|
+
heldout.load_manifest() Read a previously-written manifest.
|
|
22
|
+
heldout.write_manifest() Persist a manifest next to the dataset.
|
|
23
|
+
heldout.dataset_root() Resolve a named dataset's root path.
|
|
24
|
+
heldout.main() CLI entry point (lazy bridge to verify_mcp).
|
|
25
|
+
|
|
26
|
+
Owned tables
|
|
27
|
+
------------
|
|
28
|
+
ra_migrations Per-component schema version + apply status (created
|
|
29
|
+
on demand by apply_schema_migration).
|
|
30
|
+
cockpit_events Append-only event stream (created on demand by
|
|
31
|
+
emit_cockpit_event); cross-module signals go here.
|
|
32
|
+
|
|
33
|
+
Critical invariants
|
|
34
|
+
-------------------
|
|
35
|
+
- runtime never imports memory_mcp, verify_mcp, or cockpit at module level.
|
|
36
|
+
``bootstrap_all`` uses ``importlib.import_module`` so this stays true.
|
|
37
|
+
- ``state_db_path()`` is the only legitimate way to find the SQLite file.
|
|
38
|
+
Do not duplicate path resolution.
|
|
39
|
+
- ``METRIC_RE`` / ``extract_metric_tokens`` are project-wide; verify_mcp.
|
|
40
|
+
provenance and the hooks both consume them through this module.
|
|
41
|
+
- ``KNOWN_BOOTSTRAP_COMPONENTS`` is the single registry of "modules that
|
|
42
|
+
own a SQLite schema". Add new MCP servers here, not in cockpit.
|
|
43
|
+
|
|
44
|
+
Where things live
|
|
45
|
+
-----------------
|
|
46
|
+
Path / DB helpers: runtime.py
|
|
47
|
+
Schema migration: runtime.apply_schema_migration
|
|
48
|
+
Numeric recognition: runtime.METRIC_RE, NUMBER_RE, extract_metric_tokens
|
|
49
|
+
Component bootstrap: runtime.KNOWN_BOOTSTRAP_COMPONENTS, bootstrap_all
|
|
50
|
+
Pure file ops: heldout.py (compute_manifest etc.)
|
|
51
|
+
CLI entry shim: heldout.main -> verify_mcp.heldout_cli.main
|
|
52
|
+
|
|
53
|
+
Do NOT
|
|
54
|
+
------
|
|
55
|
+
- Import from memory_mcp, verify_mcp, or cockpit at module level. The CLI
|
|
56
|
+
forwarder in heldout.main does the import lazily; that is the only
|
|
57
|
+
permitted exception.
|
|
58
|
+
- Add SQL DDL to runtime.py for business tables. Each component owns its
|
|
59
|
+
own schema in its own db.py.
|
|
60
|
+
- Hard-code paths into the project tree. Always go through state_db_path,
|
|
61
|
+
heldout_root, or runtime_path.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
from __future__ import annotations
|
|
65
|
+
|
|
66
|
+
__all__ = ["__version__"]
|
|
67
|
+
|
|
68
|
+
__version__ = "5.1.0"
|