GitHub
The scenario file format

The scenario file format

A complete scenario file looks like this:

; Ledgeline projection
; projection: Series A with a hiring ramp
; created: 2026-09-18
; updated: 2026-09-20
; cash: assets:checking

account equity:unrealized gains  ; type: E

; Every rule ends with its COUNTER-ACCOUNT, written with no amount: where the
; money lands or comes from. hledger fills the amount in, so each rule is an
; ordinary balanced transaction.
~ monthly  projection
    revenues:salary      $-12000  ; growth: 3%/yr
    revenues:consulting   $-2500
    expenses:rent          $4200  ; growth: 2%/yr
    expenses:software       $900
    assets:checking

; A STEP: payroll jumps in April and grows from the new base. Two bounded rules
; for one account, linked by the `line:` tag so the list shows them as one step change.
~ monthly to 2027-04-01  projection
    expenses:payroll      $50000  ; line: payroll
    assets:checking

~ monthly from 2027-04-01  projection
    expenses:payroll     $120000  ; line: payroll, growth: 5%/yr
    assets:checking

; A ONE-OFF on the balance sheet: cash and equity, no net-income effect.
~ 2027-03-01  Series A
    assets:checking     $2000000
    equity:preferred

; A ONE-OFF on the P&L, accrued: no cash moves until it is paid.
~ 2027-06-15  legal fees
    expenses:legal        $45000
    liabilities:payable

; ASSET ROWS: a balance, a rate, and what you put into it. The amount is the
; CONTRIBUTION — `$0` when the balance just compounds — and `growth:` is what
; marks the row as a stock rather than a flow. Appreciation is booked to the
; row's gains account.
~ monthly  investing
    assets:house              $0  ; growth: 4%/yr, gains: equity:unrealized gains
    assets:savings         $2000  ; growth: 4%/yr
    assets:checking

; A TRANSFER balances on its own, so it needs no counter-account.
~ monthly  to savings
    assets:savings          $300
    assets:checking         $-300

Every line is standard hledger syntax. Ledgeline adds no format of its own.

Files written before counter-accounts existed use unbalanced virtual postings, (expenses:rent) $4200, with no counter-account. They still load and project the same numbers, and Ledgeline writes the counter-account it used the next time you save. What moves cash explains how it picks one.

The tag vocabulary

One header tag names the scenario, one names its default cash account, one marks the scenario the Projections tab opens by default, and the rest go on postings.

tagwheremeans
projection: <name>a comment at the top of the filethe scenario’s display name
cash: <account>a comment at the top of the filethe counter-account for a line your history says nothing about
default-scenario: truea comment at the top of the filethis is the scenario the Projections tab opens when Ledgeline starts
growth: <rate>/<unit>a posting commentthe amount grows by rate per completed unit; on an asset-typed account it ALSO marks the row as a balance
line: <id>a posting commenttwo bounded rules are two steps of ONE change; written only for a step change
opening: <number>an asset row’s posting commentoverride the journal’s balance for that account
gains: <account>an asset row’s posting commentwhere appreciation is booked; equity:unrealized gains when absent

The gains account is a real, declared account. If your main journal does not declare it, Ledgeline declares it in the scenario file (account equity:unrealized gains ; type: E), so hledger and Ledgeline classify it the same way and your main journal is not touched.

; projection: <name> is the display name and the only marker. A file without it still loads and takes its name from its filename. Any journal with budget-like entries can be used as a projection. ; created: and ; updated: are the dates Ledgeline stamps when it writes the file; you can delete them and nothing breaks.

; default-scenario: true marks your default scenario. The star next to the scenario picker writes it and removes it, and so does Settings → Projections. Ledgeline writes it as the last line of the header and changes nothing else in the file, not even updated:. Only true counts; any other value, or no line at all, means “not the default”. hledger ignores it, as it ignores the other header lines, because a comment at the top of a file is neither a tag nor data. At most one file should carry it. If several do, the first by file name is the one that opens, and the tab shows a warning until you star one of them. Ledgeline reads it only from projection-*.journal files.

growth: reads 3%/yr, 2.5%/mo, -1%/wk and 0.03/year. The percent sign is optional and Ledgeline accepts several spellings of the unit, because people type this tag into a journal by hand. A value it cannot read makes the line flat. It never makes the file fail to load.

opening: belongs to an asset row and nothing else. It carries a bare number in the row’s own commodity, because hledger ends a tag’s value at a comma, so $200,000 would read back as $200. Asset rows describes what the engine does with it.

line: links the two steps of a step change. A step is a permanent change to a recurring line: payroll jumps from $50k/mo to $120k/mo in April and stays there, growing from the new base. That is two bounded ~ rules for the same account. The shared line: tag tells the list they belong together, so each card shows step 1 of 2 or step 2 of 2 and links to the other. Without the tag they are still two valid rules, but the list does not link them.

Ledgeline writes line: only for a step change. A rule with one step needs no tag, so a save writes none, and drops the line: gap:… tags older versions put on every seeded line. A step gets a short id made from its account’s leaf (expenses:payroll becomes payroll, and a second one payroll-2), or keeps the id you wrote yourself. An id Ledgeline writes never contains a colon. Untagged lines get positional ids when the file loads, and a written id can never look like one of those, so reordering the rules can’t join two unrelated lines.

Amounts are signed as hledger writes them

A rule’s amounts are the file’s amounts, with their signs. Revenue is negative, as in any hledger journal: revenues:salary $-12000. An expense is positive. A minus moves money out of an account, so a transfer from checking to savings is $300 on savings and $-300 on checking. The list shows each amount with this sign, and the editor takes it the same way. Type -12000 for salary and 4200 for rent. Ledgeline never flips a sign for you, even when you change a posting’s account.

The = rule form is the one exception. Its percentages follow their own rule.

A rule that balances needs no counter-account

If a rule’s postings already sum to zero, there is nothing left over for a counter-account to take, so the rule has none:

~ monthly  to savings
    assets:savings      $300
    assets:checking    $-300

; Deferred revenue: a retainer billed in January is earned month by month.
~ monthly from 2027-01-01  retainer earned
    liabilities:deferred-revenue  $2000
    revenues:consulting          $-2000

The list draws no → line for these, and the editor’s Counter-account box says “None needed”. Ledgeline writes them as plain postings, and adds no counter-account unless you type one. If an edit makes the postings stop balancing, the rule needs a counter-account again, and the default comes back.

Descriptions and order

A rule’s description is the text after its period, separated by two spaces: ~ monthly unbudgeted — average over 2025-11-01 to 2026-10-22. The list shows it on the card’s first line, after the period, and the editor has a Description box for it. A description is one line and can’t contain ; or #, because hledger would read the rest of the line as a comment.

A seeded rule’s card: the period, the description “unbudgeted — average over 2025-08-01 to 2026-07-08” and an estimated badge, then the expenses:housing posting and its default counter-account

A description belongs to the whole rule, so a rule with several postings has one description. A seeded rule’s description says what the estimate was averaged over. If you change that rule’s amount, a small dot appears after the description, and hovering over it says the description may be out of date. Ledgeline never rewrites a description itself.

The list’s order is the file’s order. Dragging a card by its grip, Move up and Move down in its menu, and J / K move the whole entry in the file, with the comment above it. A rule’s postings are reordered inside the editor, with ↑ and ↓. The two steps of a step change move separately, because hledger doesn’t care which comes first. File text, such as an account directive, never moves. Other entries can move past it.

Moving an entry doesn’t rewrite it. A save writes an entry you didn’t edit with its own bytes, wherever it now sits.

Comments and section headings

Comments in a scenario file are entries in the list, in the place the file has them. Ledgeline reads a run of comment lines (lines starting with ;, # or *, with no blank line inside) as one of three things:

;;;;;;;;;;;;;;;;;;;;;;
;; Spending

; The lease renews in January at the new rate.
~ monthly to 2027-01-01  rent
    expenses:rent      $1875  ; line: rent
    assets:checking

; Assumes no new car before 2028.

~ 2027-04-15  tax bill
    expenses:taxes     $6000
    assets:checking

Here ;; Spending is a section heading, “The lease renews…” belongs to the rent rule, and “Assumes no new car…” is a note.

+ Add → Section heading writes a new heading as a line of 22 semicolons and then ;; Title, with no closing line. A heading already in the file keeps its own framing when you edit its title. A note is written ; before each line. Ledgeline puts a blank line after a heading or a note, so the next read doesn’t attach it to the entry below.

A comment … end comment block is a note too. Ledgeline shows it as written, and never reads anything inside it as a rule.

Comments inside a rule survive edits. A comment on a posting (expenses:rent $4200 ; owner: alex), a comment after the period on the ~ line, and indented comment lines between postings stay when you edit the rule. The editor has a comment box for each posting and a Header comment box for the ~ line. Ledgeline writes its own tags (growth:, opening:, gains:, line:) first, then your text after a comma, so hledger still reads your own tags as tags. One comment is lost. A comment on the counter-account line is dropped when the rule is rewritten.

Turning an entry off

Turn off (or t, or the editor’s Enabled switch) comments the entry out. Ledgeline puts ; in front of every line of the entry and leaves the comment above it as it is:

; With a big new customer: the "with" alternative.
; ~ monthly from 2027-01-01  consulting, with Acme
;     revenues:consulting   $-6000
;     assets:checking

hledger skips it, and so does Ledgeline. A turned-off entry changes no number on the page. The list still shows it, dimmed, struck through and badged off. Turn on removes the ; again and gives back the exact lines you had.

Ledgeline reads a commented-out block as a turned-off entry only when all of these hold:

Anything else stays a comment. ; ~ monthly is how often we pay has no posting, so it is a note. A rule inside comment … end comment is part of that note, too.

Duplicate as alternative

To compare a plan with and without something, keep both versions in the file and turn one off. Say you want to see the runway with a big new customer and without one:

  1. Open the menu on the consulting rule and choose Duplicate as alternative (or press C).
  2. The editor opens on a copy, placed directly below the original. Change the amount to the bigger figure (-6000: income is negative), and put “with Acme” in the description.
  3. Press Done. The copy is added and the original is turned off, in one change, so the readings now show the “with” version.

To switch back, turn the copy off and the original on. Each is one press of t. Cancel in step 2 leaves no copy, and the original stays on.

Duplicate (c) does the same without turning anything off. Use it to start a new rule from an existing one, for example to give one posting a different counter-account. Copies never share a line: id with the original, so a copy is never mistaken for a step.

Growth is stepwise, not smoothly compounded

A line marked +3%/yr holds flat for twelve months and then rises 3%. Rent increases and salary reviews work the same way. Each stepped figure is a real amount you could have typed, so Ledgeline rounds it back to the amount’s own display precision at every step. This is why a $1,875.00 line is written with its cents even when the figure is round.

Growth anniversaries are counted from the line’s from date when it has one, and from the start of the projection otherwise. This is why the second segment of a step change grows from its new base.

When a rule fires

On the days hledger --forecast fires it, from the first projected day:

hledger balance --budget places a bare ~ weekly goal on Mondays instead. The Budget tab follows that report, and the Projections tab follows --forecast.

Amounts follow your main journal’s commodity styles

A projection file reads its amounts under the main journal’s commodity directives, as though it were included. With commodity $1,000.00 in the main journal, a hand-typed $11,344 in a projection file is eleven thousand dollars. A commodity or decimal-mark directive in the projection file itself takes precedence.

hledger does not lend a commodity directive across sibling files, so hledger -f main.journal -f projection.journal would read that same $11,344 as $11.344. When you save, Ledgeline therefore adds the main journal’s directive to the projection file (commodity $1,000.00) for each commodity the file uses but doesn’t declare. After that, hledger reads the file the same way however it’s opened.

Automatic postings (= rules)

A projection file can hold hledger’s auto-posting rules, so a cost can follow a revenue or a wage line as a percentage:

= revenue:sales tag:_generated-transaction
    expenses:people-costs:sales-commission  *-0.03
    assets:mercury:checking

= expenses:people-costs:wages-salaries tag:_generated-transaction
    expenses:people-costs:payroll-tax  *0.1
    assets:mercury:checking

Wherever a rule’s query matches a posting of a projected transaction, its postings are added right below that posting. *0.1 is 10% of the matched amount, and the posting with no amount balances the others. Ledgeline applies a projection file’s rules to every projected transaction, always, whatever your hledger.conf says about --auto. It never applies them to recorded transactions.

Editing rules on the Projections page

The editor for an automatic posting is a form: when a posting to this account (or one of its subaccounts) is projected, add these postings. Each posting is a percentage of the matched amount or a fixed amount, and a counter-account (the scenario’s cash account by default) takes the balance. A line under the rule shows what it comes to on an amount the scenario already posts there, such as “≈ $1,200.00 to expenses:people-costs:sales-commission on each $40,000.00 to revenue:sales”.

In this form, type positive figures. This is unlike a ~ rule, whose amounts you type with the file’s signs. A percentage here means “this account grows by this share of the matched amount”, and Ledgeline works out the sign from the two accounts’ types. Asset and expense accounts grow with a positive amount; liability, equity and revenue accounts grow with a negative one. So 3% commission on a sale (revenue into an expense) is written *-0.03, 10% payroll tax on wages (an expense into an expense) is *0.1, and 10% of wages owed as a tax liability (an expense into a liability) is *-0.1. A fixed amount takes its own account’s sign: $50 into an expense, $-50 into a liability.

An account’s type comes from an account directive, in the main journal or in the scenario file itself (account hmrc:paye ; type: L; where both declare one, the scenario file’s wins). An undeclared account is typed from its name (liabilities:…, expenses:…). If the name gives no type either, as with hmrc:paye, the account is treated as growing with a positive amount. In that case the percentage is written exactly as you type it, so declare the account’s type if it is really a liability.

A rule edited here is saved in this form:

= ^revenue:sales(:|$) tag:_generated-transaction  ; sales commission
    expenses:people-costs:sales-commission  *-0.03
    assets:mercury:checking                 *0.03

Generated postings are marked auto in the Journal tab. Save As copies every rule to the new file.

To check a projection with hledger, add --auto to the commands below.

What hledger does, and does not, do with this

hledger reads these files. Both of these work:

$ hledger -f projection-series-a.journal balance --budget -M
$ hledger -f projection-series-a.journal print --forecast=2026-10-01..2029-10-01

What hledger will not do is apply growth:, and it never sees the future prices Ledgeline uses to grow a stock holding (see Asset rows). hledger shows both flat. hledger has no arithmetic in amounts, so a journal file cannot state a growing amount: $1200 * 1.03 is a parse error. growth: is a comment to hledger, and a balance --budget report over a projection file shows the base amount in every period, in year five exactly as in year one. Only Ledgeline expands it.

This is a deliberate trade-off. The alternative was to write the file out expanded, one bounded rule per growth step. Plain hledger would read that correctly, but nobody could edit it by hand. Ledgeline keeps the compact form and accepts that hledger shows growth flat. The tag is already in the file, so an expanded export is possible later without a format change.

Never round-trip a scenario through hledger print. It drops ~ rules entirely, so the file would come back with every scenario line gone and no sign that anything had changed. Ledgeline writes these files itself.

Reading a projection file by hand

You can get everything the tab shows from hledger, except growth.

# The goals, as written, month by month.
$ hledger -f projection-series-a.journal balance --budget -M -b 2027-01-01 -e 2027-04-01

# The same rules read as future transactions.
$ hledger -f projection-series-a.journal register --forecast=2027-01-01..2028-01-01

# Both files at once — what you plan, beside what you did.
$ hledger -f main.journal -f projection-series-a.journal balance --budget -M

# Every asset row in a file, by the tag that marks one.
$ hledger -f projection-series-a.journal print --forecast=2027-01-01..2027-02-01 tag:growth

# The balance sheet the tab projects, from a cutoff of 2026-10-01: actuals before
# it, forecast from it, and no real transaction after it counted twice.
$ hledger -f main.journal -f projection-series-a.journal bs \
    --forecast=2026-10-01..2027-10-01 -M -b 2026-08-01 -e 2027-10-01 \
    expr:"NOT (date:2026-10-01.. AND NOT tag:generated)"

# The same window as an income statement, other commodities valued as the tab
# values them.
$ hledger -f main.journal -f projection-series-a.journal is \
    --forecast=2026-10-01..2027-10-01 -M -b 2026-08-01 -e 2027-10-01 \
    expr:"NOT (date:2026-10-01.. AND NOT tag:generated)" --value=end,$

These agree with the tab account by account and period by period, except where growth: applies. What moves cash explains each part of the command.