credex-claudecode 0.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.
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ *.audit.json
13
+ .env
14
+ .venv/
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: credex-claudecode
3
+ Version: 0.1.0
4
+ Summary: Audit chain for Claude Code workflows — consensus verification, persistent memory, and XRPL provenance for every agent action.
5
+ Project-URL: Homepage, https://credexai.live
6
+ Project-URL: Documentation, https://credexai.live/docs/universal-connector.html
7
+ Project-URL: Repository, https://github.com/credexai-labs/credex-claudecode
8
+ Project-URL: Issues, https://github.com/credexai-labs/credex-claudecode/issues
9
+ Author-email: CredEx AI <hello@credexai.live>
10
+ License-Expression: MIT
11
+ Keywords: ai-agents,audit,claude-code,credex,mcp,verification,xrpl
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: click>=8.0
19
+ Requires-Dist: httpx>=0.27
20
+ Requires-Dist: rich>=13.0
21
+ Description-Content-Type: text/markdown
22
+
23
+ # credex-claudecode
24
+
25
+ > **$60 to prove what $500 bought you.**
26
+
27
+ Audit chain for Claude Code workflows — consensus verification, persistent memory, and XRPL provenance for every agent action.
28
+
29
+ When Claude Code spins up hundreds of parallel agents that run for *days*, nobody can reconstruct what happened without a verification trail. `credex-claudecode` is that trail.
30
+
31
+ ## What It Does
32
+
33
+ ```
34
+ credex run "Migrate from Express to FastAPI" --verify milestones
35
+ ```
36
+
37
+ 1. **Wraps Claude Code** — runs your prompt through `claude -p` with streaming output
38
+ 2. **Parses every action** — tool calls, file writes, bash commands, agent decisions
39
+ 3. **Routes through CredEx verification** — pre-verification at $0.001/action, full 5-LLM consensus at $0.10/milestone
40
+ 4. **Anchors to XRPL** — cryptographic provenance at workflow boundaries
41
+ 5. **Produces `workflow.audit.json`** — third-party verifiable record of everything
42
+
43
+ ## Cost
44
+
45
+ For a typical Claude Code "ultracode" workflow ($500 in tokens, ~45,000 actions):
46
+
47
+ | Tier | What | Cost |
48
+ |------|------|------|
49
+ | Pre-verification | Every action, cheap model | $0.001 × 45,000 = $45 |
50
+ | Full consensus | 5-LLM panel at milestones | $0.10 × 50 = $5 |
51
+ | XRPL anchoring | Workflow boundaries | ~$10 |
52
+ | **Total** | | **~$60 (12% overhead)** |
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install credex-claudecode
58
+ ```
59
+
60
+ Requires:
61
+ - Python 3.10+
62
+ - Claude Code CLI (`npm install -g @anthropic-ai/claude-code`)
63
+ - CredEx API key (optional for dry-run mode)
64
+
65
+ ## Quick Start
66
+
67
+ ### Get a CredEx API key
68
+
69
+ ```bash
70
+ # Instant anonymous key
71
+ curl -X POST https://credexai.live/agent/auth -d '{"type":"anonymous"}'
72
+
73
+ # Set it
74
+ export CREDEX_API_KEY=credex_...
75
+ ```
76
+
77
+ ### Run a workflow with audit chain
78
+
79
+ ```bash
80
+ # Full audit (milestones verified + XRPL anchored)
81
+ credex run "Migrate the auth module from Express to FastAPI"
82
+
83
+ # Verify everything (costs more, thorough)
84
+ credex run "Security audit of the payment module" --verify all
85
+
86
+ # Dry run (no CredEx, local audit only)
87
+ credex run "Rewrite tests in pytest" --dry-run
88
+
89
+ # Pass Claude Code options
90
+ credex run "Fix the bug in auth.py" --allowed-tools "Read,Edit,Bash" --model claude-sonnet-4-20250514
91
+ ```
92
+
93
+ ### Inspect an audit
94
+
95
+ ```bash
96
+ # Pretty-print summary
97
+ credex audit workflow.audit.json
98
+
99
+ # Verify chain integrity
100
+ credex audit workflow.audit.json --verify
101
+ ```
102
+
103
+ ### Lightweight hooks (no wrapper needed)
104
+
105
+ ```bash
106
+ # Install PostToolUse hooks into your project
107
+ credex install-hooks
108
+
109
+ # Now every Claude Code session automatically logs to CredEx
110
+ claude # Use normally — CredEx logging happens in background
111
+ ```
112
+
113
+ ## `workflow.audit.json`
114
+
115
+ The audit file is a self-contained, third-party verifiable record:
116
+
117
+ ```json
118
+ {
119
+ "version": "1.0.0",
120
+ "generator": "credex-claudecode",
121
+ "document_hash": "a1b2c3...",
122
+
123
+ "workflow": {
124
+ "session_id": "session_abc123",
125
+ "prompt": "Migrate from Express to FastAPI",
126
+ "started_at": "2025-05-29T01:00:00Z",
127
+ "ended_at": "2025-05-29T01:45:00Z",
128
+ "claude_cost_usd": 12.50,
129
+ "total_tokens": 2500000,
130
+ "total_turns": 47
131
+ },
132
+
133
+ "summary": {
134
+ "total_actions": 342,
135
+ "total_milestones": 28,
136
+ "files_modified": ["src/main.py", "src/routes/auth.py", "..."],
137
+ "credex_verification": {
138
+ "total_verifications": 28,
139
+ "total_cost_usd": 2.85,
140
+ "verdicts": {"TRUE": 26, "MIXED": 2},
141
+ "anchors": 3
142
+ }
143
+ },
144
+
145
+ "action_chain": [
146
+ {
147
+ "id": "tool-abc123",
148
+ "sequence_number": 1,
149
+ "action_type": "tool_use",
150
+ "tool_name": "Read",
151
+ "content_hash": "f4a3...",
152
+ "chain_hash": "b7c2...",
153
+ "prev_hash": "genesis"
154
+ }
155
+ ],
156
+
157
+ "chain_proof": {
158
+ "genesis_hash": "genesis",
159
+ "final_hash": "d8e9...",
160
+ "chain_length": 342,
161
+ "algorithm": "sha256-linked"
162
+ }
163
+ }
164
+ ```
165
+
166
+ **Verification**: Each action's `chain_hash = SHA256(prev_hash + content_hash + sequence)`. Recompute from genesis to verify the entire chain.
167
+
168
+ ## Architecture
169
+
170
+ ```
171
+ ┌──────────────────────────────────────────────┐
172
+ │ credex run "prompt" │
173
+ ├──────────────────────────────────────────────┤
174
+ │ │
175
+ │ Claude Code CLI (subprocess) │
176
+ │ --output-format stream-json │
177
+ │ │ │
178
+ │ ▼ │
179
+ │ StreamEventParser │
180
+ │ ├─ tool_use events → ParsedAction │
181
+ │ ├─ tool_result events → ParsedAction │
182
+ │ └─ result event → WorkflowSession │
183
+ │ │ │
184
+ │ ▼ │
185
+ │ CredExVerifier │
186
+ │ ├─ Pre-verify: $0.001 (cheap, every action) │
187
+ │ ├─ Consensus: $0.10 (5-LLM, milestones) │
188
+ │ └─ Anchor: XRPL (workflow boundaries) │
189
+ │ │ │
190
+ │ ▼ │
191
+ │ AuditChainGenerator │
192
+ │ └─ workflow.audit.json │
193
+ │ │
194
+ └──────────────────────────────────────────────┘
195
+ ```
196
+
197
+ ## Integration Paths
198
+
199
+ ### 1. CLI Wrapper (Full Audit)
200
+ Use `credex run` for complete audit chains. Best for high-stakes workflows: migrations, security audits, rewrites.
201
+
202
+ ### 2. PostToolUse Hooks (Lightweight)
203
+ Use `credex install-hooks` for background logging. Best for everyday use — zero friction, events stored in CredEx memory.
204
+
205
+ ### 3. Python SDK (Programmatic)
206
+ ```python
207
+ from credex_claudecode.parser import StreamEventParser
208
+ from credex_claudecode.verifier import CredExVerifier
209
+
210
+ parser = StreamEventParser(prompt="my workflow")
211
+ verifier = CredExVerifier(api_key="credex_...", verify_level="milestones")
212
+
213
+ # Parse events from any source
214
+ for line in event_stream:
215
+ actions = parser.parse_line(line)
216
+ for action in actions:
217
+ result = await verifier.process_action(action)
218
+
219
+ session = parser.finalize()
220
+ ```
221
+
222
+ ## Why This Matters
223
+
224
+ Claude Code "ultracode" workflows spin up ~200 parallel agents, execute ~45,000 actions, and run for *days*. When that $500 workflow completes:
225
+
226
+ - **Without CredEx**: You have code changes. You don't know what decisions were made, what was tried and failed, or what was verified vs. guessed.
227
+ - **With CredEx**: You have a cryptographic audit chain. Every action verified, every decision anchored, every workflow reconstructable.
228
+
229
+ For enterprise teams running Claude Code on production codebases, the audit chain isn't optional — it's the difference between "we think the migration worked" and "here's the proof."
230
+
231
+ ## Links
232
+
233
+ - **CredEx AI**: [credexai.live](https://credexai.live)
234
+ - **MCP Tools**: [credexai.live/.well-known/mcp.json](https://credexai.live/.well-known/mcp.json)
235
+ - **Connector Docs**: [credexai.live/docs/universal-connector.html](https://credexai.live/docs/universal-connector.html)
236
+ - **API Auth**: [credexai.live/auth.md](https://credexai.live/auth.md)
237
+
238
+ ## License
239
+
240
+ MIT
@@ -0,0 +1,218 @@
1
+ # credex-claudecode
2
+
3
+ > **$60 to prove what $500 bought you.**
4
+
5
+ Audit chain for Claude Code workflows — consensus verification, persistent memory, and XRPL provenance for every agent action.
6
+
7
+ When Claude Code spins up hundreds of parallel agents that run for *days*, nobody can reconstruct what happened without a verification trail. `credex-claudecode` is that trail.
8
+
9
+ ## What It Does
10
+
11
+ ```
12
+ credex run "Migrate from Express to FastAPI" --verify milestones
13
+ ```
14
+
15
+ 1. **Wraps Claude Code** — runs your prompt through `claude -p` with streaming output
16
+ 2. **Parses every action** — tool calls, file writes, bash commands, agent decisions
17
+ 3. **Routes through CredEx verification** — pre-verification at $0.001/action, full 5-LLM consensus at $0.10/milestone
18
+ 4. **Anchors to XRPL** — cryptographic provenance at workflow boundaries
19
+ 5. **Produces `workflow.audit.json`** — third-party verifiable record of everything
20
+
21
+ ## Cost
22
+
23
+ For a typical Claude Code "ultracode" workflow ($500 in tokens, ~45,000 actions):
24
+
25
+ | Tier | What | Cost |
26
+ |------|------|------|
27
+ | Pre-verification | Every action, cheap model | $0.001 × 45,000 = $45 |
28
+ | Full consensus | 5-LLM panel at milestones | $0.10 × 50 = $5 |
29
+ | XRPL anchoring | Workflow boundaries | ~$10 |
30
+ | **Total** | | **~$60 (12% overhead)** |
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install credex-claudecode
36
+ ```
37
+
38
+ Requires:
39
+ - Python 3.10+
40
+ - Claude Code CLI (`npm install -g @anthropic-ai/claude-code`)
41
+ - CredEx API key (optional for dry-run mode)
42
+
43
+ ## Quick Start
44
+
45
+ ### Get a CredEx API key
46
+
47
+ ```bash
48
+ # Instant anonymous key
49
+ curl -X POST https://credexai.live/agent/auth -d '{"type":"anonymous"}'
50
+
51
+ # Set it
52
+ export CREDEX_API_KEY=credex_...
53
+ ```
54
+
55
+ ### Run a workflow with audit chain
56
+
57
+ ```bash
58
+ # Full audit (milestones verified + XRPL anchored)
59
+ credex run "Migrate the auth module from Express to FastAPI"
60
+
61
+ # Verify everything (costs more, thorough)
62
+ credex run "Security audit of the payment module" --verify all
63
+
64
+ # Dry run (no CredEx, local audit only)
65
+ credex run "Rewrite tests in pytest" --dry-run
66
+
67
+ # Pass Claude Code options
68
+ credex run "Fix the bug in auth.py" --allowed-tools "Read,Edit,Bash" --model claude-sonnet-4-20250514
69
+ ```
70
+
71
+ ### Inspect an audit
72
+
73
+ ```bash
74
+ # Pretty-print summary
75
+ credex audit workflow.audit.json
76
+
77
+ # Verify chain integrity
78
+ credex audit workflow.audit.json --verify
79
+ ```
80
+
81
+ ### Lightweight hooks (no wrapper needed)
82
+
83
+ ```bash
84
+ # Install PostToolUse hooks into your project
85
+ credex install-hooks
86
+
87
+ # Now every Claude Code session automatically logs to CredEx
88
+ claude # Use normally — CredEx logging happens in background
89
+ ```
90
+
91
+ ## `workflow.audit.json`
92
+
93
+ The audit file is a self-contained, third-party verifiable record:
94
+
95
+ ```json
96
+ {
97
+ "version": "1.0.0",
98
+ "generator": "credex-claudecode",
99
+ "document_hash": "a1b2c3...",
100
+
101
+ "workflow": {
102
+ "session_id": "session_abc123",
103
+ "prompt": "Migrate from Express to FastAPI",
104
+ "started_at": "2025-05-29T01:00:00Z",
105
+ "ended_at": "2025-05-29T01:45:00Z",
106
+ "claude_cost_usd": 12.50,
107
+ "total_tokens": 2500000,
108
+ "total_turns": 47
109
+ },
110
+
111
+ "summary": {
112
+ "total_actions": 342,
113
+ "total_milestones": 28,
114
+ "files_modified": ["src/main.py", "src/routes/auth.py", "..."],
115
+ "credex_verification": {
116
+ "total_verifications": 28,
117
+ "total_cost_usd": 2.85,
118
+ "verdicts": {"TRUE": 26, "MIXED": 2},
119
+ "anchors": 3
120
+ }
121
+ },
122
+
123
+ "action_chain": [
124
+ {
125
+ "id": "tool-abc123",
126
+ "sequence_number": 1,
127
+ "action_type": "tool_use",
128
+ "tool_name": "Read",
129
+ "content_hash": "f4a3...",
130
+ "chain_hash": "b7c2...",
131
+ "prev_hash": "genesis"
132
+ }
133
+ ],
134
+
135
+ "chain_proof": {
136
+ "genesis_hash": "genesis",
137
+ "final_hash": "d8e9...",
138
+ "chain_length": 342,
139
+ "algorithm": "sha256-linked"
140
+ }
141
+ }
142
+ ```
143
+
144
+ **Verification**: Each action's `chain_hash = SHA256(prev_hash + content_hash + sequence)`. Recompute from genesis to verify the entire chain.
145
+
146
+ ## Architecture
147
+
148
+ ```
149
+ ┌──────────────────────────────────────────────┐
150
+ │ credex run "prompt" │
151
+ ├──────────────────────────────────────────────┤
152
+ │ │
153
+ │ Claude Code CLI (subprocess) │
154
+ │ --output-format stream-json │
155
+ │ │ │
156
+ │ ▼ │
157
+ │ StreamEventParser │
158
+ │ ├─ tool_use events → ParsedAction │
159
+ │ ├─ tool_result events → ParsedAction │
160
+ │ └─ result event → WorkflowSession │
161
+ │ │ │
162
+ │ ▼ │
163
+ │ CredExVerifier │
164
+ │ ├─ Pre-verify: $0.001 (cheap, every action) │
165
+ │ ├─ Consensus: $0.10 (5-LLM, milestones) │
166
+ │ └─ Anchor: XRPL (workflow boundaries) │
167
+ │ │ │
168
+ │ ▼ │
169
+ │ AuditChainGenerator │
170
+ │ └─ workflow.audit.json │
171
+ │ │
172
+ └──────────────────────────────────────────────┘
173
+ ```
174
+
175
+ ## Integration Paths
176
+
177
+ ### 1. CLI Wrapper (Full Audit)
178
+ Use `credex run` for complete audit chains. Best for high-stakes workflows: migrations, security audits, rewrites.
179
+
180
+ ### 2. PostToolUse Hooks (Lightweight)
181
+ Use `credex install-hooks` for background logging. Best for everyday use — zero friction, events stored in CredEx memory.
182
+
183
+ ### 3. Python SDK (Programmatic)
184
+ ```python
185
+ from credex_claudecode.parser import StreamEventParser
186
+ from credex_claudecode.verifier import CredExVerifier
187
+
188
+ parser = StreamEventParser(prompt="my workflow")
189
+ verifier = CredExVerifier(api_key="credex_...", verify_level="milestones")
190
+
191
+ # Parse events from any source
192
+ for line in event_stream:
193
+ actions = parser.parse_line(line)
194
+ for action in actions:
195
+ result = await verifier.process_action(action)
196
+
197
+ session = parser.finalize()
198
+ ```
199
+
200
+ ## Why This Matters
201
+
202
+ Claude Code "ultracode" workflows spin up ~200 parallel agents, execute ~45,000 actions, and run for *days*. When that $500 workflow completes:
203
+
204
+ - **Without CredEx**: You have code changes. You don't know what decisions were made, what was tried and failed, or what was verified vs. guessed.
205
+ - **With CredEx**: You have a cryptographic audit chain. Every action verified, every decision anchored, every workflow reconstructable.
206
+
207
+ For enterprise teams running Claude Code on production codebases, the audit chain isn't optional — it's the difference between "we think the migration worked" and "here's the proof."
208
+
209
+ ## Links
210
+
211
+ - **CredEx AI**: [credexai.live](https://credexai.live)
212
+ - **MCP Tools**: [credexai.live/.well-known/mcp.json](https://credexai.live/.well-known/mcp.json)
213
+ - **Connector Docs**: [credexai.live/docs/universal-connector.html](https://credexai.live/docs/universal-connector.html)
214
+ - **API Auth**: [credexai.live/auth.md](https://credexai.live/auth.md)
215
+
216
+ ## License
217
+
218
+ MIT
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "credex-claudecode"
7
+ version = "0.1.0"
8
+ description = "Audit chain for Claude Code workflows — consensus verification, persistent memory, and XRPL provenance for every agent action."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "CredEx AI", email = "hello@credexai.live" }
14
+ ]
15
+ keywords = ["claude-code", "credex", "verification", "audit", "xrpl", "ai-agents", "mcp"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Topic :: Software Development :: Quality Assurance",
22
+ ]
23
+ dependencies = [
24
+ "httpx>=0.27",
25
+ "rich>=13.0",
26
+ "click>=8.0",
27
+ ]
28
+
29
+ [project.scripts]
30
+ credex = "credex_claudecode.cli:main"
31
+
32
+ [project.urls]
33
+ Homepage = "https://credexai.live"
34
+ Documentation = "https://credexai.live/docs/universal-connector.html"
35
+ Repository = "https://github.com/credexai-labs/credex-claudecode"
36
+ Issues = "https://github.com/credexai-labs/credex-claudecode/issues"
@@ -0,0 +1,13 @@
1
+ """
2
+ credex-claudecode — Audit chain for Claude Code workflows.
3
+
4
+ Consensus verification, persistent memory, and XRPL provenance
5
+ for every agent action in your Claude Code workflows.
6
+
7
+ Usage:
8
+ credex run "Migrate Express to FastAPI" --verify milestones
9
+ credex audit workflow.audit.json
10
+ credex install-hooks
11
+ """
12
+
13
+ __version__ = "0.1.0"