whyline 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.
Files changed (36) hide show
  1. whyline-0.1.0/.gitignore +12 -0
  2. whyline-0.1.0/LICENSE +202 -0
  3. whyline-0.1.0/PKG-INFO +171 -0
  4. whyline-0.1.0/README.md +146 -0
  5. whyline-0.1.0/pyproject.toml +67 -0
  6. whyline-0.1.0/src/whyline/__init__.py +1 -0
  7. whyline-0.1.0/src/whyline/__main__.py +3 -0
  8. whyline-0.1.0/src/whyline/agentsmd.py +37 -0
  9. whyline-0.1.0/src/whyline/brief.py +180 -0
  10. whyline-0.1.0/src/whyline/claudemd.py +36 -0
  11. whyline-0.1.0/src/whyline/cli.py +359 -0
  12. whyline-0.1.0/src/whyline/decisions.py +134 -0
  13. whyline-0.1.0/src/whyline/events.py +39 -0
  14. whyline-0.1.0/src/whyline/gitq.py +110 -0
  15. whyline-0.1.0/src/whyline/hook_entry.py +75 -0
  16. whyline-0.1.0/src/whyline/hooks.py +74 -0
  17. whyline-0.1.0/src/whyline/ledger.py +38 -0
  18. whyline-0.1.0/src/whyline/paths.py +32 -0
  19. whyline-0.1.0/src/whyline/render.py +282 -0
  20. whyline-0.1.0/src/whyline/resolve.py +193 -0
  21. whyline-0.1.0/src/whyline/runner.py +66 -0
  22. whyline-0.1.0/tests/conftest.py +55 -0
  23. whyline-0.1.0/tests/test_agentsmd.py +30 -0
  24. whyline-0.1.0/tests/test_brief.py +339 -0
  25. whyline-0.1.0/tests/test_claudemd.py +37 -0
  26. whyline-0.1.0/tests/test_cli.py +623 -0
  27. whyline-0.1.0/tests/test_decisions.py +198 -0
  28. whyline-0.1.0/tests/test_events.py +32 -0
  29. whyline-0.1.0/tests/test_gitq.py +96 -0
  30. whyline-0.1.0/tests/test_hook_entry.py +62 -0
  31. whyline-0.1.0/tests/test_hooks.py +87 -0
  32. whyline-0.1.0/tests/test_ledger.py +109 -0
  33. whyline-0.1.0/tests/test_paths.py +21 -0
  34. whyline-0.1.0/tests/test_perf.py +109 -0
  35. whyline-0.1.0/tests/test_resolve.py +222 -0
  36. whyline-0.1.0/tests/test_runner.py +151 -0
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .ruff_cache/
5
+ .mypy_cache/
6
+ .venv/
7
+ phase0/results/
8
+ .whyline/ledger.jsonl
9
+ .whyline/index.db
10
+ dist/
11
+ *.egg-info/
12
+ .DS_Store
whyline-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
whyline-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.5
2
+ Name: whyline
3
+ Version: 0.1.0
4
+ Summary: Records why your code exists, and tells the next agent.
5
+ Project-URL: Homepage, https://github.com/anishmoncivarghese/whyline
6
+ Project-URL: Source, https://github.com/anishmoncivarghese/whyline
7
+ Project-URL: Issues, https://github.com/anishmoncivarghese/whyline/issues
8
+ Author: Anish Varghese
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: agents,ai,claude-code,codex,decision-log,git,handoff,provenance
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Documentation
22
+ Classifier: Topic :: Software Development :: Version Control :: Git
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+
26
+ # whyline
27
+
28
+ Use Claude Code and Codex on the same project without either one starting blind.
29
+
30
+ ```
31
+ $ whyline explain src/tsconfig/resolve.ts:41
32
+
33
+ Decision Treat only canonical in-repo workspace package exports as internal
34
+ Because node_modules must be readable for resolution but never indexed
35
+ Rejected classify any resolvable node_modules target as internal
36
+ indexes third-party declarations and violates FR-005
37
+ Confidence High — a recorded decision matches the commit for this line.
38
+ ```
39
+
40
+ Free, Apache-2.0, local-only. No accounts, no telemetry, no paid tier, ever.
41
+
42
+ ## The problem this solves
43
+
44
+ Claude Code and Codex are good at different things. You might want Claude to plan
45
+ a feature and write the tests, then Codex to review the diff — or the reverse.
46
+ That combination is genuinely useful, and today it is genuinely painful: the
47
+ second agent starts from nothing. It has no idea what the first one concluded,
48
+ what it tried, or what it deliberately ruled out. So you re-explain, or paste, or
49
+ just give up and use one agent for everything.
50
+
51
+ whyline fixes that with a decision record both agents write to and read from. The
52
+ one that finishes leaves behind what it decided and what it rejected; the one that
53
+ starts picks it up. Neither has to be told twice.
54
+
55
+ **On the subscriptions you already pay for.** whyline never touches a credential.
56
+ It launches the vendor's own CLI with `exec`, so Claude Code authenticates as
57
+ Claude Code and Codex authenticates as Codex. No API keys, no per-token billing,
58
+ nothing metered on top of what you already have.
59
+
60
+ And because the record is committed to your repository as plain Markdown, it
61
+ outlives the session. Six months later, `whyline explain` still answers why a line
62
+ of code exists — which is the same mechanism, read at a longer horizon.
63
+
64
+ ## Install
65
+
66
+ Not yet published. From a clone:
67
+
68
+ ```bash
69
+ uv tool install --from . whyline
70
+ ```
71
+
72
+ Zero production dependencies — standard library only. Python 3.11+, plus `git`.
73
+
74
+ ## Quickstart
75
+
76
+ ```bash
77
+ whyline init # scaffold, add instructions, install the hook
78
+ ```
79
+
80
+ Then work normally. Your agents record their own decisions, because `init` adds an
81
+ instruction to `AGENTS.md` asking them to. When you want to switch:
82
+
83
+ ```bash
84
+ whyline run codex "review the caching change"
85
+ ```
86
+
87
+ That composes what Claude decided and hands the terminal to Codex with it attached.
88
+ The reverse works the same way: `whyline run claude "..."`.
89
+
90
+ The rest of the surface:
91
+
92
+ ```bash
93
+ whyline brief # print the handoff context without launching
94
+ whyline explain src/a.py:14 # why does this line exist?
95
+ whyline note "chose X" --because "Y" --rejected "Z: too slow" --file src/a.py
96
+ whyline timeline --file src/a.py
97
+ whyline status
98
+ ```
99
+
100
+ ## How it works
101
+
102
+ Three layers feed one ledger:
103
+
104
+ 1. **git** resolves a line to a commit via `git blame`. Works before whyline has
105
+ recorded anything.
106
+ 2. **A hook** silently records sessions, instructions and file edits. It can never
107
+ fail your session — every path exits 0.
108
+ 3. **Your agent** records the reasoning. `whyline init` adds an `AGENTS.md`
109
+ instruction asking agents to log decisions and rejected alternatives. This is
110
+ the only layer that captures *why*.
111
+
112
+ `.whyline/decisions.md` is committed and readable with whyline uninstalled.
113
+ `.whyline/ledger.jsonl` is gitignored, because it holds your prompt text.
114
+
115
+ ## Does the third layer actually work?
116
+
117
+ It was the design's one unproven assumption, so it was measured before the
118
+ features depending on it were built. Over three days across two agents on a real
119
+ project, 19 decisions were recorded across 14 commits — Claude Code 150% of its
120
+ non-trivial changes, Codex 130%, against a 60% threshold. Every one carried a
121
+ rationale and a concrete rejected alternative. Codex was never reminded.
122
+
123
+ Full method and caveats: [`m0/RESULTS.md`](m0/RESULTS.md).
124
+
125
+ ## Honest limitations
126
+
127
+ - **Switching agents is a relay, not a shared conversation.** Vendor CLIs are
128
+ separate processes with separate context windows. `brief` hands the next agent a
129
+ written summary; it cannot continue the previous conversation. Nothing can.
130
+ - **`explain` reports confidence and will say when it does not know.** An empty
131
+ ledger produces an honest empty answer, not a guess. File-level `explain` never
132
+ claims high confidence, because without a line there is no blamed commit.
133
+ - **The hook is Claude Code only** in v1. Codex and Gemini both support hooks, so
134
+ this is a limit of scope, not of design.
135
+ - **Gemini is not supported by `run`** — its free personal tier was withdrawn.
136
+ - **Parallel agents are not coordinated.** No worktree isolation in v1.
137
+ - **`brief` degrades on a fresh clone.** The ledger is gitignored, so a clone has
138
+ only the committed `decisions.md`, which carries day precision rather than full
139
+ timestamps. `brief` merges both sources and tells you which is which.
140
+ - **macOS and Linux are verified; Windows is not.** CI passes on `ubuntu-latest`
141
+ and `macos-latest` across Python 3.11 and 3.13. Windows via WSL is untested — a
142
+ plausible claim, not an observation.
143
+
144
+ ## Credentials
145
+
146
+ whyline never reads, stores, forwards or proxies a vendor token. `run` replaces
147
+ itself with the vendor's own CLI via `exec`, which does its own authentication.
148
+ Your subscription works because the official CLI is what talks to the vendor.
149
+ Permission-bypass flags are never added.
150
+
151
+ ## Performance
152
+
153
+ Measured on an M-series Mac, median of seven runs, against a 200 ms target:
154
+
155
+ | Command | Total | whyline's own cost |
156
+ |---|---:|---:|
157
+ | `brief` | 41 ms | 23 ms |
158
+ | `timeline` | 46 ms | 27 ms |
159
+ | `status` | 47 ms | 28 ms |
160
+ | `explain` | 79 ms | 60 ms |
161
+
162
+ Bare Python interpreter startup is 19 ms of every figure above, so the right-hand
163
+ column is what whyline actually costs. `explain` is dearer because it shells out
164
+ to `git blame`.
165
+
166
+ On a 50,000-event, 6.5 MB ledger `explain` takes ~159 ms against a 1 s target —
167
+ which is why there is no SQLite index.
168
+
169
+ ## Licence
170
+
171
+ Apache-2.0.
@@ -0,0 +1,146 @@
1
+ # whyline
2
+
3
+ Use Claude Code and Codex on the same project without either one starting blind.
4
+
5
+ ```
6
+ $ whyline explain src/tsconfig/resolve.ts:41
7
+
8
+ Decision Treat only canonical in-repo workspace package exports as internal
9
+ Because node_modules must be readable for resolution but never indexed
10
+ Rejected classify any resolvable node_modules target as internal
11
+ indexes third-party declarations and violates FR-005
12
+ Confidence High — a recorded decision matches the commit for this line.
13
+ ```
14
+
15
+ Free, Apache-2.0, local-only. No accounts, no telemetry, no paid tier, ever.
16
+
17
+ ## The problem this solves
18
+
19
+ Claude Code and Codex are good at different things. You might want Claude to plan
20
+ a feature and write the tests, then Codex to review the diff — or the reverse.
21
+ That combination is genuinely useful, and today it is genuinely painful: the
22
+ second agent starts from nothing. It has no idea what the first one concluded,
23
+ what it tried, or what it deliberately ruled out. So you re-explain, or paste, or
24
+ just give up and use one agent for everything.
25
+
26
+ whyline fixes that with a decision record both agents write to and read from. The
27
+ one that finishes leaves behind what it decided and what it rejected; the one that
28
+ starts picks it up. Neither has to be told twice.
29
+
30
+ **On the subscriptions you already pay for.** whyline never touches a credential.
31
+ It launches the vendor's own CLI with `exec`, so Claude Code authenticates as
32
+ Claude Code and Codex authenticates as Codex. No API keys, no per-token billing,
33
+ nothing metered on top of what you already have.
34
+
35
+ And because the record is committed to your repository as plain Markdown, it
36
+ outlives the session. Six months later, `whyline explain` still answers why a line
37
+ of code exists — which is the same mechanism, read at a longer horizon.
38
+
39
+ ## Install
40
+
41
+ Not yet published. From a clone:
42
+
43
+ ```bash
44
+ uv tool install --from . whyline
45
+ ```
46
+
47
+ Zero production dependencies — standard library only. Python 3.11+, plus `git`.
48
+
49
+ ## Quickstart
50
+
51
+ ```bash
52
+ whyline init # scaffold, add instructions, install the hook
53
+ ```
54
+
55
+ Then work normally. Your agents record their own decisions, because `init` adds an
56
+ instruction to `AGENTS.md` asking them to. When you want to switch:
57
+
58
+ ```bash
59
+ whyline run codex "review the caching change"
60
+ ```
61
+
62
+ That composes what Claude decided and hands the terminal to Codex with it attached.
63
+ The reverse works the same way: `whyline run claude "..."`.
64
+
65
+ The rest of the surface:
66
+
67
+ ```bash
68
+ whyline brief # print the handoff context without launching
69
+ whyline explain src/a.py:14 # why does this line exist?
70
+ whyline note "chose X" --because "Y" --rejected "Z: too slow" --file src/a.py
71
+ whyline timeline --file src/a.py
72
+ whyline status
73
+ ```
74
+
75
+ ## How it works
76
+
77
+ Three layers feed one ledger:
78
+
79
+ 1. **git** resolves a line to a commit via `git blame`. Works before whyline has
80
+ recorded anything.
81
+ 2. **A hook** silently records sessions, instructions and file edits. It can never
82
+ fail your session — every path exits 0.
83
+ 3. **Your agent** records the reasoning. `whyline init` adds an `AGENTS.md`
84
+ instruction asking agents to log decisions and rejected alternatives. This is
85
+ the only layer that captures *why*.
86
+
87
+ `.whyline/decisions.md` is committed and readable with whyline uninstalled.
88
+ `.whyline/ledger.jsonl` is gitignored, because it holds your prompt text.
89
+
90
+ ## Does the third layer actually work?
91
+
92
+ It was the design's one unproven assumption, so it was measured before the
93
+ features depending on it were built. Over three days across two agents on a real
94
+ project, 19 decisions were recorded across 14 commits — Claude Code 150% of its
95
+ non-trivial changes, Codex 130%, against a 60% threshold. Every one carried a
96
+ rationale and a concrete rejected alternative. Codex was never reminded.
97
+
98
+ Full method and caveats: [`m0/RESULTS.md`](m0/RESULTS.md).
99
+
100
+ ## Honest limitations
101
+
102
+ - **Switching agents is a relay, not a shared conversation.** Vendor CLIs are
103
+ separate processes with separate context windows. `brief` hands the next agent a
104
+ written summary; it cannot continue the previous conversation. Nothing can.
105
+ - **`explain` reports confidence and will say when it does not know.** An empty
106
+ ledger produces an honest empty answer, not a guess. File-level `explain` never
107
+ claims high confidence, because without a line there is no blamed commit.
108
+ - **The hook is Claude Code only** in v1. Codex and Gemini both support hooks, so
109
+ this is a limit of scope, not of design.
110
+ - **Gemini is not supported by `run`** — its free personal tier was withdrawn.
111
+ - **Parallel agents are not coordinated.** No worktree isolation in v1.
112
+ - **`brief` degrades on a fresh clone.** The ledger is gitignored, so a clone has
113
+ only the committed `decisions.md`, which carries day precision rather than full
114
+ timestamps. `brief` merges both sources and tells you which is which.
115
+ - **macOS and Linux are verified; Windows is not.** CI passes on `ubuntu-latest`
116
+ and `macos-latest` across Python 3.11 and 3.13. Windows via WSL is untested — a
117
+ plausible claim, not an observation.
118
+
119
+ ## Credentials
120
+
121
+ whyline never reads, stores, forwards or proxies a vendor token. `run` replaces
122
+ itself with the vendor's own CLI via `exec`, which does its own authentication.
123
+ Your subscription works because the official CLI is what talks to the vendor.
124
+ Permission-bypass flags are never added.
125
+
126
+ ## Performance
127
+
128
+ Measured on an M-series Mac, median of seven runs, against a 200 ms target:
129
+
130
+ | Command | Total | whyline's own cost |
131
+ |---|---:|---:|
132
+ | `brief` | 41 ms | 23 ms |
133
+ | `timeline` | 46 ms | 27 ms |
134
+ | `status` | 47 ms | 28 ms |
135
+ | `explain` | 79 ms | 60 ms |
136
+
137
+ Bare Python interpreter startup is 19 ms of every figure above, so the right-hand
138
+ column is what whyline actually costs. `explain` is dearer because it shells out
139
+ to `git blame`.
140
+
141
+ On a 50,000-event, 6.5 MB ledger `explain` takes ~159 ms against a 1 s target —
142
+ which is why there is no SQLite index.
143
+
144
+ ## Licence
145
+
146
+ Apache-2.0.
@@ -0,0 +1,67 @@
1
+ [project]
2
+ name = "whyline"
3
+ version = "0.1.0"
4
+ description = "Records why your code exists, and tells the next agent."
5
+ requires-python = ">=3.11"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ readme = "README.md"
9
+ authors = [{ name = "Anish Varghese" }]
10
+ keywords = [
11
+ "ai",
12
+ "agents",
13
+ "claude-code",
14
+ "codex",
15
+ "provenance",
16
+ "git",
17
+ "handoff",
18
+ "decision-log",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Environment :: Console",
23
+ "Intended Audience :: Developers",
24
+ "License :: OSI Approved :: Apache Software License",
25
+ "Operating System :: MacOS",
26
+ "Operating System :: POSIX :: Linux",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Topic :: Software Development :: Version Control :: Git",
31
+ "Topic :: Software Development :: Documentation",
32
+ ]
33
+ dependencies = []
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/anishmoncivarghese/whyline"
37
+ Source = "https://github.com/anishmoncivarghese/whyline"
38
+ Issues = "https://github.com/anishmoncivarghese/whyline/issues"
39
+
40
+ [project.scripts]
41
+ whyline = "whyline.cli:entry"
42
+ whyline-hook = "whyline.hook_entry:entry"
43
+
44
+ [build-system]
45
+ requires = ["hatchling", "editables"]
46
+ build-backend = "hatchling.build"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/whyline"]
50
+
51
+ # Whitelist what ships, rather than relying on exclusions. Caught 2026-08-18
52
+ # while inspecting the artifacts before a first publish: the default sdist swept
53
+ # in `.claude/settings.local.json` — which holds home-directory absolute paths and
54
+ # a log of locally approved shell commands — plus 27 files of internal review
55
+ # workspace under `.superpowers/`. Both are gitignored, so neither was ever in the
56
+ # repository, but hatchling packages from the working tree. A PyPI upload cannot
57
+ # be withdrawn, so this list is deliberately narrow: the package, its tests, and
58
+ # the two files a reader needs.
59
+ [tool.hatch.build.targets.sdist]
60
+ only-include = ["src/whyline", "tests", "README.md", "LICENSE"]
61
+
62
+ [tool.pytest.ini_options]
63
+ testpaths = ["tests"]
64
+ addopts = "-q"
65
+
66
+ [dependency-groups]
67
+ dev = ["pytest>=8.0"]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from whyline.cli import entry
2
+
3
+ entry()
@@ -0,0 +1,37 @@
1
+ """The canonical shared instruction that asks agents to record reasoning."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ BEGIN = "<!-- whyline:begin -->"
8
+ END = "<!-- whyline:end -->"
9
+
10
+ INSTRUCTION = f"""{BEGIN}
11
+ ## Recording decisions
12
+
13
+ After completing any non-trivial change, record the reasoning:
14
+
15
+ whyline note "<one-line decision>" \\
16
+ --because "<why this choice>" \\
17
+ --rejected "<option>: <why not>" \\
18
+ --file <path>
19
+
20
+ Record only genuine choices a future reader would wonder about. Skip typos,
21
+ formatting and renames. `--rejected` is repeatable. Do not ask permission.
22
+ Store shared project instructions here, but record evolving decision history
23
+ through whyline rather than appending it to AGENTS.md.
24
+ {END}
25
+ """
26
+
27
+
28
+ def install(path: Path) -> str:
29
+ if path.exists():
30
+ existing = path.read_text(encoding="utf-8")
31
+ if BEGIN in existing and END in existing:
32
+ return "already-present"
33
+ separator = "" if existing.endswith("\n") else "\n"
34
+ path.write_text(existing + separator + "\n" + INSTRUCTION, encoding="utf-8")
35
+ return "installed"
36
+ path.write_text(INSTRUCTION, encoding="utf-8")
37
+ return "installed"