@trajectonomics/cli 0.9.0-alpha.8 → 0.9.0-alpha.80
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/README.md +105 -99
- package/bin/launcher.js +1 -1
- package/bin/{traj.js → openretire.js} +5 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenRetire
|
|
2
2
|
|
|
3
|
-
`
|
|
4
|
-
The command line never calls a model, so every result is repeatable.
|
|
3
|
+
`openretire` is free, open-source financial simulation software for the AI era, and an AI agent
|
|
4
|
+
operates it. The command line never calls a model, so every result is repeatable. `traj`, its
|
|
5
|
+
earlier name, still runs the same program.
|
|
5
6
|
|
|
6
|
-
The
|
|
7
|
-
[trajectonomics.com/docs/](https://trajectonomics.com/docs/).
|
|
7
|
+
The product page is [trajectonomics.com/openretire/](https://trajectonomics.com/openretire/) and
|
|
8
|
+
the docs are at [trajectonomics.com/docs/](https://trajectonomics.com/docs/).
|
|
8
9
|
|
|
9
10
|
## Install
|
|
10
11
|
|
|
11
|
-
Linux and macOS, one line (verifies the release checksum, installs `traj`
|
|
12
|
-
or `$TRAJ_INSTALL_DIR`, and prints what it installed):
|
|
12
|
+
Linux and macOS, one line (verifies the release checksum, installs `openretire` and a `traj` link
|
|
13
|
+
to `~/.local/bin`, or into `$TRAJ_INSTALL_DIR`, and prints what it installed):
|
|
13
14
|
|
|
14
15
|
```bash
|
|
15
16
|
curl -fsSL https://github.com/trajectonomics/trajectonomics/releases/latest/download/install.sh | sh
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
Windows, one line (installs to `%LOCALAPPDATA%\traj\bin`,
|
|
19
|
-
and needs a new shell afterwards):
|
|
19
|
+
Windows, one line (installs `openretire.exe` and a `traj.exe` copy to `%LOCALAPPDATA%\traj\bin`,
|
|
20
|
+
adds it to the user `PATH` once, and needs a new shell afterwards):
|
|
20
21
|
|
|
21
22
|
```powershell
|
|
22
23
|
irm https://github.com/trajectonomics/trajectonomics/releases/latest/download/install.ps1 | iex
|
|
@@ -34,7 +35,7 @@ Then give your agent the setup skill. `-g` installs it for your user rather than
|
|
|
34
35
|
every project and every new session finds it:
|
|
35
36
|
|
|
36
37
|
```bash
|
|
37
|
-
npx skills add trajectonomics/trajectonomics/skills/customer --skill traj-onboarding -g -y
|
|
38
|
+
npx -y skills@1.9.0 add trajectonomics/trajectonomics/skills/customer --skill traj-onboarding -g -y
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
The setup skill asks about your situation and goal, then its second step installs the `traj`
|
|
@@ -42,7 +43,7 @@ operating skill from `skills/customer` in this repository, the folder both skill
|
|
|
42
43
|
installs that one globally too, for the same reason.
|
|
43
44
|
|
|
44
45
|
```bash
|
|
45
|
-
npx skills add trajectonomics/trajectonomics/skills/customer --skill traj -g -y
|
|
46
|
+
npx -y skills@1.9.0 add trajectonomics/trajectonomics/skills/customer --skill traj -g -y
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
That is the operating skill on its own, for an agent that is already set up. Both commands
|
|
@@ -50,20 +51,20 @@ use `npx`, so they need Node, which the npm channel already requires; the instal
|
|
|
50
51
|
do not.
|
|
51
52
|
|
|
52
53
|
Which channel: all three end at the same compiled binary and the same version. Use the
|
|
53
|
-
script for a machine that should keep `
|
|
54
|
+
script for a machine that should keep `openretire` on `PATH`, npm when you already have Node or
|
|
54
55
|
Bun and want one command. Pin a release with `TRAJ_VERSION=X.Y.Z` for the script, or
|
|
55
56
|
`@X.Y.Z` for npm.
|
|
56
57
|
|
|
57
|
-
Uninstall by
|
|
58
|
-
|
|
59
|
-
`npx`.
|
|
58
|
+
Uninstall by removing both names: `~/.local/bin/openretire` and the `traj` link beside it, the
|
|
59
|
+
whole `%LOCALAPPDATA%\traj\bin` directory (it holds `openretire.exe` and the `traj.exe` copy),
|
|
60
|
+
`~/.traj/bin` (the download cache only; your ledger is beside it), or nothing at all for `npx`.
|
|
60
61
|
|
|
61
|
-
`
|
|
62
|
+
`openretire` keeps the ledger in `~/.traj/traj.db`, or in `traj.db` inside `TRAJ_HOME` when that is
|
|
62
63
|
set, the same path on Linux, macOS and Windows. Beside it is the disposable `bin/` download
|
|
63
64
|
cache; deleting the data directory deletes the ledger. Take a lossless copy with:
|
|
64
65
|
|
|
65
66
|
```bash
|
|
66
|
-
|
|
67
|
+
openretire export --format jsonl --out backup
|
|
67
68
|
```
|
|
68
69
|
|
|
69
70
|
`--out` names a directory that must not exist yet, and JSONL is the only lossless export
|
|
@@ -74,12 +75,12 @@ format.
|
|
|
74
75
|
The ledger is one record, and the first run builds it in order:
|
|
75
76
|
|
|
76
77
|
```bash
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
openretire init
|
|
79
|
+
openretire account add Cash --type asset --currency THB
|
|
80
|
+
openretire account add Food --type expense --currency THB
|
|
81
|
+
openretire tx add --from Cash --to Food --amount 120.50 --date 2026-03-01
|
|
82
|
+
openretire balance --as-of 2026-03-31
|
|
83
|
+
openretire report networth --as-of 2026-03-31
|
|
83
84
|
```
|
|
84
85
|
|
|
85
86
|
`init` creates the data directory and an empty ledger. An account is a place money sits or
|
|
@@ -90,7 +91,7 @@ To chart net worth over time, state every month-end of a period in one read inst
|
|
|
90
91
|
call per month:
|
|
91
92
|
|
|
92
93
|
```bash
|
|
93
|
-
|
|
94
|
+
openretire report networth --monthly --since 2026-01-01 --until 2026-03-31
|
|
94
95
|
```
|
|
95
96
|
|
|
96
97
|
Each month is exactly what `--as-of` gives for that date.
|
|
@@ -99,20 +100,24 @@ A figure that sums accounts (net worth, the trial balance's debit and credit col
|
|
|
99
100
|
less expenses) can leave the safe integer range though every account is inside it. The read still
|
|
100
101
|
exits 0 and states every account, and states that figure as `null` with an error object beside it
|
|
101
102
|
(`netWorthError`, `totalsError`); the text form prints a sentence in its place. A figure inside the
|
|
102
|
-
range carries no error key. Run `
|
|
103
|
+
range carries no error key. Run `openretire schema balance` or `openretire schema report pnl` for
|
|
104
|
+
the exact shape.
|
|
103
105
|
|
|
104
|
-
`
|
|
105
|
-
`
|
|
106
|
+
`openretire help` lists the core commands and `openretire help --all` lists every command;
|
|
107
|
+
`openretire help <group>` lists that group's core subcommands and `openretire help <group> --all`
|
|
108
|
+
lists all of them; `openretire help <command>` lists one command's flags, and
|
|
109
|
+
`openretire schema --json` prints the whole contract: every command's input, output and error
|
|
110
|
+
codes.
|
|
106
111
|
|
|
107
112
|
## Importing a statement
|
|
108
113
|
|
|
109
114
|
To load a bank statement, fill the one CSV template instead of adding each transaction by
|
|
110
|
-
hand. `
|
|
115
|
+
hand. `openretire tx import` has been in every release since 0.1.0.
|
|
111
116
|
|
|
112
117
|
```bash
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
openretire tx import --template # print the template header and nothing else
|
|
119
|
+
openretire tx import statement.csv --dry-run
|
|
120
|
+
openretire tx import statement.csv
|
|
116
121
|
```
|
|
117
122
|
|
|
118
123
|
`--template` prints the header the importer reads, and it opens no data directory:
|
|
@@ -123,7 +128,7 @@ date,from,to,amount,memo,external_ref,project
|
|
|
123
128
|
|
|
124
129
|
Start your file with that header and write one row per transaction. `--dry-run` reports every
|
|
125
130
|
row and rolls every write back, so run it first. A file name of `-` reads the CSV from stdin, as in
|
|
126
|
-
`
|
|
131
|
+
`openretire tx import - --dry-run`. The import is all or nothing, and `external_ref` is the duplicate
|
|
127
132
|
key, so importing the same statement twice adds nothing the second time. Each command's flags and
|
|
128
133
|
the rest of the columns are in
|
|
129
134
|
[the `tx` page of the docs](https://trajectonomics.com/docs/cli/commands/tx/).
|
|
@@ -149,15 +154,15 @@ From a checkout, run the CLI with `bun run dev -- …`. The npm launcher refuses
|
|
|
149
154
|
## Reading the future
|
|
150
155
|
|
|
151
156
|
Three read-only commands run a stored Scenario over the Baseline the ledger
|
|
152
|
-
states at a date: `
|
|
153
|
-
nominal and real (monthly rows with `--monthly`); `
|
|
157
|
+
states at a date: `openretire projection run` rolls net worth up year by year,
|
|
158
|
+
nominal and real (monthly rows with `--monthly`); `openretire projection compare`
|
|
154
159
|
puts two Scenarios side by side, or one against a `--set` what-if, with the
|
|
155
160
|
deltas in FI date, net worth at the ages you name and run-out year; and
|
|
156
|
-
`
|
|
161
|
+
`openretire fi` reports the survival FI date beside the 25× rule of thumb as a
|
|
157
162
|
labelled reference. Every date flag is a Gregorian year between 1900 and
|
|
158
163
|
2100, so a Buddhist year is refused instead of read as 543 years later. Every result states its As-of, the engine version, the
|
|
159
164
|
Scenario's hashes, the Overrides it applied, and its tax status.
|
|
160
|
-
`
|
|
165
|
+
`openretire schema <command>` describes each one.
|
|
161
166
|
|
|
162
167
|
Each result also says what every tax year owes: `taxYears` in JSON, and the
|
|
163
168
|
`taxYears` table in the human format. A row names its Levy, the period and the
|
|
@@ -167,7 +172,7 @@ says whether the settlement date falls inside the Projection, and `partial`
|
|
|
167
172
|
whether the Projection ended before the period did, so a figure that is still
|
|
168
173
|
ahead of you is never mistaken for one already charged.
|
|
169
174
|
|
|
170
|
-
Tax is the Scenario's. `
|
|
175
|
+
Tax is the Scenario's. `openretire scenario tax <name> --tax th-2026` writes Thailand's
|
|
171
176
|
2026 personal income tax into it, and `--label salary=income.section40_1` says
|
|
172
177
|
which Section 40 class each income Flow belongs to, because a Levy tallies
|
|
173
178
|
labels and never guesses them; `--none` takes both out again, with the
|
|
@@ -185,9 +190,9 @@ deduction nobody stated is visible rather than assumed to be zero. It states
|
|
|
185
190
|
what the flags said, never what tax-core applied: a premium the statute does
|
|
186
191
|
not allow for the filing status is still stated, and the Levy zeroes it.
|
|
187
192
|
|
|
188
|
-
The write keeps that profile beside the Scenario, and `
|
|
193
|
+
The write keeps that profile beside the Scenario, and `openretire scenario show` prints
|
|
189
194
|
it back as `tax`. `--merge` then changes only the flags it carries
|
|
190
|
-
(`
|
|
195
|
+
(`openretire scenario tax base --merge --children 2`) and keeps the rest, and
|
|
191
196
|
`--from-stored` writes the Levy again from the profile, for example after a
|
|
192
197
|
tax-year update. Both need a stored profile: a plan taxed before it was kept
|
|
193
198
|
states its profile whole once. `--if-hash` refuses a write over a plan that
|
|
@@ -214,7 +219,7 @@ joint return, which one Levy over a single label could not apply. Salaries of
|
|
|
214
219
|
letters, digits or hyphens, is refused by name. A plan without a partner or without
|
|
215
220
|
`owners` writes the bare labels it always wrote, for every filing status. The result
|
|
216
221
|
lists the `filers` when it has any, and the household's Owners are read each time the
|
|
217
|
-
tax is written, so after changing them run `
|
|
222
|
+
tax is written, so after changing them run `openretire scenario tax <name> --from-stored`.
|
|
218
223
|
|
|
219
224
|
A couple who file separately get one Levy each. `--filing-status married_separate` writes
|
|
220
225
|
`th-2026-pit@me` and `th-2026-pit@partner`, one per person who has a labelled Flow or
|
|
@@ -230,7 +235,7 @@ income that year claims all of it, a person with no income claims nothing of it,
|
|
|
230
235
|
odd satang goes to the holder. The shared total is at most 100,000 baht
|
|
231
236
|
(`MORTGAGE_OVER_CEILING`), and `shared=` is refused under any other filing status. A
|
|
232
237
|
person's own `--mortgage-interest` is for their other loans, and each Return claims at
|
|
233
|
-
most 100,000 baht of its own interest and its share together. `
|
|
238
|
+
most 100,000 baht of its own interest and its share together. `openretire` cannot tell which
|
|
234
239
|
loan interest is on, so when both claim their own, a loan's Owner is `shared` and no
|
|
235
240
|
shared interest is stated, the result's `assumptions` say the loans are taken to be
|
|
236
241
|
separate. `--merge` and `--from-stored` keep the stored `returns` and
|
|
@@ -283,20 +288,20 @@ the other Return's. A missing class is listed by name, and a bare label is refus
|
|
|
283
288
|
|
|
284
289
|
## Chance of success
|
|
285
290
|
|
|
286
|
-
`
|
|
291
|
+
`openretire projection chance` runs one Scenario over seeded Market paths and reports
|
|
287
292
|
the share that never run out before the Horizon, with the net-worth Bands at each
|
|
288
293
|
year. The paths draw from a Return model you state in a JSON file, with
|
|
289
294
|
`--return-model`, and `--paths` and `--seed` are required, so the same model,
|
|
290
295
|
seed and count always give the same answer. The CLI ships no Return model: which
|
|
291
296
|
market history a plan is tested against is your decision, and every figure is
|
|
292
|
-
only as good as that choice. `
|
|
297
|
+
only as good as that choice. `openretire schema projection chance` describes the file.
|
|
293
298
|
Or pass `--return-model plan` to build the model from the plan itself: each asset
|
|
294
299
|
Account's `rate` and its `volatility` (the standard deviation of its yearly
|
|
295
300
|
return, in basis points, which you write into the Scenario), and the Scenario's
|
|
296
301
|
`economy.inflationVolatility` (the standard deviation of one year's inflation)
|
|
297
302
|
as an inflation factor, when you state one. `--buckets` sets its size (a power
|
|
298
303
|
of two from 16 to 1024, 256 by default), the result echoes what it was built
|
|
299
|
-
from as `returnModel`, and `
|
|
304
|
+
from as `returnModel`, and `openretire projection model --scenario NAME` prints the
|
|
300
305
|
model as JSON, a file `--return-model` reads back. A plan with neither an
|
|
301
306
|
Account `volatility` nor an `inflationVolatility` is refused, because every path
|
|
302
307
|
would be the same path.
|
|
@@ -304,7 +309,7 @@ Add `--outcomes` to see what each path came to: its closing and lowest net
|
|
|
304
309
|
worth, the year it was lowest and when it ran out, with the paths at the 10th,
|
|
305
310
|
50th and 90th percentile, the earliest to run out and the lowest named as
|
|
306
311
|
`representative` (the human form prints every path, worst first). Then
|
|
307
|
-
`
|
|
312
|
+
`openretire projection path --index N`, with the same flags, replays path N year by
|
|
308
313
|
year: `projection run`'s result, with the same flags for the cash flow and each
|
|
309
314
|
Account's value, plus the market return each Account drew in each year as
|
|
310
315
|
`returns`. An index is a path's name under the seed, so it is from 0 to
|
|
@@ -312,13 +317,13 @@ Account's value, plus the market return each Account drew in each year as
|
|
|
312
317
|
Add `--milestone-dates` to see when each Milestone of the plan fired: how many
|
|
313
318
|
paths reached it, the median and 10th to 90th percentile months with each
|
|
314
319
|
household person's age, and the paths per year.
|
|
315
|
-
Pass `--paths` and `--seed` to `
|
|
320
|
+
Pass `--paths` and `--seed` to `openretire dashboard` to add the chance of success to the
|
|
316
321
|
Dashboard, as a page of its own: it uses `plan` unless you name a
|
|
317
322
|
`--return-model` file.
|
|
318
323
|
|
|
319
324
|
## Tax allowances
|
|
320
325
|
|
|
321
|
-
`
|
|
326
|
+
`openretire projection allowances` reads a Scenario that has a tax Levy and says, for each
|
|
322
327
|
whole tax year the Projection holds, how much more of each contribution label (RMF, ThaiESG
|
|
323
328
|
and the others the Levy reads) would still lower the tax, and by how much. You name the
|
|
324
329
|
labels in the order they should fill with `--labels`, and the size of one step with
|
|
@@ -329,31 +334,32 @@ which you add to the Scenario yourself: the command writes nothing. The figures
|
|
|
329
334
|
plan's own tax rules, an estimate and not tax advice, and each fund's holding rules are
|
|
330
335
|
not checked. A year that ended before the As-of, and a year the horizon cuts short, are left out; the
|
|
331
336
|
current year is included, and when the As-of falls mid-year it needs `--carry-in`, the
|
|
332
|
-
record of what was already contributed in that year earlier. `
|
|
337
|
+
record of what was already contributed in that year earlier. `openretire schema projection allowances`
|
|
333
338
|
describes the result.
|
|
334
339
|
|
|
335
340
|
## Money as decimals in a Scenario
|
|
336
341
|
|
|
337
|
-
`
|
|
342
|
+
`openretire scenario show base --decimal` prints a Scenario with each amount as a decimal string of the
|
|
338
343
|
Currency's major unit, such as `"1000.00"` for 100000 satang, and
|
|
339
|
-
`
|
|
344
|
+
`openretire scenario apply base --file base.json --decimal` reads that form back. The stored plan is the
|
|
340
345
|
same either way: saving what `show --decimal` printed leaves it unchanged. A value with more places
|
|
341
346
|
than the Currency has is refused, never rounded.
|
|
342
347
|
|
|
343
348
|
## A what-if, applied to the plan it came from
|
|
344
349
|
|
|
345
|
-
`
|
|
346
|
-
change to the stored plan, so the plan you keep is the one you projected. It takes
|
|
347
|
-
`--without` and `--decimal` that `projection run` takes, and refuses what they would be
|
|
350
|
+
`openretire projection run --set` projects a change without saving it. `openretire scenario apply`
|
|
351
|
+
saves the same change to the stored plan, so the plan you keep is the one you projected. It takes
|
|
352
|
+
the `--set`, `--without` and `--decimal` that `projection run` takes, and refuses what they would be
|
|
353
|
+
refused for:
|
|
348
354
|
|
|
349
355
|
```bash
|
|
350
|
-
|
|
351
|
-
|
|
356
|
+
openretire scenario apply base --set flows.salary.amount=9000000 --dry-run
|
|
357
|
+
openretire scenario apply base --set flows.salary.amount=9000000 --without flows.gym
|
|
352
358
|
```
|
|
353
359
|
|
|
354
360
|
The result names the Overrides it wrote. A change that leaves the plan as it is writes nothing and
|
|
355
361
|
exits 0. `--if-hash <contentHash>` writes only when the stored plan still has that hash, as
|
|
356
|
-
`
|
|
362
|
+
`openretire scenario show` printed it, and refuses the write otherwise. Without `--file`, `--set` and
|
|
357
363
|
`--without` never take a document, so the what-if cannot replace a plan you did not read.
|
|
358
364
|
|
|
359
365
|
### Adding an item to a what-if
|
|
@@ -365,9 +371,9 @@ Every read that takes `--set` takes `--add` (`projection run`, `projection compa
|
|
|
365
371
|
`projection chance` and `projection allowances`), and `scenario fork` and `scenario apply` save it:
|
|
366
372
|
|
|
367
373
|
```bash
|
|
368
|
-
|
|
374
|
+
openretire projection run --scenario base --as-of 2026-03-31 --horizon 2027-03-30 \
|
|
369
375
|
--add 'flows={"id":"extra","kind":"expense","amount":"1000.00","frequency":"monthly","start":"2026-04-01","growth":{"bps":0}}' --decimal
|
|
370
|
-
|
|
376
|
+
openretire scenario apply base --add 'flows={...}' --decimal --if-hash <contentHash>
|
|
371
377
|
```
|
|
372
378
|
|
|
373
379
|
The flags apply in a fixed order whatever order they are typed in: every `--without`, then every
|
|
@@ -383,13 +389,13 @@ item's money is a decimal string of the Currency's major unit. Nothing is writte
|
|
|
383
389
|
## Naming plans, keeping notes on them, and marking the main one
|
|
384
390
|
|
|
385
391
|
A person who compares "retire at 55" with "retire at 60 and buy a condo" ends up with several plans.
|
|
386
|
-
`
|
|
387
|
-
`contentHash`. `
|
|
388
|
-
on it (`--file <path>` or `--file -` reads it, `--clear` removes it), and `scenario show`
|
|
389
|
-
back as `notes`. Notes are not part of the plan, so they never change its `contentHash`,
|
|
390
|
-
`scenario fork` copies them unless it is given `--no-notes`.
|
|
392
|
+
`openretire scenario rename early retire-at-55` gives a plan a better name and keeps its id, document
|
|
393
|
+
and `contentHash`. `openretire scenario notes retire-at-55 --text "Sell the condo in 2031."` keeps
|
|
394
|
+
plain text on it (`--file <path>` or `--file -` reads it, `--clear` removes it), and `scenario show`
|
|
395
|
+
prints it back as `notes`. Notes are not part of the plan, so they never change its `contentHash`,
|
|
396
|
+
and a `scenario fork` copies them unless it is given `--no-notes`.
|
|
391
397
|
|
|
392
|
-
`
|
|
398
|
+
`openretire scenario main retire-at-55` marks one plan as your main plan, and `scenario list` and
|
|
393
399
|
`scenario show` print `main`. It is a label and not a default: `projection run` and every other read
|
|
394
400
|
still need `--scenario`. `scenario rm` of the main plan is refused until another is chosen
|
|
395
401
|
(`scenario main --clear` takes the mark off), or removed anyway with `--force`.
|
|
@@ -398,10 +404,10 @@ still need `--scenario`. `scenario rm` of the main plan is refused until another
|
|
|
398
404
|
|
|
399
405
|
A Scenario may name points in the plan a Flow can wait for: a date, a number of months after another
|
|
400
406
|
point, a net-worth or spending figure, or a multiple of spending. They are the `milestones` of the
|
|
401
|
-
Scenario document, and `
|
|
402
|
-
or after a point's date, and its `endAt` before it. `
|
|
403
|
-
or that it was not reached, in a `milestones` table, and `
|
|
404
|
-
each side.
|
|
407
|
+
Scenario document, and `openretire schema scenario apply` lists every key. A Flow's `startAt` lands
|
|
408
|
+
it on or after a point's date, and its `endAt` before it. `openretire projection run` reports each
|
|
409
|
+
point's date, or that it was not reached, in a `milestones` table, and `openretire projection
|
|
410
|
+
compare` reports them under each side.
|
|
405
411
|
|
|
406
412
|
```json
|
|
407
413
|
"milestones": [
|
|
@@ -422,15 +428,15 @@ Every Flow, every Milestone and every person of a household may carry a `display
|
|
|
422
428
|
page reads in place of the id, such as Thai text. It is free text of 1 to 80 code points, with no
|
|
423
429
|
control, invisible or bidirectional characters and no leading or trailing whitespace. It is no key
|
|
424
430
|
and changes no figure: the id still addresses the item, the label may repeat or change, and the
|
|
425
|
-
engine never reads it. `
|
|
426
|
-
with that rule.
|
|
431
|
+
engine never reads it. `openretire schema scenario apply` and `openretire schema scenario household`
|
|
432
|
+
publish it with that rule.
|
|
427
433
|
|
|
428
434
|
A label travels in the document, so `--file` and `--add` carry it, and `--set` writes it:
|
|
429
435
|
|
|
430
436
|
```bash
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
437
|
+
openretire scenario apply base --set 'flows.school-fees.displayLabel="School fees"'
|
|
438
|
+
openretire scenario apply base --set 'milestones.condo.displayLabel="Condo down payment"'
|
|
439
|
+
openretire scenario household base --file household.json # a person's label, in the household
|
|
434
440
|
```
|
|
435
441
|
|
|
436
442
|
A plan written before the field may lack it, and the first `--set` that names it begins it, as
|
|
@@ -441,7 +447,7 @@ cannot remove a key, so `null` and `""` are refused.
|
|
|
441
447
|
|
|
442
448
|
## Where each year's money went
|
|
443
449
|
|
|
444
|
-
`
|
|
450
|
+
`openretire projection run --breakdown` adds each Annual roll-up's cash flow as the engine routed it: each
|
|
445
451
|
Flow's income, the tax taken at source and each Levy's settlement (a refund is negative), each expense
|
|
446
452
|
and its category, each Contribution applied and the part the cash could not fund, each planned
|
|
447
453
|
withdrawal, what `cashflow.withdraw` drew and what `cashflow.surplus` filled. In JSON it is the
|
|
@@ -504,15 +510,15 @@ row of zeros, because the Reporting year states every month it covers.
|
|
|
504
510
|
|
|
505
511
|
## Where the money goes, and moving it between Accounts
|
|
506
512
|
|
|
507
|
-
`cashflow` takes three more forms, every figure in them the caller's own (`
|
|
513
|
+
`cashflow` takes three more forms, every figure in them the caller's own (`openretire` ships none): a surplus step's `share`, which takes that
|
|
508
514
|
many basis points of what is still unrouted instead of everything (a percent string such as `"30.00"` under `--decimal`); a `withdraw` entry that is `{ account, downTo }`, which keeps a Reserve floor
|
|
509
515
|
in the Account while the others are drawn; and an `upTo` or `downTo` that is `{ amount, growth }`, which keeps its value in today's money. A
|
|
510
516
|
Flow of `kind: "transfer"` moves money between two of the plan's own Accounts, outside cashflow: a provident fund rolled into a locked RMF, or
|
|
511
|
-
a monthly amount from savings paying a loan down. `
|
|
517
|
+
a monthly amount from savings paying a loan down. `openretire schema scenario apply` describes each, and `--set` reaches a step or an entry by
|
|
512
518
|
its position, so "what if I kept 100,000.00 in savings before touching the funds" is
|
|
513
|
-
`
|
|
519
|
+
`openretire projection run --scenario plan --set cashflow.withdraw.0.downTo=10000000`.
|
|
514
520
|
|
|
515
|
-
`
|
|
521
|
+
`openretire projection run` states what each did: the annual row's `transfers`, a `routing` echo of every step and entry by position,
|
|
516
522
|
and with `--breakdown` the `entry` each drawn line came from and a `transfers` table (what moved and what could not); with
|
|
517
523
|
`--liabilities`, `transferred` on a loan's months. The amount a target that keeps its value is worth on a later date is the engine's
|
|
518
524
|
and is not stated yet. A plan without these forms prints exactly as before.
|
|
@@ -521,9 +527,9 @@ and is not stated yet. A plan without these forms prints exactly as before.
|
|
|
521
527
|
|
|
522
528
|
A loan is three parts of a Scenario document: a liability Account with a nominal `rate` and a `compounding`
|
|
523
529
|
period, a `withdrawal` Flow from that liability when the money arrives, and a Contribution into the
|
|
524
|
-
liability whose amount is a `level` payment. `
|
|
530
|
+
liability whose amount is a `level` payment. `openretire schema scenario apply` publishes one as its worked example.
|
|
525
531
|
|
|
526
|
-
`
|
|
532
|
+
`openretire projection run --liabilities` adds the engine's statement of each loan: one month row per liability
|
|
527
533
|
(`opening`, `drawn`, `paid`, `interest`, `closing`) and each loan's paid-off date. The rows shown are
|
|
528
534
|
one loan's months, cut from the table; it lists every liability the Scenario holds. In JSON they are the
|
|
529
535
|
`liabilities` and `paidOff` tables. The human format prints one line per loan, then its months:
|
|
@@ -543,7 +549,7 @@ equals `closing` exactly. Without `--liabilities` the output is unchanged.
|
|
|
543
549
|
### What a fee and a payout came to over the plan
|
|
544
550
|
|
|
545
551
|
An asset Account can pay out a share of its value as income (`payout`) and be charged a yearly `fee`.
|
|
546
|
-
`
|
|
552
|
+
`openretire projection run` states each one's total over the whole horizon, so nothing needs adding up: the
|
|
547
553
|
engine sums them in the same run as the roll-ups (it is the sum of the `payouts` and `fees` of every
|
|
548
554
|
roll-up). Two fields appear, and only when the Scenario declares the item above 0 bps (0 bps is none):
|
|
549
555
|
|
|
@@ -568,56 +574,56 @@ Without a fee or a payout the output is unchanged.
|
|
|
568
574
|
|
|
569
575
|
## Seeing it in a browser
|
|
570
576
|
|
|
571
|
-
`
|
|
577
|
+
`openretire dashboard --as-of 2026-11-30 --horizon 2056-11-30` reads your ledger once and serves the Dashboard (net worth, the ledger, projections, the FI date, a Scenario compare, tax and health) on `http://127.0.0.1:4321/` until you press Ctrl-C. It can change your plans (fork, apply or delete a Scenario, each through `openretire` after a dry run), it listens on this machine only and accepts a write only from its own page with a per-run token, and it takes the same Scenario flags as the projection reads (`--scenario`, `--compare` twice, `--monthly`, `--carry-in`); `--port 0` picks a free port. Run it again to see new figures.
|
|
572
578
|
|
|
573
579
|
## Keeping a backup, and removing the data
|
|
574
580
|
|
|
575
|
-
Four commands keep the ledger recoverable. `
|
|
581
|
+
Four commands keep the ledger recoverable. `openretire doctor` checks the data directory, the
|
|
576
582
|
database and every stored transaction and says what is wrong without changing anything;
|
|
577
583
|
`--as-of` adds the trial balance at a date. It exits 0 when its checks ran, with `"ok": false`
|
|
578
584
|
when one found a problem, because the finding is the answer; a non-zero exit is for what the
|
|
579
585
|
command could not do at all.
|
|
580
586
|
|
|
581
|
-
`
|
|
582
|
-
not exist yet, and `
|
|
587
|
+
`openretire backup --out backup` writes `traj.jsonl`, the canonical dump, into a directory that must
|
|
588
|
+
not exist yet, and `openretire restore backup` writes it into an empty data directory byte for byte.
|
|
583
589
|
A restore refuses a database that already holds data: to replace live data, remove it first,
|
|
584
590
|
or restore into a second `TRAJ_HOME`. CSV and Markdown exports are for people; only the JSONL
|
|
585
591
|
restores.
|
|
586
592
|
|
|
587
|
-
`
|
|
593
|
+
`openretire data remove` deletes `traj.db` and nothing else, so the launcher's `bin/` cache beside it
|
|
588
594
|
survives. It prints what would be lost, and it refuses unless `--confirm` names the data
|
|
589
595
|
directory's own path and `--backup` names a backup whose bytes are the data's, so a removal
|
|
590
596
|
cannot outrun the last write:
|
|
591
597
|
|
|
592
598
|
```bash
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
599
|
+
openretire doctor --as-of 2026-11-30
|
|
600
|
+
openretire backup --out ~/traj-backup-2026-11-30
|
|
601
|
+
openretire data remove --confirm ~/.traj --backup ~/traj-backup-2026-11-30
|
|
596
602
|
```
|
|
597
603
|
|
|
598
604
|
### Going back after an upgrade
|
|
599
605
|
|
|
600
|
-
When a newer `
|
|
606
|
+
When a newer `openretire` has to migrate your database to a newer schema, it first copies it beside the
|
|
601
607
|
original as `traj.db.pre-v<N>.bak`, where `N` is the schema version the copy holds, and says so once
|
|
602
608
|
on stderr. Each copy is about the size of the database, so the upgrade needs that much free space;
|
|
603
609
|
if the copy cannot be written (a full disk, a directory that is not writable) the database is not
|
|
604
610
|
migrated and nothing changes. A new, empty ledger is not copied.
|
|
605
611
|
|
|
606
|
-
An older `
|
|
612
|
+
An older `openretire` refuses a database a newer one has migrated, so to go back: stop every `openretire`,
|
|
607
613
|
install the release you used before (the
|
|
608
|
-
[releases page](https://github.com/trajectonomics/trajectonomics/releases) lists them; `
|
|
614
|
+
[releases page](https://github.com/trajectonomics/trajectonomics/releases) lists them; `openretire doctor`
|
|
609
615
|
on it reports the schema version it writes as `head`, which must equal `N`), delete `traj.db`,
|
|
610
616
|
`traj.db-wal` and `traj.db-shm` in the data directory, and copy the `.bak` file to `traj.db`.
|
|
611
617
|
Changes made after the upgrade are lost: the copy is the database as it was.
|
|
612
618
|
|
|
613
|
-
`
|
|
614
|
-
left as `database.unfinishedCopies`. `
|
|
619
|
+
`openretire doctor` lists the copies as `database.preMigrationCopies`, and any half-written one a crash
|
|
620
|
+
left as `database.unfinishedCopies`. `openretire data remove` leaves the copies, because they are separate
|
|
615
621
|
files you can delete when you no longer need them, and its refusal names them: they hold your
|
|
616
622
|
data in plain text.
|
|
617
623
|
|
|
618
624
|
## Telemetry
|
|
619
625
|
|
|
620
|
-
`
|
|
626
|
+
`openretire` counts its own use, so the project can see how many people run it each week. After a command finishes, a detached process sends one anonymous event to PostHog (EU), so the command never waits for the network. The event holds:
|
|
621
627
|
|
|
622
628
|
- `command`: the command name, such as `tx add`, or nothing when the command line named none
|
|
623
629
|
- `exit_code` and `error_code`: how the run ended, such as `invalid_input`
|
|
@@ -626,15 +632,15 @@ data in plain text.
|
|
|
626
632
|
|
|
627
633
|
It never holds your ledger, arguments, flag values, account names, amounts, file paths, the data directory or any environment variable. As with any web request, PostHog sees the IP address the request comes from.
|
|
628
634
|
|
|
629
|
-
The random id that groups one machine's events is in `telemetry.json`, in `$XDG_CONFIG_HOME/traj` (or `~/.config/traj`), or in `%APPDATA%\traj` on Windows. It lives outside the data directory, so `
|
|
635
|
+
The random id that groups one machine's events is in `telemetry.json`, in `$XDG_CONFIG_HOME/traj` (or `~/.config/traj`), or in `%APPDATA%\traj` on Windows. It lives outside the data directory, so `openretire data remove` does not delete it. `openretire telemetry off` deletes it. A machine where that file cannot be written sends nothing.
|
|
630
636
|
|
|
631
637
|
There are three ways to stop it:
|
|
632
638
|
|
|
633
|
-
- `
|
|
639
|
+
- `openretire telemetry off`, which stores the choice for this machine
|
|
634
640
|
- `DO_NOT_TRACK=1` in the environment of the command
|
|
635
641
|
- `TRAJ_TELEMETRY=0` (or `off` or `false`) in the environment of the command
|
|
636
642
|
|
|
637
|
-
CI runners (where `CI` is set) and development builds never send. The first successful command prints one line on stderr that says so, and it prints it once. `
|
|
643
|
+
CI runners (where `CI` is set) and development builds never send. The first successful command prints one line on stderr that says so, and it prints it once. `openretire telemetry status` shows whether counting is on and why, and `openretire telemetry on` turns it back on; a `DO_NOT_TRACK`, `TRAJ_TELEMETRY` or `CI` setting still stops it, and the status says which one.
|
|
638
644
|
|
|
639
645
|
## Docs
|
|
640
646
|
|
|
@@ -655,6 +661,6 @@ registry in `src/registry.ts` with its exit class; add it to `RETRYABLE_CODES` t
|
|
|
655
661
|
retrying the same command can succeed. An input-validation sentence
|
|
656
662
|
comes from the shared table beside it, so a new command needs no wording of its
|
|
657
663
|
own. Commands never format output or
|
|
658
|
-
exit; `
|
|
664
|
+
exit; `openretire help <path>` and `openretire schema <path>` are generated from the same
|
|
659
665
|
schemas that validate them. Test through `run(argv, io, env)`, which needs no
|
|
660
666
|
process. See ADR 0015.
|
package/bin/launcher.js
CHANGED
|
@@ -22,7 +22,7 @@ export function assetName(platform, arch) {
|
|
|
22
22
|
const asset = ASSETS[`${platform}-${arch}`]
|
|
23
23
|
if (asset === undefined) {
|
|
24
24
|
throw new Error(
|
|
25
|
-
`
|
|
25
|
+
`openretire has no build for ${platform}/${arch}. Supported: ${SUPPORTED.join(", ")}.`,
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
return asset
|
|
@@ -16,7 +16,7 @@ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.me
|
|
|
16
16
|
|
|
17
17
|
/** A launcher failure is one plain line on stderr and exit 1, never a JSON envelope. */
|
|
18
18
|
function fail(message) {
|
|
19
|
-
process.stderr.write(`
|
|
19
|
+
process.stderr.write(`openretire: ${message}\n`)
|
|
20
20
|
process.exitCode = 1
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -42,7 +42,9 @@ async function download(url) {
|
|
|
42
42
|
}
|
|
43
43
|
if (!said) {
|
|
44
44
|
said = true
|
|
45
|
-
process.stderr.write(
|
|
45
|
+
process.stderr.write(
|
|
46
|
+
`openretire: ${url} is not there yet; retrying for up to five minutes.\n`,
|
|
47
|
+
)
|
|
46
48
|
}
|
|
47
49
|
await sleep(wait)
|
|
48
50
|
}
|
|
@@ -60,7 +62,7 @@ async function main(args) {
|
|
|
60
62
|
const dest = join(home, "bin", `traj-${version}${exe}`)
|
|
61
63
|
if (!existsSync(dest)) {
|
|
62
64
|
const base = process.env["TRAJ_DOWNLOAD_BASE_URL"] || undefined
|
|
63
|
-
process.stderr.write(`
|
|
65
|
+
process.stderr.write(`openretire: downloading ${name} v${version} to ${dest} (about 100 MB).\n`)
|
|
64
66
|
const checksums = new TextDecoder().decode(
|
|
65
67
|
await download(releaseUrl(version, "checksums.txt", base)),
|
|
66
68
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trajectonomics/cli",
|
|
3
|
-
"version": "0.9.0-alpha.
|
|
3
|
+
"version": "0.9.0-alpha.80",
|
|
4
4
|
"description": "A free, open-source money command line that AI agents operate. Deterministic, local-first, Thai tax first.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"personal-finance",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"type": "module",
|
|
21
21
|
"packageManager": "bun@1.4.4",
|
|
22
22
|
"bin": {
|
|
23
|
-
"
|
|
23
|
+
"openretire": "./bin/openretire.js",
|
|
24
|
+
"traj": "./bin/openretire.js"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
27
|
"bin/"
|