methodproof 0.3.4__tar.gz → 0.4.1__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.
- {methodproof-0.3.4 → methodproof-0.4.1}/PKG-INFO +3 -1
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/__init__.py +1 -1
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/agents/base.py +30 -1
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/analysis.py +65 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/cli.py +270 -23
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/config.py +42 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/claude_code.py +10 -6
- methodproof-0.4.1/methodproof/hooks/cline_hook.sh +47 -0
- methodproof-0.4.1/methodproof/hooks/codex_hook.sh +62 -0
- methodproof-0.4.1/methodproof/hooks/gemini_hook.sh +58 -0
- methodproof-0.4.1/methodproof/hooks/install.py +246 -0
- methodproof-0.4.1/methodproof/hooks/kiro_hook.sh +70 -0
- methodproof-0.4.1/methodproof/hooks/mcp_register.py +92 -0
- methodproof-0.4.1/methodproof/hooks/opencode_plugin.js +33 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/wrappers.py +20 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/live.py +52 -3
- methodproof-0.4.1/methodproof/proxy.py +162 -0
- methodproof-0.4.1/methodproof/proxy_daemon.py +161 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/sync.py +3 -2
- {methodproof-0.3.4 → methodproof-0.4.1}/pyproject.toml +2 -1
- methodproof-0.3.4/methodproof/hooks/install.py +0 -87
- {methodproof-0.3.4 → methodproof-0.4.1}/.github/workflows/ci.yml +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/.gitignore +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/CHANGELOG.md +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/LICENSE +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/README.md +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/__main__.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/agents/__init__.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/agents/music.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/agents/terminal.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/agents/watcher.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/bridge.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/crypto.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/graph.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hook.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/__init__.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/claude_code.sh +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/openclaw/HOOK.md +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/openclaw/handler.ts +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/hooks/openclaw_install.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/integrity.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/mcp.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/repos.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/skills/methodproof/SKILL.md +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/store.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/methodproof/viewer.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/test_windows_compat.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/__init__.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_analysis.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_graph.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_hooks.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_live.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_openclaw_hooks.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_store.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/tests/test_wrappers.py +0 -0
- {methodproof-0.3.4 → methodproof-0.4.1}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: methodproof
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: See how you code. Capture and visualize your engineering process.
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -9,6 +9,8 @@ Requires-Dist: watchdog>=4.0
|
|
|
9
9
|
Requires-Dist: websocket-client>=1.7
|
|
10
10
|
Provides-Extra: e2e
|
|
11
11
|
Requires-Dist: cryptography>=43.0; extra == 'e2e'
|
|
12
|
+
Provides-Extra: proxy
|
|
13
|
+
Requires-Dist: mitmproxy>=10.0; extra == 'proxy'
|
|
12
14
|
Provides-Extra: signing
|
|
13
15
|
Requires-Dist: cryptography>=43.0; extra == 'signing'
|
|
14
16
|
Description-Content-Type: text/markdown
|
|
@@ -47,6 +47,23 @@ _EVENT_GATES: dict[str, str] = {
|
|
|
47
47
|
"music_playing": "music",
|
|
48
48
|
"environment_profile": "environment_analysis",
|
|
49
49
|
"prompt_outcomes": "ai_prompts",
|
|
50
|
+
"ai_cli_start": "ai_prompts",
|
|
51
|
+
"ai_cli_end": "ai_responses",
|
|
52
|
+
# Hook lifecycle events (all AI tools)
|
|
53
|
+
"user_prompt": "ai_prompts",
|
|
54
|
+
"tool_call": "ai_responses",
|
|
55
|
+
"tool_result": "ai_responses",
|
|
56
|
+
"task_start": "ai_responses",
|
|
57
|
+
"task_end": "ai_responses",
|
|
58
|
+
"agent_launch": "ai_responses",
|
|
59
|
+
"agent_complete": "ai_responses",
|
|
60
|
+
"claude_session_start": "ai_prompts",
|
|
61
|
+
"codex_session_start": "ai_prompts",
|
|
62
|
+
"codex_session_end": "ai_responses",
|
|
63
|
+
"gemini_session_start": "ai_prompts",
|
|
64
|
+
"gemini_session_end": "ai_responses",
|
|
65
|
+
"kiro_session_start": "ai_prompts",
|
|
66
|
+
"kiro_session_end": "ai_responses",
|
|
50
67
|
}
|
|
51
68
|
|
|
52
69
|
# Maps capture categories to (event_type, field) pairs for field-level gating.
|
|
@@ -57,9 +74,11 @@ _FIELD_GATES: dict[str, list[tuple[str, str]]] = {
|
|
|
57
74
|
"code_capture": [("file_edit", "diff"), ("git_commit", "diff")],
|
|
58
75
|
}
|
|
59
76
|
|
|
77
|
+
_journal_mode = False
|
|
78
|
+
|
|
60
79
|
|
|
61
80
|
def init(session_id: str, live: bool = False) -> None:
|
|
62
|
-
global _session_id, _initialized, _e2e_key, _capture, _live_mode, _prev_hash
|
|
81
|
+
global _session_id, _initialized, _e2e_key, _capture, _live_mode, _prev_hash, _journal_mode
|
|
63
82
|
_session_id = session_id
|
|
64
83
|
_initialized = True
|
|
65
84
|
_live_mode = live
|
|
@@ -69,6 +88,7 @@ def init(session_id: str, live: bool = False) -> None:
|
|
|
69
88
|
raw = cfg.get("e2e_key", "")
|
|
70
89
|
_e2e_key = bytes.fromhex(raw) if raw else None
|
|
71
90
|
_capture = cfg.get("capture", {})
|
|
91
|
+
_journal_mode = cfg.get("journal_mode", False)
|
|
72
92
|
|
|
73
93
|
|
|
74
94
|
def log(level: str, event: str, **kw: object) -> None:
|
|
@@ -91,6 +111,15 @@ def emit(event_type: str, metadata: dict[str, Any]) -> None:
|
|
|
91
111
|
if event_type == etype and not _capture.get(category, True):
|
|
92
112
|
metadata.pop(field, None)
|
|
93
113
|
|
|
114
|
+
# Journal mode gate — strip content fields when journal is OFF (default).
|
|
115
|
+
# Structural equivalents (prompt_length, etc.) are always kept.
|
|
116
|
+
# Journal ON = complete explicit record. Journal OFF = structural only.
|
|
117
|
+
if not _journal_mode:
|
|
118
|
+
from methodproof.config import JOURNAL_CONTENT_FIELDS
|
|
119
|
+
for etype, field in JOURNAL_CONTENT_FIELDS:
|
|
120
|
+
if event_type == etype and field in metadata:
|
|
121
|
+
metadata.pop(field, None)
|
|
122
|
+
|
|
94
123
|
entry = {
|
|
95
124
|
"id": uuid.uuid4().hex,
|
|
96
125
|
"session_id": _session_id,
|
|
@@ -439,6 +439,71 @@ def analyze_prompt(text: str) -> dict[str, Any]:
|
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
|
|
442
|
+
def compose_summary(meta: dict[str, Any]) -> str:
|
|
443
|
+
"""Compose a readable prompt summary from structural analysis fields.
|
|
444
|
+
|
|
445
|
+
Replaces dumb 200-char truncation with a meaningful, searchable summary.
|
|
446
|
+
Zero API calls — purely local composition from already-extracted sa_* fields.
|
|
447
|
+
|
|
448
|
+
Examples:
|
|
449
|
+
"[instruction/synthesis] refactor app/auth/middleware.py — dependency injection"
|
|
450
|
+
"[bug_report/execution] fix TypeError in utils.py:parse_config — Python, JSON"
|
|
451
|
+
"[design_question/analysis] caching strategy — Redis, PostgreSQL, 3 constraints"
|
|
452
|
+
"[correction] not that approach — references prior turn"
|
|
453
|
+
"""
|
|
454
|
+
intent = meta.get("sa_intent", "unknown")
|
|
455
|
+
cognitive = meta.get("sa_cognitive_level", "")
|
|
456
|
+
files = meta.get("sa_named_files", [])
|
|
457
|
+
functions = meta.get("sa_named_functions", [])
|
|
458
|
+
classes = meta.get("sa_named_classes", [])
|
|
459
|
+
technologies = meta.get("sa_named_technologies", [])
|
|
460
|
+
languages = meta.get("sa_code_languages", [])
|
|
461
|
+
collab = meta.get("sa_collaboration_mode", "")
|
|
462
|
+
|
|
463
|
+
# Header: [intent/cognitive]
|
|
464
|
+
header = f"[{intent}"
|
|
465
|
+
if cognitive and cognitive != "none":
|
|
466
|
+
header += f"/{cognitive}"
|
|
467
|
+
header += "]"
|
|
468
|
+
|
|
469
|
+
# Entities: files, functions, classes, technologies
|
|
470
|
+
parts: list[str] = []
|
|
471
|
+
if files:
|
|
472
|
+
parts.extend(files[:3])
|
|
473
|
+
if functions:
|
|
474
|
+
parts.extend(functions[:2])
|
|
475
|
+
if classes:
|
|
476
|
+
parts.extend(classes[:2])
|
|
477
|
+
if technologies:
|
|
478
|
+
parts.extend(technologies[:4])
|
|
479
|
+
elif languages:
|
|
480
|
+
parts.extend(languages[:2])
|
|
481
|
+
|
|
482
|
+
# Qualifiers
|
|
483
|
+
qualifiers: list[str] = []
|
|
484
|
+
if meta.get("sa_has_error_trace"):
|
|
485
|
+
qualifiers.append(f"{meta.get('sa_error_trace_lines', 0)} error lines")
|
|
486
|
+
if meta.get("sa_has_constraints"):
|
|
487
|
+
qualifiers.append("constrained")
|
|
488
|
+
if meta.get("sa_has_acceptance_criteria"):
|
|
489
|
+
qualifiers.append("with criteria")
|
|
490
|
+
if meta.get("sa_is_compound"):
|
|
491
|
+
qualifiers.append("multi-part")
|
|
492
|
+
if meta.get("sa_references_prior_turn"):
|
|
493
|
+
qualifiers.append("references prior turn")
|
|
494
|
+
if meta.get("sa_code_block_count", 0) > 0:
|
|
495
|
+
qualifiers.append(f"{meta['sa_code_block_count']} code blocks")
|
|
496
|
+
|
|
497
|
+
# Compose
|
|
498
|
+
summary = header
|
|
499
|
+
if parts:
|
|
500
|
+
summary += " " + ", ".join(dict.fromkeys(parts)) # dedupe preserving order
|
|
501
|
+
if qualifiers:
|
|
502
|
+
summary += " — " + ", ".join(qualifiers[:3])
|
|
503
|
+
|
|
504
|
+
return summary
|
|
505
|
+
|
|
506
|
+
|
|
442
507
|
def scan_environment(watch_dir: str) -> dict[str, Any]:
|
|
443
508
|
"""Scan filesystem for AI instruction files and config. No content stored."""
|
|
444
509
|
home = Path.home()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""MethodProof CLI. See how you code.
|
|
2
2
|
|
|
3
3
|
Usage:
|
|
4
|
-
methodproof init Install hooks, configure capture
|
|
4
|
+
methodproof init Install hooks, configure capture
|
|
5
5
|
methodproof start [--dir .] Start recording a session
|
|
6
6
|
methodproof stop Stop recording, build process graph
|
|
7
7
|
methodproof view [id] View session graph in browser
|
|
@@ -60,6 +60,69 @@ def _banner() -> str:
|
|
|
60
60
|
return f"MethodProof — {_rainbow('Full Spectrum')}"
|
|
61
61
|
|
|
62
62
|
|
|
63
|
+
def _app_url(api_url: str) -> str:
|
|
64
|
+
"""Derive dashboard URL from API URL."""
|
|
65
|
+
if "localhost" in api_url or "127.0.0.1" in api_url:
|
|
66
|
+
return "http://localhost:5173"
|
|
67
|
+
return api_url.replace("api.", "app.", 1)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _print_intro() -> None:
|
|
71
|
+
"""Show the 3-layer architecture intro with rainbow borders."""
|
|
72
|
+
if not sys.stdout.isatty():
|
|
73
|
+
_print_intro_plain()
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
W = "\033[1;97m"
|
|
77
|
+
G = "\033[92m"
|
|
78
|
+
C = "\033[96m"
|
|
79
|
+
Y = "\033[93m"
|
|
80
|
+
D = "\033[90m"
|
|
81
|
+
R = _RESET
|
|
82
|
+
|
|
83
|
+
bar = _rainbow("━" * 51)
|
|
84
|
+
|
|
85
|
+
print(f"\n {bar}\n")
|
|
86
|
+
print(f" {W}M E T H O D P R O O F{R}")
|
|
87
|
+
print(f" {D}See how you code. Prove how you build.{R}")
|
|
88
|
+
print(f"\n {bar}\n")
|
|
89
|
+
print(f" ┌────────────────────────────────────────────────┐")
|
|
90
|
+
print(f" │ {Y}SHARE{R} push · publish · live stream │")
|
|
91
|
+
print(f" ├────────────────────────────────────────────────┤")
|
|
92
|
+
print(f" │ {C}GRAPH{R} knowledge graph · moments · edges │")
|
|
93
|
+
print(f" ├────────────────────────────────────────────────┤")
|
|
94
|
+
print(f" │ {G}CAPTURE{R} hooks · proxy · plugin │")
|
|
95
|
+
print(f" └────────────────────────────────────────────────┘")
|
|
96
|
+
print()
|
|
97
|
+
print(f" {D}1.{R} {G}mp start{R} begin recording")
|
|
98
|
+
print(f" {D}2.{R} code normally {D}MethodProof watches silently{R}")
|
|
99
|
+
print(f" {D}3.{R} {G}mp stop{R} build your process graph")
|
|
100
|
+
print(f" {D}4.{R} {G}mp push{R} upload to your profile")
|
|
101
|
+
print()
|
|
102
|
+
print(f" {D}All data stays local until you push.{R}\n")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _print_intro_plain() -> None:
|
|
106
|
+
print("\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n")
|
|
107
|
+
print(" M E T H O D P R O O F")
|
|
108
|
+
print(" See how you code. Prove how you build.")
|
|
109
|
+
print("\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n")
|
|
110
|
+
print(" ┌────────────────────────────────────────────────┐")
|
|
111
|
+
print(" │ SHARE push · publish · live stream │")
|
|
112
|
+
print(" ├────────────────────────────────────────────────┤")
|
|
113
|
+
print(" │ GRAPH knowledge graph · moments · edges │")
|
|
114
|
+
print(" ├────────────────────────────────────────────────┤")
|
|
115
|
+
print(" │ CAPTURE hooks · proxy · plugin │")
|
|
116
|
+
print(" └────────────────────────────────────────────────┘")
|
|
117
|
+
print()
|
|
118
|
+
print(" 1. mp start begin recording")
|
|
119
|
+
print(" 2. code normally MethodProof watches silently")
|
|
120
|
+
print(" 3. mp stop build your process graph")
|
|
121
|
+
print(" 4. mp push upload to your profile")
|
|
122
|
+
print()
|
|
123
|
+
print(" All data stays local until you push.\n")
|
|
124
|
+
|
|
125
|
+
|
|
63
126
|
_ALIAS_MARKER = "# methodproof-alias"
|
|
64
127
|
|
|
65
128
|
|
|
@@ -75,20 +138,77 @@ def _install_alias() -> None:
|
|
|
75
138
|
f.write(alias)
|
|
76
139
|
|
|
77
140
|
|
|
141
|
+
def _print_journal_intro(credits: int) -> None:
|
|
142
|
+
"""Show journal mode introduction with remaining credits."""
|
|
143
|
+
print(" ┌─────────────────────────────────────────────────────┐")
|
|
144
|
+
print(" │ Journal Mode — full content capture │")
|
|
145
|
+
print(" └─────────────────────────────────────────────────────┘")
|
|
146
|
+
print(f" You have {credits} free journal credit{'s' if credits != 1 else ''} "
|
|
147
|
+
f"(sessions up to {config.FREE_JOURNAL_MAX_HOURS}h each).")
|
|
148
|
+
print()
|
|
149
|
+
print(" By default, MethodProof captures structural metadata only —")
|
|
150
|
+
print(" file paths, line counts, timing, tool names. Journal mode")
|
|
151
|
+
print(" preserves the full picture: prompts, AI responses, diffs,")
|
|
152
|
+
print(" and terminal output. All encrypted (AES-256-GCM).")
|
|
153
|
+
print()
|
|
154
|
+
print(" Try it: mp start --journal")
|
|
155
|
+
print(" Toggle: mp journal on / off / status")
|
|
156
|
+
print()
|
|
157
|
+
|
|
158
|
+
|
|
78
159
|
def _run_consent(cfg: dict) -> dict:
|
|
79
|
-
"""
|
|
160
|
+
"""Simplified consent flow: accept defaults or customize."""
|
|
161
|
+
print(f"\n{_banner()}\n")
|
|
162
|
+
print(" Built by engineers, for engineers.\n")
|
|
163
|
+
print(" All data stays local in ~/.methodproof/. Nothing leaves your")
|
|
164
|
+
print(" machine unless you explicitly run `mp push` or `mp publish`.\n")
|
|
165
|
+
print(" MethodProof records structural metadata about your workflow:")
|
|
166
|
+
print(" commands, file changes, git commits, AI interactions, and more.")
|
|
167
|
+
print(" No code content is stored by default.\n")
|
|
168
|
+
|
|
169
|
+
choice = input(" Enable recommended capture? [Y/n/c to customize]: ").strip().lower()
|
|
170
|
+
|
|
171
|
+
if choice in ("c", "customize"):
|
|
172
|
+
return _run_consent_detailed(cfg)
|
|
173
|
+
|
|
174
|
+
if choice in ("n", "no"):
|
|
175
|
+
# Minimal: only file changes + git commits
|
|
176
|
+
capture = {k: False for k in config.STANDARD_CATEGORIES}
|
|
177
|
+
capture["file_changes"] = True
|
|
178
|
+
capture["git_commits"] = True
|
|
179
|
+
capture["code_capture"] = False
|
|
180
|
+
cfg["capture"] = capture
|
|
181
|
+
cfg["research_consent"] = False
|
|
182
|
+
cfg["publish_redact"] = dict(config._DEFAULTS["publish_redact"])
|
|
183
|
+
cfg["consent_acknowledged"] = True
|
|
184
|
+
credits = cfg.get("journal_credits", config._DEFAULTS["journal_credits"])
|
|
185
|
+
print("\n Minimal capture enabled (file changes + git commits).\n")
|
|
186
|
+
_print_journal_intro(credits)
|
|
187
|
+
print(" Customize anytime: `methodproof consent`\n")
|
|
188
|
+
return cfg
|
|
189
|
+
|
|
190
|
+
# Default: all 10 standard on, code_capture off
|
|
191
|
+
cfg["capture"] = dict(config._DEFAULTS["capture"])
|
|
192
|
+
cfg["research_consent"] = False
|
|
193
|
+
cfg["publish_redact"] = dict(config._DEFAULTS["publish_redact"])
|
|
194
|
+
cfg["consent_acknowledged"] = True
|
|
195
|
+
credits = cfg.get("journal_credits", config._DEFAULTS["journal_credits"])
|
|
196
|
+
print(f"\n {_rainbow('Full Spectrum')} enabled — free live streaming unlocked.\n")
|
|
197
|
+
_print_journal_intro(credits)
|
|
198
|
+
print(" Customize anytime: `methodproof consent`\n")
|
|
199
|
+
return cfg
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _run_consent_detailed(cfg: dict) -> dict:
|
|
203
|
+
"""Full interactive consent flow with three sections: capture, research, redaction."""
|
|
80
204
|
capture = cfg.get("capture", dict(config._DEFAULTS["capture"]))
|
|
81
205
|
publish_redact = cfg.get("publish_redact", dict(config._DEFAULTS["publish_redact"]))
|
|
82
206
|
std = config.STANDARD_CATEGORIES
|
|
83
207
|
|
|
84
|
-
print(f"\n{_banner()}\n")
|
|
85
|
-
print("Built by engineers, for engineers.\n")
|
|
86
|
-
print("All data stays local in ~/.methodproof/. Nothing leaves your")
|
|
87
|
-
print("machine unless you explicitly run `mp push` or `mp publish`.\n")
|
|
88
|
-
|
|
89
208
|
# --- Section 1: Capture ---
|
|
209
|
+
print()
|
|
90
210
|
print("=" * 60)
|
|
91
|
-
print("
|
|
211
|
+
print(" What gets recorded locally")
|
|
92
212
|
print("=" * 60)
|
|
93
213
|
print()
|
|
94
214
|
print(" These 10 categories are structural metadata only.")
|
|
@@ -143,7 +263,7 @@ def _run_consent(cfg: dict) -> dict:
|
|
|
143
263
|
|
|
144
264
|
# --- Section 2: Research Data ---
|
|
145
265
|
print("=" * 60)
|
|
146
|
-
print("
|
|
266
|
+
print(" Contribute to AI research (optional)")
|
|
147
267
|
print("=" * 60)
|
|
148
268
|
print()
|
|
149
269
|
|
|
@@ -171,7 +291,7 @@ def _run_consent(cfg: dict) -> dict:
|
|
|
171
291
|
|
|
172
292
|
# --- Section 3: Publish Redaction ---
|
|
173
293
|
print("=" * 60)
|
|
174
|
-
print("
|
|
294
|
+
print(" Default redactions for public sessions")
|
|
175
295
|
print("=" * 60)
|
|
176
296
|
print()
|
|
177
297
|
print(" `mp push` uploads privately to your account (nothing public).")
|
|
@@ -288,9 +408,8 @@ def cmd_init(args: argparse.Namespace) -> None:
|
|
|
288
408
|
else:
|
|
289
409
|
print("Signing key: exists")
|
|
290
410
|
|
|
291
|
-
|
|
292
|
-
print("Restart your shell, then run:
|
|
293
|
-
_print_commands()
|
|
411
|
+
_print_intro()
|
|
412
|
+
print(" Restart your shell, then run: mp start\n")
|
|
294
413
|
|
|
295
414
|
|
|
296
415
|
def _print_commands() -> None:
|
|
@@ -310,7 +429,11 @@ def _print_commands() -> None:
|
|
|
310
429
|
print(f" {_W}RECORD{R}")
|
|
311
430
|
print(f" {_G}mp start{R} Start recording a session")
|
|
312
431
|
print(f" {_G}mp stop{R} Stop recording, build process graph")
|
|
313
|
-
print(f" {_G}mp start --live{R} Stream your graph
|
|
432
|
+
print(f" {_G}mp start --live{R} Stream your graph privately (only you can view)")
|
|
433
|
+
print(f" {_G}mp start --live-public{R} Stream your graph publicly (shareable link)")
|
|
434
|
+
print(f" {_G}mp start --journal{R} Full content capture (2 free credits, then Pro)")
|
|
435
|
+
print(f" {_G}mp journal on{R} Enable persistent journal mode")
|
|
436
|
+
print(f" {_G}mp journal status{R} Check journal mode and remaining credits")
|
|
314
437
|
print()
|
|
315
438
|
print(f" {_W}REVIEW{R}")
|
|
316
439
|
print(f" {_C}mp view{R} {_D}[id]{R} View session graph in browser")
|
|
@@ -330,6 +453,7 @@ def _print_commands() -> None:
|
|
|
330
453
|
print(f" {_W}ACCOUNT{R}")
|
|
331
454
|
print(f" {_M}mp login{R} Connect to platform (opens browser)")
|
|
332
455
|
print(f" {_M}mp consent{R} Change capture, research, and redaction settings")
|
|
456
|
+
print(f" {_M}mp reset{R} Clear login and consent (keeps sessions)")
|
|
333
457
|
print(f" {_M}mp delete{R} {_D}<id>{R} Delete a session and all its data")
|
|
334
458
|
print(f" {_M}mp update{R} Update to the latest version")
|
|
335
459
|
print(f" {_M}mp uninstall{R} Remove all hooks, data, and config")
|
|
@@ -361,6 +485,7 @@ def _print_commands_plain() -> None:
|
|
|
361
485
|
print(" ACCOUNT")
|
|
362
486
|
print(" mp login Connect to platform (opens browser)")
|
|
363
487
|
print(" mp consent Change capture, research, and redaction settings")
|
|
488
|
+
print(" mp reset Clear login and consent (keeps sessions)")
|
|
364
489
|
print(" mp delete <id> Delete a session and all its data")
|
|
365
490
|
print(" mp update Update to the latest version")
|
|
366
491
|
print(" mp uninstall Remove all hooks, data, and config")
|
|
@@ -446,15 +571,91 @@ def cmd_uninstall(args: argparse.Namespace) -> None:
|
|
|
446
571
|
print(" Restart your shell to clear hooks.\n")
|
|
447
572
|
|
|
448
573
|
|
|
574
|
+
def cmd_reset(args: argparse.Namespace) -> None:
|
|
575
|
+
"""Wipe login credentials and consent config. Sessions and hooks kept."""
|
|
576
|
+
cfg = config.load()
|
|
577
|
+
if not args.force:
|
|
578
|
+
answer = input(" Clear login and consent settings? Sessions and hooks are kept. [y/N]: ").strip().lower()
|
|
579
|
+
if answer not in ("y", "yes"):
|
|
580
|
+
print(" Cancelled.")
|
|
581
|
+
return
|
|
582
|
+
for key in ("token", "refresh_token", "email", "e2e_key"):
|
|
583
|
+
cfg[key] = config._DEFAULTS[key]
|
|
584
|
+
for key in ("capture", "research_consent", "publish_redact", "consent_acknowledged",
|
|
585
|
+
"journal_mode", "journal_credits"):
|
|
586
|
+
cfg[key] = config._DEFAULTS.get(key)
|
|
587
|
+
config.save(cfg)
|
|
588
|
+
cleared = ["login token", "refresh token", "email", "e2e key",
|
|
589
|
+
"capture consent", "research consent", "redaction defaults",
|
|
590
|
+
"journal mode"]
|
|
591
|
+
print(" Cleared:")
|
|
592
|
+
for c in cleared:
|
|
593
|
+
print(f" {c}")
|
|
594
|
+
print("\n Run `mp init` to reconfigure, or `mp login` to reconnect.\n")
|
|
595
|
+
|
|
596
|
+
|
|
449
597
|
def cmd_consent(args: argparse.Namespace) -> None:
|
|
450
598
|
"""Review or change capture, research, and redaction settings."""
|
|
451
599
|
cfg = config.load()
|
|
452
|
-
|
|
600
|
+
print(f"\n{_banner()}\n")
|
|
601
|
+
cfg = _run_consent_detailed(cfg)
|
|
453
602
|
config.save(cfg)
|
|
454
603
|
print(f"\n{_banner()} settings saved.\n")
|
|
455
604
|
_print_commands()
|
|
456
605
|
|
|
457
606
|
|
|
607
|
+
def cmd_journal(args: argparse.Namespace) -> None:
|
|
608
|
+
"""Journal mode — full content capture."""
|
|
609
|
+
subcmd = getattr(args, "journal_cmd", None)
|
|
610
|
+
cfg = config.load()
|
|
611
|
+
credits = cfg.get("journal_credits", 0)
|
|
612
|
+
|
|
613
|
+
if subcmd == "on":
|
|
614
|
+
print("Journal Mode — Full Content Capture\n")
|
|
615
|
+
print("When enabled, MethodProof persists full content alongside structural data:")
|
|
616
|
+
print(" • Full prompt text (not just length)")
|
|
617
|
+
print(" • Full AI completion text (not just length)")
|
|
618
|
+
print(" • Full file diffs and git patches")
|
|
619
|
+
print(" • Terminal output (not just commands)")
|
|
620
|
+
print(" • Tool call parameters and results\n")
|
|
621
|
+
print("All content is encrypted (AES-256-GCM) and subject to your consent settings.\n")
|
|
622
|
+
if credits > 0:
|
|
623
|
+
print(f"You have {credits} free journal credit{'s' if credits != 1 else ''} "
|
|
624
|
+
f"(sessions up to {config.FREE_JOURNAL_MAX_HOURS}h each).")
|
|
625
|
+
print("After credits are used, journal mode requires a Pro plan.\n")
|
|
626
|
+
else:
|
|
627
|
+
print("Journal mode requires a Pro plan (or free credits if available).\n")
|
|
628
|
+
answer = input("Enable journal mode? [y/N] ").strip().lower()
|
|
629
|
+
if answer != "y":
|
|
630
|
+
print("Journal mode not enabled.")
|
|
631
|
+
return
|
|
632
|
+
cfg["journal_mode"] = True
|
|
633
|
+
config.save(cfg)
|
|
634
|
+
print("\nJournal mode ON. Full content will be captured in your next session.")
|
|
635
|
+
print("Run `methodproof start` to begin recording.\n")
|
|
636
|
+
|
|
637
|
+
elif subcmd == "off":
|
|
638
|
+
cfg["journal_mode"] = False
|
|
639
|
+
config.save(cfg)
|
|
640
|
+
print("Journal mode OFF. Only structural metadata will be captured.")
|
|
641
|
+
|
|
642
|
+
elif subcmd == "status":
|
|
643
|
+
enabled = cfg.get("journal_mode", False)
|
|
644
|
+
if enabled:
|
|
645
|
+
print("Journal mode: ON (full content capture)")
|
|
646
|
+
print(" Prompts, completions, diffs, and output are persisted and encrypted.")
|
|
647
|
+
else:
|
|
648
|
+
print("Journal mode: OFF (structural only)")
|
|
649
|
+
print(" Only metadata captured: lengths, types, timing, file paths.")
|
|
650
|
+
print(" Enable with: methodproof journal on")
|
|
651
|
+
if credits > 0:
|
|
652
|
+
print(f" Free journal credits: {credits} "
|
|
653
|
+
f"(up to {config.FREE_JOURNAL_MAX_HOURS}h per session)")
|
|
654
|
+
|
|
655
|
+
else:
|
|
656
|
+
print("Usage: methodproof journal [on|off|status]")
|
|
657
|
+
|
|
658
|
+
|
|
458
659
|
def _is_daemon_alive() -> bool:
|
|
459
660
|
"""Check if the recording daemon is still running."""
|
|
460
661
|
if not PIDFILE.exists():
|
|
@@ -511,7 +712,9 @@ def cmd_start(args: argparse.Namespace) -> None:
|
|
|
511
712
|
capture = cfg.get("capture", {})
|
|
512
713
|
|
|
513
714
|
live_url = ""
|
|
514
|
-
|
|
715
|
+
want_live = args.live or getattr(args, "live_public", False)
|
|
716
|
+
live_visibility = "public" if getattr(args, "live_public", False) else "private"
|
|
717
|
+
if want_live:
|
|
515
718
|
if not cfg.get("token"):
|
|
516
719
|
print("Live mode requires login. Run `methodproof login` first.")
|
|
517
720
|
sys.exit(1)
|
|
@@ -522,10 +725,27 @@ def cmd_start(args: argparse.Namespace) -> None:
|
|
|
522
725
|
store.mark_synced(sid, remote_id)
|
|
523
726
|
# Connect live WebSocket
|
|
524
727
|
from methodproof import live as live_mod
|
|
525
|
-
live_url = live_mod.start(cfg["api_url"], cfg["token"], remote_id, capture) or ""
|
|
728
|
+
live_url = live_mod.start(cfg["api_url"], cfg["token"], remote_id, capture, live_visibility) or ""
|
|
526
729
|
if not live_url:
|
|
527
|
-
print("Live stream rejected — requires Pro plan or
|
|
730
|
+
print("Live stream rejected — requires Pro plan or Full Spectrum.")
|
|
528
731
|
sys.exit(1)
|
|
732
|
+
if live_visibility == "private":
|
|
733
|
+
print(f"Live (private): {live_url}")
|
|
734
|
+
print(" Only you can view this stream while logged in.")
|
|
735
|
+
else:
|
|
736
|
+
print(f"Live (public): {live_url}")
|
|
737
|
+
print(" Anyone with this link can watch your session build in real time.")
|
|
738
|
+
|
|
739
|
+
# Journal mode — per-session override or persistent config
|
|
740
|
+
if getattr(args, "journal", False):
|
|
741
|
+
cfg["journal_mode"] = True
|
|
742
|
+
credits = cfg.get("journal_credits", 0)
|
|
743
|
+
if credits > 0:
|
|
744
|
+
cfg["journal_credits"] = credits - 1
|
|
745
|
+
print(f"Journal mode ON (free credit used — {credits - 1} remaining, {config.FREE_JOURNAL_MAX_HOURS}h cap).")
|
|
746
|
+
else:
|
|
747
|
+
print("Journal mode ON for this session (full content capture).")
|
|
748
|
+
config.save(cfg)
|
|
529
749
|
|
|
530
750
|
base.init(sid, live=bool(live_url))
|
|
531
751
|
|
|
@@ -774,8 +994,11 @@ def cmd_push(args: argparse.Namespace) -> None:
|
|
|
774
994
|
print("No sessions to push.")
|
|
775
995
|
sys.exit(1)
|
|
776
996
|
from methodproof.sync import push
|
|
777
|
-
push(sid, cfg["token"], cfg["api_url"])
|
|
778
|
-
|
|
997
|
+
remote_id = push(sid, cfg["token"], cfg["api_url"])
|
|
998
|
+
app = _app_url(cfg["api_url"])
|
|
999
|
+
print(f"Pushed {sid[:8]} (private).")
|
|
1000
|
+
print(f" View: {app}/personal/sessions/{remote_id}")
|
|
1001
|
+
print(f" Publish: mp publish {sid[:8]}")
|
|
779
1002
|
|
|
780
1003
|
|
|
781
1004
|
def cmd_tag(args: argparse.Namespace) -> None:
|
|
@@ -805,11 +1028,15 @@ def cmd_publish(args: argparse.Namespace) -> None:
|
|
|
805
1028
|
session["visibility"] = "public"
|
|
806
1029
|
if not session["synced"]:
|
|
807
1030
|
from methodproof.sync import push
|
|
808
|
-
push(session["id"], cfg["token"], cfg["api_url"])
|
|
1031
|
+
remote_id = push(session["id"], cfg["token"], cfg["api_url"])
|
|
809
1032
|
else:
|
|
810
1033
|
from methodproof.sync import sync_metadata
|
|
811
1034
|
sync_metadata(session, cfg["token"], cfg["api_url"])
|
|
1035
|
+
remote_id = session.get("remote_id", "")
|
|
1036
|
+
app = _app_url(cfg["api_url"])
|
|
812
1037
|
print(f"Published {session['id'][:8]} (public).")
|
|
1038
|
+
if remote_id:
|
|
1039
|
+
print(f" View: {app}/sessions/{remote_id}/cover")
|
|
813
1040
|
|
|
814
1041
|
|
|
815
1042
|
def _resolve_session(session_id: str) -> dict:
|
|
@@ -1122,7 +1349,9 @@ def main() -> None:
|
|
|
1122
1349
|
s.add_argument("--repo", help="Git remote URL (overrides auto-detect)")
|
|
1123
1350
|
s.add_argument("--public", action="store_true", help="Set visibility to public")
|
|
1124
1351
|
s.add_argument("--tags", help="Comma-separated tags")
|
|
1125
|
-
s.add_argument("--live", action="store_true", help="Stream
|
|
1352
|
+
s.add_argument("--live", action="store_true", help="Stream graph live to your private profile")
|
|
1353
|
+
s.add_argument("--live-public", action="store_true", help="Stream graph live — visible to anyone with the link")
|
|
1354
|
+
s.add_argument("--journal", action="store_true", help="Journal mode — full content capture (2 free credits, then Pro)")
|
|
1126
1355
|
sub.add_parser("stop", help="Stop recording")
|
|
1127
1356
|
v = sub.add_parser("view", help="Inspect captured session data")
|
|
1128
1357
|
v.add_argument("session_id", nargs="?")
|
|
@@ -1143,6 +1372,8 @@ def main() -> None:
|
|
|
1143
1372
|
rv.add_argument("session_id", nargs="?")
|
|
1144
1373
|
sub.add_parser("consent", help="Change capture, research, and redaction settings")
|
|
1145
1374
|
sub.add_parser("update", help="Update to the latest version from PyPI")
|
|
1375
|
+
rs = sub.add_parser("reset", help="Clear login and consent settings (keeps sessions and hooks)")
|
|
1376
|
+
rs.add_argument("--force", "-f", action="store_true", help="Skip confirmation")
|
|
1146
1377
|
un = sub.add_parser("uninstall", help="Remove all hooks, data, and config")
|
|
1147
1378
|
un.add_argument("--force", "-f", action="store_true", help="Skip confirmation")
|
|
1148
1379
|
ext = sub.add_parser("extension", help="Browser extension pairing and status")
|
|
@@ -1150,8 +1381,20 @@ def main() -> None:
|
|
|
1150
1381
|
ext_sub.add_parser("pair", help="Pair extension to active session")
|
|
1151
1382
|
ext_sub.add_parser("status", help="Check extension connection")
|
|
1152
1383
|
ext_sub.add_parser("install", help="Open Chrome Web Store listing")
|
|
1384
|
+
jr = sub.add_parser("journal", help="Journal mode — full content capture (2 free credits, then Pro)")
|
|
1385
|
+
jr_sub = jr.add_subparsers(dest="journal_cmd")
|
|
1386
|
+
jr_sub.add_parser("on", help="Enable journal mode (persists full content)")
|
|
1387
|
+
jr_sub.add_parser("off", help="Disable journal mode (structural only)")
|
|
1388
|
+
jr_sub.add_parser("status", help="Show journal mode status")
|
|
1389
|
+
sub.add_parser("intro", help="Show the MethodProof intro")
|
|
1153
1390
|
sub.add_parser("help", help="Show command reference")
|
|
1154
1391
|
sub.add_parser("mcp-serve", help="Run MCP server (used by Claude Code)")
|
|
1392
|
+
px = sub.add_parser("proxy", help="Local AI API proxy (deep capture)")
|
|
1393
|
+
px_sub = px.add_subparsers(dest="proxy_cmd")
|
|
1394
|
+
px_sub.add_parser("start", help="Start proxy (requires consent)")
|
|
1395
|
+
px_sub.add_parser("stop", help="Stop proxy")
|
|
1396
|
+
px_sub.add_parser("status", help="Show proxy status")
|
|
1397
|
+
px_sub.add_parser("cert", help="CA certificate install instructions")
|
|
1155
1398
|
|
|
1156
1399
|
args = p.parse_args()
|
|
1157
1400
|
cmds = {
|
|
@@ -1159,13 +1402,17 @@ def main() -> None:
|
|
|
1159
1402
|
"view": cmd_view, "log": cmd_log, "login": cmd_login,
|
|
1160
1403
|
"push": cmd_push, "tag": cmd_tag, "publish": cmd_publish,
|
|
1161
1404
|
"delete": cmd_delete, "review": cmd_review, "consent": cmd_consent,
|
|
1162
|
-
"update": cmd_update, "uninstall": cmd_uninstall,
|
|
1405
|
+
"update": cmd_update, "reset": cmd_reset, "uninstall": cmd_uninstall,
|
|
1163
1406
|
"extension": cmd_extension,
|
|
1407
|
+
"journal": cmd_journal,
|
|
1408
|
+
"intro": lambda _: _print_intro(),
|
|
1164
1409
|
"help": lambda _: _print_commands(),
|
|
1165
1410
|
"mcp-serve": cmd_mcp_serve,
|
|
1411
|
+
"proxy": lambda a: __import__("methodproof.proxy", fromlist=["cmd_proxy"]).cmd_proxy(a),
|
|
1166
1412
|
}
|
|
1167
1413
|
fn = cmds.get(args.cmd)
|
|
1168
1414
|
if not fn:
|
|
1415
|
+
_print_intro()
|
|
1169
1416
|
_print_commands()
|
|
1170
1417
|
sys.exit(1)
|
|
1171
1418
|
|
|
@@ -33,6 +33,8 @@ _DEFAULTS: dict[str, Any] = {
|
|
|
33
33
|
"code_capture": False,
|
|
34
34
|
},
|
|
35
35
|
"research_consent": False,
|
|
36
|
+
"journal_mode": False,
|
|
37
|
+
"journal_credits": 2,
|
|
36
38
|
"publish_redact": {
|
|
37
39
|
"command_output": True,
|
|
38
40
|
"ai_prompts": True,
|
|
@@ -41,6 +43,8 @@ _DEFAULTS: dict[str, Any] = {
|
|
|
41
43
|
},
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
FREE_JOURNAL_MAX_HOURS = 4
|
|
47
|
+
|
|
44
48
|
# The 10 standard categories (excludes code_capture)
|
|
45
49
|
STANDARD_CATEGORIES = [
|
|
46
50
|
"terminal_commands", "command_output", "test_results", "file_changes",
|
|
@@ -63,6 +67,44 @@ CAPTURE_DESCRIPTIONS: dict[str, str] = {
|
|
|
63
67
|
"code_capture": "Full file diffs and git patches (Pro only, encrypted, private by default)",
|
|
64
68
|
}
|
|
65
69
|
|
|
70
|
+
# Content fields that Journal Mode unlocks. When journal_mode is OFF (default),
|
|
71
|
+
# these fields are stripped — only structural equivalents remain (lengths, counts, types).
|
|
72
|
+
# When journal_mode is ON (Pro+), EVERYTHING is persisted and encrypted.
|
|
73
|
+
# Journal = the complete, explicit record of the session.
|
|
74
|
+
JOURNAL_CONTENT_FIELDS: list[tuple[str, str]] = [
|
|
75
|
+
# AI prompts — full prompt text
|
|
76
|
+
("llm_prompt", "prompt_text"),
|
|
77
|
+
("agent_prompt", "prompt_preview"),
|
|
78
|
+
("user_prompt", "prompt_preview"),
|
|
79
|
+
# AI responses — full completion text
|
|
80
|
+
("llm_completion", "response_text"),
|
|
81
|
+
("agent_completion", "response_preview"),
|
|
82
|
+
("agent_tool_dispatch", "tool_input_preview"),
|
|
83
|
+
("agent_tool_result", "result_preview"),
|
|
84
|
+
("agent_skill_invoke", "skill_input_preview"),
|
|
85
|
+
# Terminal — full command output
|
|
86
|
+
("terminal_cmd", "output_snippet"),
|
|
87
|
+
("terminal_cmd", "command"),
|
|
88
|
+
# Code — full diffs and commit messages
|
|
89
|
+
("file_edit", "diff"),
|
|
90
|
+
("git_commit", "diff"),
|
|
91
|
+
("git_commit", "message"),
|
|
92
|
+
# Web — full search queries, URLs, page titles
|
|
93
|
+
("web_search", "query"),
|
|
94
|
+
("web_search", "clicked_results"),
|
|
95
|
+
("web_visit", "url"),
|
|
96
|
+
("web_visit", "title"),
|
|
97
|
+
# Browser — full search queries, URLs, copy content, AI chat input
|
|
98
|
+
("browser_search", "query"),
|
|
99
|
+
("browser_visit", "url"),
|
|
100
|
+
("browser_visit", "title"),
|
|
101
|
+
("browser_copy", "text_snippet"),
|
|
102
|
+
("browser_ai_chat", "detected_input"),
|
|
103
|
+
("browser_ai_chat", "url"),
|
|
104
|
+
# Inline completions — provider detail
|
|
105
|
+
("inline_completion_accepted", "text_length"),
|
|
106
|
+
]
|
|
107
|
+
|
|
66
108
|
|
|
67
109
|
def ensure_dirs() -> None:
|
|
68
110
|
DIR.mkdir(exist_ok=True)
|