Skip to content

v0.3.1

Latest

Choose a tag to compare

@github-actions github-actions released this 27 Aug 11:43
0203f32

Fixed

  • pitree did nothing when installed. The CLI guarded its entry point with an
    argv[1].endsWith("cli.js") check, but npm links the bin as a symlink at
    node_modules/.bin/pitree, so argv[1] ends with pitree and main() never ran — a silent
    exit 0 for every installed user since the package was first published. Now guarded with
    import.meta.main, which is symlink-proof. (The usual pathToFileURL(argv[1]) idiom would also
    have failed here: import.meta.url is the realpath, argv[1] is not.)
  • Context size was estimated far too low. The gauge and panel summed chars/4 over session
    entries, which cannot see the system prompt or the tool schemas — charged every turn, present in
    no entry. Measured against pi's own count across local sessions the estimate ran 0.01x-0.7x of
    reality (mean 0.24x), a floor of ~2k tokens even on a small toolset. Context size now anchors on
    the last assistant turn's real message.usage and estimates only what follows, as pi does
    (compaction.js:131); the same sessions now read 1.00x. This mattered more after 0.3.0 moved the
    bands to absolute tokens (8k/32k/64k), where a 2k undercount can hold the gauge a whole band low.
    Affected the standalone pitree ui (always estimating), the panel right after load or
    compaction, and the ambient gauge before the first turn.
  • The anchor refuses usage recorded before the latest compaction. Compaction keeps a tail of
    older messages, so a kept assistant turn carries usage describing the context compaction just
    discarded — anchoring on it read 150,100 tokens for a context of ~200, and it would have done so
    at exactly the moment the fallback path is used. Eligible turns are the compaction entry's
    descendants, matching pi's own refusal (agent-session.js getContextUsage returns
    tokens: null when nothing has answered since the boundary).

Changed

  • @pi-context-tree/core adds contextTokens(tree, leafId) for "how big is this context";
    estimateContextTokens(slice) keeps its pure chars/4 meaning and is now only used for entry and
    branch weights, where the per-session baseline must not be counted.