clawbooks 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rev1ck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # clawbooks
2
+
3
+ Accounting by inference, not by engine.
4
+
5
+ An append-only ledger + plain english policy + CLI.
6
+ Your LLM agent reads the data, reads the policy, does the accounting.
7
+ No rules engine. No SDK. No framework.
8
+
9
+ **Two source files. Zero runtime dependencies.**
10
+
11
+ ## Setup
12
+
13
+ ```bash
14
+ git clone https://github.com/rev1ck/clawbooks.git
15
+ cd clawbooks
16
+ npm install
17
+ npm run build
18
+ cp policy.md.example policy.md # edit with your own accounting rules
19
+ ```
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install -g clawbooks
25
+ clawbooks --help
26
+ cp policy.md.example policy.md
27
+ ```
28
+
29
+ ## How it works
30
+
31
+ Clawbooks stores financial events and outputs context. The LLM you're already talking to does the accounting.
32
+
33
+ ```
34
+ You: "What's my P&L for March?"
35
+
36
+ Agent runs: clawbooks context 2026-03
37
+ Agent reads: policy + events
38
+ Agent thinks: *applies policy to events*
39
+ Agent responds: "Revenue: $1,700. Expenses: $475. Net: $1,225."
40
+ ```
41
+
42
+ There is no accounting engine. The LLM *is* the engine.
43
+
44
+ ## Commands
45
+
46
+ ```bash
47
+ # Write events
48
+ clawbooks record '{"source":"stripe","type":"payment","data":{"amount":500,"currency":"USD"}}'
49
+ cat events.jsonl | clawbooks batch
50
+
51
+ # Read events
52
+ clawbooks log --last 10
53
+ clawbooks log --source stripe --after 2026-03-01
54
+ clawbooks stats
55
+
56
+ # Load context for the agent
57
+ clawbooks context 2026-03
58
+ clawbooks context --after 2026-01-01
59
+
60
+ # Analysis
61
+ clawbooks verify 2026-03 # integrity + chain + duplicates
62
+ clawbooks verify --balance 50000 --currency USD # cross-check closing balance
63
+ clawbooks reconcile 2026-03 --source bank --count 50 --debits -12000 --gaps
64
+ clawbooks review --source bank # items needing classification
65
+ clawbooks summary 2026-03 # aggregates for reports
66
+ clawbooks snapshot 2026-03 --save # persist period snapshot
67
+ clawbooks assets --as-of 2026-03-31 # asset register + depreciation
68
+
69
+ # Print the policy
70
+ clawbooks policy
71
+ ```
72
+
73
+ ## The context command
74
+
75
+ This is the important one. It outputs your accounting policy + the latest snapshot + all events in a period, wrapped in XML tags. The agent reads this output and reasons over it.
76
+
77
+ ```bash
78
+ $ clawbooks context 2026-03
79
+
80
+ <policy>
81
+ # Accounting policy
82
+ Cash basis. Crypto trades are revenue income...
83
+ </policy>
84
+
85
+ <snapshot as_of="2026-03-01">
86
+ {"balances":{"USDC":45000},"ytd_pnl":18450}
87
+ </snapshot>
88
+
89
+ <events count="47" after="2026-03-01" before="2026-03-31">
90
+ {"ts":"...","source":"stripe","type":"payment","data":{"amount":500,...}}
91
+ {"ts":"...","source":"bank","type":"fee","data":{"amount":-55,...}}
92
+ ...
93
+ </events>
94
+ ```
95
+
96
+ ## Importing data
97
+
98
+ There is no import command. Your agent IS the importer.
99
+
100
+ ```
101
+ You: [paste CSV] "Import this bank statement"
102
+
103
+ Agent: *reads CSV, reads policy via `clawbooks policy`*
104
+ *classifies each row per the policy*
105
+ *outputs JSONL, pipes to `clawbooks batch`*
106
+
107
+ Agent: "Recorded 47 events from Chase March statement."
108
+ ```
109
+
110
+ ## Asset tracking
111
+
112
+ Mark purchases for capitalization with `data.capitalize: true`:
113
+
114
+ ```bash
115
+ clawbooks record '{"source":"bank","type":"expense","data":{"amount":15000,"currency":"USD","description":"MacBook Pro","category":"hardware","capitalize":true,"useful_life_months":36}}'
116
+ ```
117
+
118
+ Then track depreciation, disposals, write-offs, and impairments:
119
+
120
+ ```bash
121
+ clawbooks assets --as-of 2026-03-31
122
+ clawbooks record '{"source":"manual","type":"disposal","data":{"asset_id":"<id>","proceeds":5000,"currency":"USD"}}'
123
+ ```
124
+
125
+ ## Agent setup
126
+
127
+ Point your agent at `program.md` for instructions on how to use clawbooks. For example:
128
+
129
+ - **Claude Code** — add to your `CLAUDE.md`: `Read program.md in the clawbooks directory for financial record-keeping instructions.`
130
+ - **Codex** — add to your `AGENTS.md` or system prompt with the same pointer
131
+ - **Any agent** — any agent that can shell out can use clawbooks. The CLI outputs structured text. The agent reads it and reasons.
132
+
133
+ The npm package includes `program.md` plus all policy examples, so this workflow also works from a global install.
134
+
135
+ ## Files
136
+
137
+ ```
138
+ cli.ts CLI commands
139
+ ledger.ts JSONL read/write/filter
140
+ program.md Agent instructions (how to use clawbooks)
141
+ policy.md Your accounting rules (you write this, gitignored)
142
+ policy.md.example Example policy to start from
143
+ ledger.jsonl Your financial events (append-only, gitignored)
144
+ ```
145
+
146
+ ## Environment
147
+
148
+ | Variable | Default | Description |
149
+ |----------|---------|-------------|
150
+ | `CLAWBOOKS_LEDGER` | `./ledger.jsonl` | Path to ledger |
151
+ | `CLAWBOOKS_POLICY` | `./policy.md` | Path to policy |
152
+
153
+ No API key needed. The agent brings its own LLM.
154
+
155
+ ## License
156
+
157
+ MIT