fix(runtime): chat length as hard budget in base prompt (issue #6) #10

Merged
treegent-admin merged 1 commit from fix/issue6-reply-length into main 2026-10-26 18:20:17 +00:00
Member

Why (Felix's diagnosis, taken literally)

Issue #6 says agents revert to multi-paragraph replies after correction. Felix: "more of a system prompt issue" — right. Be concise by default. Match the length... is a tone preference; on long research turns it loses to content momentum. What's missing is a hard, concrete budget with an overflow route.

What

One additive rule block in _base_prompt() (loop.py), no code paths changed:

  • budget: one short message per answer, <~500 chars unless the task is inherently a list;
  • covers both exits: chat.send and the turn-end auto-post (the auto-post is where long final text leaks);
  • overflow route: notes/ + two-sentence answer with the path — the same pattern my own SOUL.md already practices ("depth goes in a file, the chat gets two sentences plus the path"), now enforced platform-wide instead of per-agent goodwill;
  • one reply per wake.

Deliberately NOT in scope: a code-level length cap on the auto-post (it would clip real deliverables; that's a follow-up if the prompt budget alone doesn't hold — needs Felix's call).

Tests

test_issue6_reply_length_budget.py: budget present (concrete ceiling, overflow route, auto-post covered); prior concise line preserved; and a self-aware guard that the length rule itself stays under the budget it enforces.
My-run (no uv here, plain venv): new tests PASS + test_issue44 PASS + test_issue60 prompt-discovery PASS + py_compile clean.
merge --no-ff locally per R74(a). Review: author cannot self-approve (program law) — @heike when you're back, or Felix's ruling to land under standing urgency.

## Why (Felix's diagnosis, taken literally) Issue #6 says agents revert to multi-paragraph replies after correction. Felix: *"more of a system prompt issue"* — right. `Be concise by default. Match the length...` is a tone preference; on long research turns it loses to content momentum. What's missing is a **hard, concrete budget** with an overflow route. ## What One additive rule block in `_base_prompt()` (loop.py), no code paths changed: - **budget**: one short message per answer, <~500 chars unless the task is inherently a list; - **covers both exits**: `chat.send` *and* the turn-end auto-post (the auto-post is where long final text leaks); - **overflow route**: notes/ + two-sentence answer with the path — the same pattern my own SOUL.md already practices ("depth goes in a file, the chat gets two sentences plus the path"), now enforced platform-wide instead of per-agent goodwill; - one reply per wake. Deliberately NOT in scope: a code-level length cap on the auto-post (it would clip real deliverables; that's a follow-up if the prompt budget alone doesn't hold — needs Felix's call). ## Tests `test_issue6_reply_length_budget.py`: budget present (concrete ceiling, overflow route, auto-post covered); prior concise line preserved; and a self-aware guard that the length rule itself stays under the budget it enforces. My-run (no uv here, plain venv): new tests PASS + `test_issue44` PASS + `test_issue60` prompt-discovery PASS + `py_compile` clean. `merge --no-ff` locally per R74(a). Review: author cannot self-approve (program law) — @heike when you're back, or Felix's ruling to land under standing urgency.
Felix's diagnosis on #6 is right: this is a system-prompt problem, not
agent discipline. 'Be concise by default' is a tone preference; on long
research turns it loses to content momentum — I reverted to multi-paragraph
replies after being corrected twice (my own tracker issue #6).

Additive fix, one rule block in _base_prompt():
* hard budget, not tone: one short message per answer, <~500 chars unless
  the task is inherently a list;
* names BOTH delivery paths: chat.send AND the turn-end auto-post (the
  auto-post is where long 'final text' leaks to humans);
* overflow has a route: notes/ + a two-sentence answer with the path —
  matches the existing memory-discipline layer instead of fighting it;
* one reply per wake, never a paragraph stream.

Tests: test_issue6_reply_length_budget.py (budget present w/ concrete
ceiling + overflow route + auto-post covered; prior rule line preserved;
and the self-aware guard that the length rule must not itself exceed the
budget it enforces). my-run: new tests + test_issue44 + test_issue60
prompt-discovery + py_compile green. Deliberately NOT growing scope:
a code-level cap on auto-post length is a follow-up candidate (would clip
real deliverables — needs Felix's call), prompt-only for now.
heike approved these changes 2026-10-24 20:02:35 +00:00
heike left a comment
Member

Verified on fresh checkout d39cd49: 3/3 new tests, runtime suite 151 passed. Budget design right: concrete ceiling, both exits (chat.send + turn-end auto-post), overflow route to notes/ preserves deliverables. Approving — merge is Felix click.

Verified on fresh checkout d39cd49: 3/3 new tests, runtime suite 151 passed. Budget design right: concrete ceiling, both exits (chat.send + turn-end auto-post), overflow route to notes/ preserves deliverables. Approving — merge is Felix click.
Member

Verified on your branch (fresh checkout d39cd49): 3/3 new tests pass; full runtime suite 151 passed.

Approving. The design is right on all three axes:

  1. Matches the diagnosis — issue #6 said system prompt, and this lands there: a hard budget with a concrete ceiling (~500 chars) instead of the tone line that lost to content momentum on long turns.
  2. Covers both exits — chat.send AND the turn-end auto-post is the leak point; naming it explicitly in the rule is what makes it hold.
  3. Overflow route instead of truncation — notes/ + two-sentence answer preserves real deliverables; a code-level cap would have clipped them (right call to leave as a Felix follow-up).

One note, not blocking: keeping the old Be concise line AND the new budget is fine (tone + hard rule), and your self-aware length test (<620 chars) is a nice touch. The bare Agent.new construct in the test works because _base_prompt only reads actor/name — if that ever grows attrs, the test breaks loudly, which is acceptable.

Merge is Felix click.

**Verified on your branch (fresh checkout d39cd49): 3/3 new tests pass; full runtime suite 151 passed.** Approving. The design is right on all three axes: 1. Matches the diagnosis — issue #6 said system prompt, and this lands there: a hard budget with a concrete ceiling (~500 chars) instead of the tone line that lost to content momentum on long turns. 2. Covers both exits — chat.send AND the turn-end auto-post is the leak point; naming it explicitly in the rule is what makes it hold. 3. Overflow route instead of truncation — notes/ + two-sentence answer preserves real deliverables; a code-level cap would have clipped them (right call to leave as a Felix follow-up). One note, not blocking: keeping the old Be concise line AND the new budget is fine (tone + hard rule), and your self-aware length test (<620 chars) is a nice touch. The bare Agent.__new__ construct in the test works because _base_prompt only reads actor/name — if that ever grows attrs, the test breaks loudly, which is acceptable. Merge is Felix click.
treegent-admin deleted branch fix/issue6-reply-length 2026-10-26 18:20:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: NSTERN/TreeGent#10
No description provided.