liquicent-decisiontrace 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.
- liquicent_decisiontrace-0.1.0/.gitignore +14 -0
- liquicent_decisiontrace-0.1.0/CHANGELOG.md +37 -0
- liquicent_decisiontrace-0.1.0/LICENSE +201 -0
- liquicent_decisiontrace-0.1.0/PKG-INFO +142 -0
- liquicent_decisiontrace-0.1.0/README.md +111 -0
- liquicent_decisiontrace-0.1.0/docs/BUILD_PLAN.md +189 -0
- liquicent_decisiontrace-0.1.0/docs/DECISIONS.md +56 -0
- liquicent_decisiontrace-0.1.0/docs/adapters/claude-code.md +65 -0
- liquicent_decisiontrace-0.1.0/docs/adapters/mcp.md +53 -0
- liquicent_decisiontrace-0.1.0/docs/adapters/otel.md +31 -0
- liquicent_decisiontrace-0.1.0/docs/adapters/sdk.md +53 -0
- liquicent_decisiontrace-0.1.0/docs/adapters/self-hosted-mcp.md +93 -0
- liquicent_decisiontrace-0.1.0/docs/cli.md +41 -0
- liquicent_decisiontrace-0.1.0/docs/concepts.md +40 -0
- liquicent_decisiontrace-0.1.0/docs/demo.tape +18 -0
- liquicent_decisiontrace-0.1.0/docs/getting-started.md +49 -0
- liquicent_decisiontrace-0.1.0/docs/index.md +21 -0
- liquicent_decisiontrace-0.1.0/docs/out-of-scope.md +15 -0
- liquicent_decisiontrace-0.1.0/docs/outcomes.md +65 -0
- liquicent_decisiontrace-0.1.0/docs/privacy.md +40 -0
- liquicent_decisiontrace-0.1.0/docs/progress-log.md +355 -0
- liquicent_decisiontrace-0.1.0/docs/recall.md +51 -0
- liquicent_decisiontrace-0.1.0/docs/schema.md +1 -0
- liquicent_decisiontrace-0.1.0/docs/vwu.md +54 -0
- liquicent_decisiontrace-0.1.0/examples/_offline.py +76 -0
- liquicent_decisiontrace-0.1.0/examples/otel_agent.py +107 -0
- liquicent_decisiontrace-0.1.0/examples/refund_agent.py +171 -0
- liquicent_decisiontrace-0.1.0/mkdocs.yml +40 -0
- liquicent_decisiontrace-0.1.0/pyproject.toml +100 -0
- liquicent_decisiontrace-0.1.0/schema/README.md +86 -0
- liquicent_decisiontrace-0.1.0/schema/decisiontrace.schema.json +386 -0
- liquicent_decisiontrace-0.1.0/schema/examples/01-refund-approved-with-vip-exception.json +126 -0
- liquicent_decisiontrace-0.1.0/schema/examples/02-refund-denied-by-policy.json +75 -0
- liquicent_decisiontrace-0.1.0/schema/examples/03-pr-merge.json +91 -0
- liquicent_decisiontrace-0.1.0/schema/examples/04-code-edit-claude-code.json +116 -0
- liquicent_decisiontrace-0.1.0/schema/examples/05-email-draft-edited-by-human.json +86 -0
- liquicent_decisiontrace-0.1.0/schema/examples/06-tool-call-denied.json +83 -0
- liquicent_decisiontrace-0.1.0/schema/examples/07-procurement-escalated.json +105 -0
- liquicent_decisiontrace-0.1.0/schema/examples/08-memory-write-harness-update.json +77 -0
- liquicent_decisiontrace-0.1.0/schema/examples/09-delegation-parent.json +63 -0
- liquicent_decisiontrace-0.1.0/schema/examples/10-delegation-child.json +52 -0
- liquicent_decisiontrace-0.1.0/schema/examples/correction-pr-merge-checks.json +18 -0
- liquicent_decisiontrace-0.1.0/schema/examples/outcome-code-edit-reverted.json +15 -0
- liquicent_decisiontrace-0.1.0/schema/examples/outcome-pr-merge-vwu.json +43 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/__init__.py +70 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/__main__.py +5 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/anthropic_sdk/__init__.py +5 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/anthropic_sdk/wrap.py +152 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/claude_code/__init__.py +1 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/claude_code/builder.py +560 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/claude_code/drain.py +169 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/claude_code/hook.py +176 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/claude_code/install.py +141 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/loop.py +137 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/mcp/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/mcp/clients.py +77 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/openai_sdk/__init__.py +5 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/openai_sdk/wrap.py +146 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/otel/__init__.py +1 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/otel/ingest.py +364 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/adapters/sdk.py +27 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/cli.py +920 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/config.py +78 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/gitstate.py +46 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/ids.py +47 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/mcp_http.py +162 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/mcp_server.py +319 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/model.py +372 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/outcomes/__init__.py +12 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/outcomes/base.py +183 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/outcomes/chain.py +110 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/outcomes/events.py +332 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/outcomes/git.py +170 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/outcomes/silence.py +33 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/py.typed +0 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/__init__.py +1 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/ask.py +241 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/embeddings.py +107 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/golden.py +90 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/precedent.py +166 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/similarity.py +175 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/text.py +145 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recall/why.py +196 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/recorder.py +360 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/redact.py +242 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/schema.py +63 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/store/__init__.py +21 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/store/chain.py +23 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/store/migrations.py +94 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/store/sqlite.py +503 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/synthetic.py +61 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/views.py +166 -0
- liquicent_decisiontrace-0.1.0/src/decisiontrace/vwu.py +134 -0
- liquicent_decisiontrace-0.1.0/tests/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/benchmark/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/benchmark/test_store_benchmark.py +26 -0
- liquicent_decisiontrace-0.1.0/tests/claude_code/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/claude_code/test_hook.py +85 -0
- liquicent_decisiontrace-0.1.0/tests/claude_code/test_install.py +97 -0
- liquicent_decisiontrace-0.1.0/tests/claude_code/test_session.py +395 -0
- liquicent_decisiontrace-0.1.0/tests/conftest.py +44 -0
- liquicent_decisiontrace-0.1.0/tests/golden/examples.jsonl +10 -0
- liquicent_decisiontrace-0.1.0/tests/mcp/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/mcp/test_clients.py +38 -0
- liquicent_decisiontrace-0.1.0/tests/mcp/test_http.py +130 -0
- liquicent_decisiontrace-0.1.0/tests/mcp/test_mcp_server.py +169 -0
- liquicent_decisiontrace-0.1.0/tests/otel/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/otel/test_ingest.py +225 -0
- liquicent_decisiontrace-0.1.0/tests/outcomes/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/outcomes/test_detect.py +472 -0
- liquicent_decisiontrace-0.1.0/tests/recall/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/recall/test_embeddings.py +43 -0
- liquicent_decisiontrace-0.1.0/tests/recall/test_similarity.py +99 -0
- liquicent_decisiontrace-0.1.0/tests/recall/test_why_ask_eval.py +123 -0
- liquicent_decisiontrace-0.1.0/tests/sdk/__init__.py +0 -0
- liquicent_decisiontrace-0.1.0/tests/sdk/test_anthropic_wrap.py +310 -0
- liquicent_decisiontrace-0.1.0/tests/sdk/test_openai_wrap.py +159 -0
- liquicent_decisiontrace-0.1.0/tests/test_cli.py +45 -0
- liquicent_decisiontrace-0.1.0/tests/test_cli_store.py +119 -0
- liquicent_decisiontrace-0.1.0/tests/test_docs.py +23 -0
- liquicent_decisiontrace-0.1.0/tests/test_examples.py +56 -0
- liquicent_decisiontrace-0.1.0/tests/test_ids.py +36 -0
- liquicent_decisiontrace-0.1.0/tests/test_invalid.py +96 -0
- liquicent_decisiontrace-0.1.0/tests/test_redact.py +126 -0
- liquicent_decisiontrace-0.1.0/tests/test_schema_model_sync.py +103 -0
- liquicent_decisiontrace-0.1.0/tests/test_secrets_never_on_disk.py +40 -0
- liquicent_decisiontrace-0.1.0/tests/test_store.py +169 -0
- liquicent_decisiontrace-0.1.0/tests/test_tamper.py +87 -0
- liquicent_decisiontrace-0.1.0/tests/test_vwu.py +335 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The schema has its own version
|
|
4
|
+
(`schema_version`), independent of the package version.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
- Verified work units (VWU): an accepted outcome record may carry `vwu` (unit, quantity, executor, quality threshold, measurement window, verification method and evidence, reversal window and cost bound). `Actor` gains `org` (the accountable organisation, e.g. a vendor) and `version` (an agent's model/prompt/tool bundle). `dt outcome --accepted --vwu UNIT`, `dt vwu` (state: provisional, final or reverted; share verified without a person), `dt outcomes detect --vwu`. Schema stays 0.1.0: every field is optional and additive.
|
|
10
|
+
- `dt mcp --http`: self-hosted MCP server for teams (Claude.ai / ChatGPT connectors, Claude Code, agents): token by header or secret URL, tool allow-list, no access log, `/healthz`; Docker + Caddy deployment in `deploy/self-hosted-mcp/`.
|
|
11
|
+
- `dt outcomes detect`: outcomes from the store (overrides, reversal links, failed actions, human redos), git (reverts, merges) and business events (Stripe, Zendesk, Jira, GitHub, PagerDuty, generic JSONL); opt-in `--assume-accepted-after`. Never overrides a person's outcome.
|
|
12
|
+
|
|
13
|
+
## 0.1.0 — unreleased
|
|
14
|
+
|
|
15
|
+
First public release.
|
|
16
|
+
|
|
17
|
+
### Record
|
|
18
|
+
- Open JSON Schema v0.1.0 for `DT = ⟨C, P, E, X, H, T, O⟩` plus actions, state before/after,
|
|
19
|
+
typed links, inferred capabilities; outcome and correction records; OTel GenAI field mapping.
|
|
20
|
+
- Local SQLite store: append-only (triggers), per-store SHA-256 hash chain, `dt verify`.
|
|
21
|
+
- Redaction before write: secrets removed; e-mail, phone, card, PAN and Aadhaar pseudonymised.
|
|
22
|
+
Model reasoning never stored; bodies opt-in and erasable outside the chain.
|
|
23
|
+
|
|
24
|
+
### Adapters
|
|
25
|
+
- **Claude Code**: `dt install claude-code` — stdlib-only hook (~35 ms), one decision per
|
|
26
|
+
prompt, subagents as linked decisions, permission outcomes, denials, approvals, model,
|
|
27
|
+
tokens, git commit before/after.
|
|
28
|
+
- **MCP**: `dt mcp` with `record`, `recall`, `outcome`; `dt install claude-desktop|cursor`.
|
|
29
|
+
- **SDKs**: `dt.wrap()` for Anthropic (incl. tool runner, async, streaming) and OpenAI
|
|
30
|
+
(Chat Completions, Responses); `dt.decision()` / `dt.policy()` / `dt.exception()` /
|
|
31
|
+
`dt.approval()` for any code.
|
|
32
|
+
- **OpenTelemetry**: `dt ingest-otel` (OTLP/HTTP JSON and protobuf, or files).
|
|
33
|
+
|
|
34
|
+
### Recall
|
|
35
|
+
- `dt why <id|file|commit>`, `dt similar` (the paper's `Sim = αP + βX + γC + δA + εT − λΔt`),
|
|
36
|
+
`dt ask` (offline filters; `--llm` with Claude), `dt outcome`, `dt eval` golden sets.
|
|
37
|
+
- Optional embeddings (`[embeddings]`: model2vec + sqlite-vec).
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: liquicent-decisiontrace
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Record why your AI made a decision, at the moment it's made. Local-first, tamper-evident decision traces.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Liquicent/liquicent-decisiontrace
|
|
6
|
+
Project-URL: Issues, https://github.com/Liquicent/liquicent-decisiontrace/issues
|
|
7
|
+
Author: Liquicent
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai-agents,audit-trail,claude-code,decision-trace,mcp,opentelemetry
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: jsonschema>=4.21
|
|
20
|
+
Requires-Dist: mcp>=1.10
|
|
21
|
+
Requires-Dist: pydantic>=2.7
|
|
22
|
+
Requires-Dist: typer>=0.12
|
|
23
|
+
Provides-Extra: embeddings
|
|
24
|
+
Requires-Dist: model2vec>=0.6; extra == 'embeddings'
|
|
25
|
+
Requires-Dist: sqlite-vec>=0.1.6; extra == 'embeddings'
|
|
26
|
+
Provides-Extra: llm
|
|
27
|
+
Requires-Dist: anthropic>=1.0; extra == 'llm'
|
|
28
|
+
Provides-Extra: otel
|
|
29
|
+
Requires-Dist: opentelemetry-proto>=1.25; extra == 'otel'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# DecisionTrace
|
|
33
|
+
|
|
34
|
+
**Record *why* your AI made a decision, at the moment it's made — then ask `dt why` later.**
|
|
35
|
+
|
|
36
|
+
Logs tell you *what* an agent did. DecisionTrace records *why it was allowed to*: what it
|
|
37
|
+
was asked, what it looked at, which rules passed or failed, who granted an exception, what
|
|
38
|
+
it considered and rejected, who approved — and what happened next. Everything stays on your
|
|
39
|
+
machine, in an append-only, tamper-evident store.
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
$ dt why c1a90b2
|
|
43
|
+
Why: Fix timezone bug in invoice due-date calculation
|
|
44
|
+
|
|
45
|
+
On 15 Oct 2026 09:30 UTC, Claude Code made a code change for Praveen (model claude-sonnet-5-5, took 8 min, cost $0.37).
|
|
46
|
+
|
|
47
|
+
It was based on the request "Due dates are a day early for users in IST"; file src/billing/due_dates.py; file tests/test_due_dates.py.
|
|
48
|
+
|
|
49
|
+
Rules checked (2) — passed: Edit(src/**), Bash(uv run pytest:*).
|
|
50
|
+
|
|
51
|
+
Considered and rejected:
|
|
52
|
+
- Add +1 day offset for IST users — rejected by model: Patches the symptom; breaks other timezones
|
|
53
|
+
|
|
54
|
+
No human approval was recorded.
|
|
55
|
+
|
|
56
|
+
What was done (2 actions): Use aware datetimes in user timezone; uv run pytest tests/test_due_dates.py (12 passed).
|
|
57
|
+
Resulting state: git.commit c1a90b2.
|
|
58
|
+
|
|
59
|
+
Outcome: reverted.
|
|
60
|
+
2026-10-15: reverted — Broke month-end invoices for UTC-8 customers; reverted in c77d013
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Five minutes to `dt why`
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install liquicent-decisiontrace
|
|
67
|
+
dt install claude-code # hooks into Claude Code; nothing else to configure
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use Claude Code as usual. Then:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
dt log # today's decisions, grouped by what you asked
|
|
74
|
+
dt why <id | file | commit> # the full account of one decision
|
|
75
|
+
dt similar <id> # past decisions like it, with a similarity breakdown
|
|
76
|
+
dt ask "what did we revert last week?"
|
|
77
|
+
dt outcomes detect --git . # fill in outcomes from reverts, merges, overrides
|
|
78
|
+
dt vwu # verified work units: delivered, accepted, reversible
|
|
79
|
+
dt verify # recompute the hash chain
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
No Claude Code? Try the showcase without an API key:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/Liquicent/liquicent-decisiontrace && cd liquicent-decisiontrace
|
|
86
|
+
uv sync
|
|
87
|
+
uv run python examples/refund_agent.py # an agent refunds $850, over a $500 limit
|
|
88
|
+
uv run dt why "$(uv run dt log -n 1 | awk '{print $3}')"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Where decisions come from
|
|
92
|
+
|
|
93
|
+
| You use | Do this | Guide |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| Claude Code | `dt install claude-code` | [docs/adapters/claude-code.md](docs/adapters/claude-code.md) |
|
|
96
|
+
| Claude Desktop, Cursor, any MCP client | `dt install claude-desktop` / `dt install cursor` | [docs/adapters/mcp.md](docs/adapters/mcp.md) |
|
|
97
|
+
| Claude.ai / ChatGPT workspaces, a whole team | `dt mcp --http` on your own server | [docs/adapters/self-hosted-mcp.md](docs/adapters/self-hosted-mcp.md) |
|
|
98
|
+
| Anthropic or OpenAI SDK | `client = dt.wrap(client)` | [docs/adapters/sdk.md](docs/adapters/sdk.md) |
|
|
99
|
+
| OpenTelemetry GenAI spans | `dt ingest-otel`, point your exporter at it | [docs/adapters/otel.md](docs/adapters/otel.md) |
|
|
100
|
+
| Anything else | `with dt.decision(...) as d:` | [docs/adapters/sdk.md](docs/adapters/sdk.md#without-an-sdk) |
|
|
101
|
+
|
|
102
|
+
## The record
|
|
103
|
+
|
|
104
|
+
Every decision is `DT = ⟨C, P, E, X, H, T, O⟩`:
|
|
105
|
+
|
|
106
|
+
| | Field | Example |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| C | context | ticket 88412, order 7731, VIP customer |
|
|
109
|
+
| P | policies | `refund.max_auto_amount` → fail |
|
|
110
|
+
| E | exceptions | limit waived by the support lead: carrier damage |
|
|
111
|
+
| X | alternatives | partial refund of $500, rejected |
|
|
112
|
+
| H | human path | approval requested → approved after 9 min |
|
|
113
|
+
| T | actor & time | refunds agent, model, tokens, cost |
|
|
114
|
+
| O | outcome | pending → accepted (added later with `dt outcome`) |
|
|
115
|
+
|
|
116
|
+
The schema is an open standard — [schema/README.md](schema/README.md) — with field names
|
|
117
|
+
mapped to OpenTelemetry GenAI conventions.
|
|
118
|
+
|
|
119
|
+
## Principles
|
|
120
|
+
|
|
121
|
+
- **Captured at execution time.** Rejected options and approvals can't be rebuilt later.
|
|
122
|
+
- **Append-only, tamper-evident.** Outcomes and corrections are new linked records; every
|
|
123
|
+
record carries the previous one's hash. `dt verify` recomputes the chain.
|
|
124
|
+
- **On top of your tools, not in front of them.** No gateway, no proxy. Hooks, spans and SDK
|
|
125
|
+
callbacks you already have.
|
|
126
|
+
- **Local-first.** SQLite in `~/.decisiontrace`. No account, no server, no telemetry.
|
|
127
|
+
- **Private by default.** Secrets and personal data are redacted before anything is
|
|
128
|
+
written; prompt bodies are stored only if you opt in; model reasoning is never stored.
|
|
129
|
+
|
|
130
|
+
## What it is not
|
|
131
|
+
|
|
132
|
+
Not a gateway or policy enforcer (your code and your tools enforce; DecisionTrace records),
|
|
133
|
+
not an observability dashboard, not a hosted service. Team-wide recall, trust scores and
|
|
134
|
+
reports are [Liquicent](https://liquicent.com)'s job — *DecisionTrace records. Valence
|
|
135
|
+
reveals. Liquicent learns.*
|
|
136
|
+
|
|
137
|
+
## Status
|
|
138
|
+
|
|
139
|
+
0.1 — pre-release. Built in the open: [docs/BUILD_PLAN.md](docs/BUILD_PLAN.md),
|
|
140
|
+
[docs/progress-log.md](docs/progress-log.md), [CHANGELOG.md](CHANGELOG.md).
|
|
141
|
+
|
|
142
|
+
Apache-2.0. Contributions under the [DCO](CONTRIBUTING.md#developer-certificate-of-origin-dco).
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# DecisionTrace
|
|
2
|
+
|
|
3
|
+
**Record *why* your AI made a decision, at the moment it's made — then ask `dt why` later.**
|
|
4
|
+
|
|
5
|
+
Logs tell you *what* an agent did. DecisionTrace records *why it was allowed to*: what it
|
|
6
|
+
was asked, what it looked at, which rules passed or failed, who granted an exception, what
|
|
7
|
+
it considered and rejected, who approved — and what happened next. Everything stays on your
|
|
8
|
+
machine, in an append-only, tamper-evident store.
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
$ dt why c1a90b2
|
|
12
|
+
Why: Fix timezone bug in invoice due-date calculation
|
|
13
|
+
|
|
14
|
+
On 15 Oct 2026 09:30 UTC, Claude Code made a code change for Praveen (model claude-sonnet-5-5, took 8 min, cost $0.37).
|
|
15
|
+
|
|
16
|
+
It was based on the request "Due dates are a day early for users in IST"; file src/billing/due_dates.py; file tests/test_due_dates.py.
|
|
17
|
+
|
|
18
|
+
Rules checked (2) — passed: Edit(src/**), Bash(uv run pytest:*).
|
|
19
|
+
|
|
20
|
+
Considered and rejected:
|
|
21
|
+
- Add +1 day offset for IST users — rejected by model: Patches the symptom; breaks other timezones
|
|
22
|
+
|
|
23
|
+
No human approval was recorded.
|
|
24
|
+
|
|
25
|
+
What was done (2 actions): Use aware datetimes in user timezone; uv run pytest tests/test_due_dates.py (12 passed).
|
|
26
|
+
Resulting state: git.commit c1a90b2.
|
|
27
|
+
|
|
28
|
+
Outcome: reverted.
|
|
29
|
+
2026-10-15: reverted — Broke month-end invoices for UTC-8 customers; reverted in c77d013
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Five minutes to `dt why`
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install liquicent-decisiontrace
|
|
36
|
+
dt install claude-code # hooks into Claude Code; nothing else to configure
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use Claude Code as usual. Then:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
dt log # today's decisions, grouped by what you asked
|
|
43
|
+
dt why <id | file | commit> # the full account of one decision
|
|
44
|
+
dt similar <id> # past decisions like it, with a similarity breakdown
|
|
45
|
+
dt ask "what did we revert last week?"
|
|
46
|
+
dt outcomes detect --git . # fill in outcomes from reverts, merges, overrides
|
|
47
|
+
dt vwu # verified work units: delivered, accepted, reversible
|
|
48
|
+
dt verify # recompute the hash chain
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
No Claude Code? Try the showcase without an API key:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/Liquicent/liquicent-decisiontrace && cd liquicent-decisiontrace
|
|
55
|
+
uv sync
|
|
56
|
+
uv run python examples/refund_agent.py # an agent refunds $850, over a $500 limit
|
|
57
|
+
uv run dt why "$(uv run dt log -n 1 | awk '{print $3}')"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Where decisions come from
|
|
61
|
+
|
|
62
|
+
| You use | Do this | Guide |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| Claude Code | `dt install claude-code` | [docs/adapters/claude-code.md](docs/adapters/claude-code.md) |
|
|
65
|
+
| Claude Desktop, Cursor, any MCP client | `dt install claude-desktop` / `dt install cursor` | [docs/adapters/mcp.md](docs/adapters/mcp.md) |
|
|
66
|
+
| Claude.ai / ChatGPT workspaces, a whole team | `dt mcp --http` on your own server | [docs/adapters/self-hosted-mcp.md](docs/adapters/self-hosted-mcp.md) |
|
|
67
|
+
| Anthropic or OpenAI SDK | `client = dt.wrap(client)` | [docs/adapters/sdk.md](docs/adapters/sdk.md) |
|
|
68
|
+
| OpenTelemetry GenAI spans | `dt ingest-otel`, point your exporter at it | [docs/adapters/otel.md](docs/adapters/otel.md) |
|
|
69
|
+
| Anything else | `with dt.decision(...) as d:` | [docs/adapters/sdk.md](docs/adapters/sdk.md#without-an-sdk) |
|
|
70
|
+
|
|
71
|
+
## The record
|
|
72
|
+
|
|
73
|
+
Every decision is `DT = ⟨C, P, E, X, H, T, O⟩`:
|
|
74
|
+
|
|
75
|
+
| | Field | Example |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| C | context | ticket 88412, order 7731, VIP customer |
|
|
78
|
+
| P | policies | `refund.max_auto_amount` → fail |
|
|
79
|
+
| E | exceptions | limit waived by the support lead: carrier damage |
|
|
80
|
+
| X | alternatives | partial refund of $500, rejected |
|
|
81
|
+
| H | human path | approval requested → approved after 9 min |
|
|
82
|
+
| T | actor & time | refunds agent, model, tokens, cost |
|
|
83
|
+
| O | outcome | pending → accepted (added later with `dt outcome`) |
|
|
84
|
+
|
|
85
|
+
The schema is an open standard — [schema/README.md](schema/README.md) — with field names
|
|
86
|
+
mapped to OpenTelemetry GenAI conventions.
|
|
87
|
+
|
|
88
|
+
## Principles
|
|
89
|
+
|
|
90
|
+
- **Captured at execution time.** Rejected options and approvals can't be rebuilt later.
|
|
91
|
+
- **Append-only, tamper-evident.** Outcomes and corrections are new linked records; every
|
|
92
|
+
record carries the previous one's hash. `dt verify` recomputes the chain.
|
|
93
|
+
- **On top of your tools, not in front of them.** No gateway, no proxy. Hooks, spans and SDK
|
|
94
|
+
callbacks you already have.
|
|
95
|
+
- **Local-first.** SQLite in `~/.decisiontrace`. No account, no server, no telemetry.
|
|
96
|
+
- **Private by default.** Secrets and personal data are redacted before anything is
|
|
97
|
+
written; prompt bodies are stored only if you opt in; model reasoning is never stored.
|
|
98
|
+
|
|
99
|
+
## What it is not
|
|
100
|
+
|
|
101
|
+
Not a gateway or policy enforcer (your code and your tools enforce; DecisionTrace records),
|
|
102
|
+
not an observability dashboard, not a hosted service. Team-wide recall, trust scores and
|
|
103
|
+
reports are [Liquicent](https://liquicent.com)'s job — *DecisionTrace records. Valence
|
|
104
|
+
reveals. Liquicent learns.*
|
|
105
|
+
|
|
106
|
+
## Status
|
|
107
|
+
|
|
108
|
+
0.1 — pre-release. Built in the open: [docs/BUILD_PLAN.md](docs/BUILD_PLAN.md),
|
|
109
|
+
[docs/progress-log.md](docs/progress-log.md), [CHANGELOG.md](CHANGELOG.md).
|
|
110
|
+
|
|
111
|
+
Apache-2.0. Contributions under the [DCO](CONTRIBUTING.md#developer-certificate-of-origin-dco).
|