feat(context): pluggable fold policy (choose what to fold and how)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 18/100
Research direction
This is design work, not a starter task. Read the fold logic in ContextAssembler (AD-14 age-based folding, AD-15 head and tail elision) and the tombstone rendering it uses, plus how Harness and providers.yaml are wired. The first step is settling the open questions: which surface comes first, and whether the budget always wins. Done means a written design that keeps the default policy unchanged and passes the golden traces.
Written by the indexing model from the issue text.
Description
Problem
Folding (AD-14, Rule 5) decides when and how much to fold: it is driven by age (K, auto 2 to 8, or a fixed --fold-after N) and by size (the --context-tokens budget, AD-15 head + tail elision). A user cannot decide what to fold or how:
- which observations to keep live longer or fold sooner, by command (
pytestoutput vsweb fetchpages vs--help); - what a folded observation turns into (today always the one-line tombstone
[obs_N folded: ... | use mem recall obs_N to expand]).
Today the only levers are the window size, the fold age and mem pin for facts. A skill or SDK user who knows their task (a research skill that reads many pages, a coding skill that lives on test output) cannot tune folding for it without patching ContextAssembler.
Proposal
A pluggable fold policy, opt-in, with the current behaviour (AD-14) as the default and unchanged:
- Declarative rules (skill frontmatter,
providers.yaml,Harness(...)), e.g. per command prefix:keep_live(never fold the latest one),fold_after: N,fold_first(fold before others when over the target). - SDK hook:
Harness(fold_policy=...), a small protocol that ranks fold candidates and/or renders the tombstone text, registered likeregister_provider/register_normalizer.
Constraints (Philosophy Gate, Golden Rules):
- Deterministic by default: no model call in the default path (a model-written summary, if ever added, is a separate opt-in that has to show a bench gain).
- 0 static prompt tokens; the prefix and
toolsarray never change (Rule 1). Tombstone text stays bounded, with a unit test (AD-18). - Nothing is lost: everything stays in SQLite and
mem recall/mem searchkeep working (AD-9). - No new dependency (Rule 7). Golden traces unchanged for the default policy.
How it moves the north star
Not directly: the default stays as is, so qwen3.5:9b Polyglot-Python must be flat. It makes folding experiments (for example keeping the last test run live, or folding web fetch pages first) possible without forking the core, each measured on its own against the north star before it can become a default.
Open questions
- Which surface first: declarative rules only, or the SDK hook too?
- Should a policy be allowed to fold less than AD-14 when that would blow the window, or is the window budget always the last word? (Proposed: the budget always wins.)
Raised from a question at the Pylestras Fortaleza (PUG-CE) talk prep: "can I choose what to compact, like Claude Code's /compact <instructions>?"
north star: n/a (opt-in, default unchanged) -> must stay flat
Generated by Claude Code
- Dominant language
- Python
- Stars
- 3
- Forks
- 1
- Avg merge
- 1h 10m
- Merged PRs (30d)
- 175
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from igormcsouza/tether
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
igormcsouza/tether#428 ·
Maintainers usually reply within 1 day
-
landlock: jailed exec of bash refused on GitHub ubuntu-26.04 runner with Python 3.12 (3.13 passes)Openknown-issue
Difficulty 4/5 1-2 days Newbie friendliness 48/100
igormcsouza/tether#424 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
igormcsouza/tether#412 · 1 comment ·
Maintainers usually reply within 1 day
-
feat(api): tether serve, an optional local HTTP + SSE API for external UIs (no UI in this repo)Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
igormcsouza/tether#387 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
igormcsouza/tether#386 ·
Maintainers usually reply within 1 day
All issues in igormcsouza/tether
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
hugohe3/ppt-master#366 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 89/100
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
521xueweihan/HelloGitHub#4716 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
pcqpcq/open-source-android-apps#619 ·
Maintainers usually reply within 1 day
-
contribution Windows 主机
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Lee-xeo/Claude-Cage#1519 ·
Maintainers usually reply within 1 day