@sekobus/tacet 0.0.0-stage → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sergey Kobzev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,70 @@
1
- # Temporary Holding Version
1
+ # Tacet for [Pi](https://pi.dev)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **English** · [Русский](README.ru.md)
4
+
5
+ Tacet gives a long Pi conversation room to continue. Once the model has answered,
6
+ an old test report or file listing can give way to a short marking in later requests.
7
+ Tacet keeps your words, the model’s replies and the arguments of every tool call
8
+ verbatim. [How folding works](docs/GUIDE.en.md#everyday-use)
9
+
10
+ In an orchestral part, *tacet* tells a musician to sit out a passage. Think of the
11
+ saved session as the full score and the model’s next request as the part on the
12
+ stand. The old report is still in the score. In the part, one line can stand for
13
+ it until someone needs it again. [The musical term](https://www.merriam-webster.com/dictionary/tacet)
14
+
15
+ ```text
16
+ [tacet: 20165 chars folded; unfold("a1b2c3d4") returns them]
17
+ ```
18
+
19
+ For a `bash` or `powershell` result, Tacet also shows an excerpt from the end of the output.
20
+ An old test report takes up space in every request while it stays in context, even
21
+ if you only need one error line later. Suppose the tests now pass and you ask
22
+ what failed **before** the fix. The model can call `unfold` with the ID above
23
+ to read the original report, or add
24
+ `"match": "payments"` to look for that word with the surrounding lines. Running the
25
+ tests again would only tell you what happens now. Folding and retrieval run locally
26
+ without an extra model call. [Retrieval examples](docs/GUIDE.en.md#retrieve-a-report-or-find-a-line)
27
+
28
+ For a side-by-side look at Pi’s `/compact` and other extensions, see
29
+ [How Tacet compares](docs/COMPARISON.en.md).
30
+
31
+ ## Try it
32
+
33
+ With Pi installed, try Tacet for one session from your work directory.
34
+
35
+ ```sh
36
+ pi -e npm:@sekobus/tacet
37
+ ```
38
+
39
+ For future sessions, install Tacet once.
40
+
41
+ ```sh
42
+ pi install npm:@sekobus/tacet
43
+ ```
44
+
45
+ Type `/tacet` in Pi to see when the next fold would happen. In a fresh session,
46
+ recent results stay in full. As a session grows, the amount of old output and the
47
+ active profile determine when Tacet folds it.
48
+
49
+ You can also [install Tacet from GitHub](docs/GUIDE.en.md#installation).
50
+
51
+ ![Pi suggests /tacet to view the folding forecast, change the profile or pause folding on this branch.](docs/images/command.en.png)
52
+
53
+ The footer shows 93 earlier folds on this branch. At the moment shown,
54
+ another fold would free 12.57% of the context. The active profile requires 50%,
55
+ so Tacet waits. [How to read the forecast](docs/GUIDE.en.md#fold-earlier-or-later)
56
+
57
+ ![A file read above the Tacet menu in a working Pi session. The Russian forecast shows folding is on and the next fold is below threshold.](docs/images/session.ru.png)
58
+
59
+ We tested the Tacet 0.2.0 Git package on Linux with Pi 1.7.0.
60
+ The effect on cost and latency depends on the workload
61
+ and the provider’s cache. [Installation checks](docs/GUIDE.en.md#installation-checks) · [Cost and caching](docs/GUIDE.en.md#common-questions)
62
+
63
+ To install Tacet and recover your first folded result, see the [Quick start](docs/QUICKSTART.en.md).
64
+ To keep reads of specific project files in full, use [`.tacetprotect`](docs/GUIDE.en.md#protect-project-files). For profiles, configuration and troubleshooting, see the [User guide](docs/GUIDE.en.md).
65
+
66
+ ## Feedback and license
67
+
68
+ Reports from macOS and Windows users are especially welcome. Please include your Pi version,
69
+ operating system and a short example when reporting a problem. [GitHub Issues](https://github.com/sekobus/tacet/issues)
70
+ Tacet is available under the [MIT License](LICENSE).
package/README.ru.md ADDED
@@ -0,0 +1,70 @@
1
+ # Tacet для [Pi](https://pi.dev)
2
+
3
+ [English](README.md) · **Русский**
4
+
5
+ Tacet освобождает место для разговора в длинной сессии Pi. Когда модель уже дала
6
+ ответ, в следующих запросах старый отчёт тестов или список файлов может уступить
7
+ место короткой пометке. Ваши слова, ответы модели и аргументы каждого вызова
8
+ инструмента Tacet сохраняет дословно. [Как работает свёртка](docs/GUIDE.md#обычная-работа)
9
+
10
+ В оркестровой партии *tacet* означает, что на этом отрезке музыкант молчит.
11
+ Представьте, что сохранённая сессия — полная партитура, а очередной запрос модели —
12
+ партия на пюпитре. В партитуре по-прежнему есть весь отчёт. В партии достаточно
13
+ одной строки, пока кому-то снова не понадобятся подробности. [Значение термина](https://www.merriam-webster.com/dictionary/tacet)
14
+
15
+ ```text
16
+ [tacet: 20165 chars folded; unfold("a1b2c3d4") returns them]
17
+ ```
18
+
19
+ Для результата `bash` или `powershell` Tacet также показывает фрагмент из конца вывода.
20
+ Пока старый отчёт тестов остаётся в контексте, он занимает место в каждом запросе,
21
+ даже если позже понадобится всего одна строка ошибки. Допустим, теперь тесты
22
+ проходят, а вы хотите узнать, что падало **до** исправления.
23
+ Модель может передать этот идентификатор в `unfold` и прочитать исходный отчёт.
24
+ Если добавить `"match": "payments"`, можно найти это слово и увидеть соседние строки.
25
+ Повторный запуск тестов показал бы лишь то, что происходит сейчас. Свёртка и возврат
26
+ выполняются локально, без дополнительного вызова модели. [Примеры возврата](docs/GUIDE.md#вернуть-отчёт-целиком-или-найти-в-нём-строку)
27
+
28
+ Чем Tacet отличается от штатного `/compact` в Pi и других расширений, показано
29
+ в [сравнении подходов](docs/COMPARISON.ru.md).
30
+
31
+ ## Попробовать
32
+
33
+ Если Pi уже установлен, попробуйте Tacet в одной сессии из каталога вашей задачи.
34
+
35
+ ```sh
36
+ pi -e npm:@sekobus/tacet
37
+ ```
38
+
39
+ Для следующих сессий установите Tacet один раз.
40
+
41
+ ```sh
42
+ pi install npm:@sekobus/tacet
43
+ ```
44
+
45
+ Введите `/tacet` в Pi, чтобы увидеть, когда возможна следующая свёртка.
46
+ В новой сессии свежий вывод сохраняется целиком. По мере работы момент свёртки
47
+ зависит от объёма старого вывода и выбранного профиля.
48
+
49
+ Можно также [установить Tacet с GitHub](docs/GUIDE.md#установка).
50
+
51
+ ![Подсказка Pi на английском для команды /tacet. Команда открывает прогноз, выбор профиля и управление свёрткой на ветке.](docs/images/command.en.png)
52
+
53
+ В нижней строке видно, что на этой ветке уже произошло 93 свёртки. В момент
54
+ снимка новая свёртка освободила бы 12,57% контекста. Действующий профиль требует 50%,
55
+ поэтому Tacet ждёт. [Как читать прогноз](docs/GUIDE.md#свернуть-раньше-или-позже)
56
+
57
+ ![В рабочей сессии Pi под вызовом чтения файла открыто меню Tacet. Автоматика включена, ожидаемый выигрыш следующей свёртки ниже порога.](docs/images/session.ru.png)
58
+
59
+ Мы проверили Git-пакет Tacet 0.2.0 в Linux на Pi 1.7.0.
60
+ Влияние на стоимость и время ответа зависит от задачи
61
+ и от того, как провайдер использует кеш. [Проверка установки](docs/GUIDE.md#проверка-установки) · [Стоимость и кеш](docs/GUIDE.md#частые-вопросы)
62
+
63
+ Как установить Tacet и вернуть первый свёрнутый результат, показано в разделе [Быстрый старт](docs/QUICKSTART.ru.md).
64
+ Чтобы сохранять чтения выбранных файлов проекта целиком, используйте [`.tacetprotect`](docs/GUIDE.md#защитить-файлы-проекта). Профили, настройки и разбор частых вопросов собраны в [Руководстве пользователя](docs/GUIDE.md).
65
+
66
+ ## Обратная связь и лицензия
67
+
68
+ Особенно полезны отзывы о работе в macOS и Windows. В сообщении о проблеме
69
+ укажите версию Pi, операционную систему и короткий пример. [GitHub Issues](https://github.com/sekobus/tacet/issues)
70
+ Tacet распространяется по [лицензии MIT](LICENSE).
@@ -0,0 +1,26 @@
1
+ # How Tacet compares
2
+
3
+ **English** · [Русский](COMPARISON.ru.md) · [Tacet for Pi](../README.md)
4
+
5
+ Suppose a test failed this morning and now passes. You remember the model’s explanation,
6
+ but need the exact assertion from the first run. Two questions matter here. What will
7
+ the model see in its next request? Where can it get the original line?
8
+
9
+ ## The same test report in Pi
10
+
11
+ | Approach | What the model sees later | Where the earlier output lives |
12
+ | --- | --- | --- |
13
+ | **Tacet** | A short marking with an ID can replace an old tool result after the model has answered. Tacet leaves the conversation and tool-call arguments verbatim. | `unfold` copies the original from the current Pi branch into a new tool result. Give it `match` to look for a literal string in that report. The old marking stays in place. [Retrieval examples](GUIDE.en.md#retrieve-a-report-or-find-a-line) · [Source](../tacet.ts) |
14
+ | **Pi’s built-in compaction** | At the compaction threshold or on `/compact`, a model summarizes the older conversation. The next request includes the summary and recent messages. | Earlier entries remain in the saved session. If the assertion fell before the cut, the summary determines how much of it the model sees. [Pi’s compaction walkthrough](https://github.com/earendil-works/pi/blob/356d346e48a8c88f59e92981b20ffe30245cc39f/packages/coding-agent/docs/compaction.md#how-it-works) |
15
+ | **pi-context-prune** | A model summarizes completed batches of tool results. A summary can stand in for the raw output in subsequent requests. | The extension keeps its index in the Pi session. The agent can use `context_tree_query` to retrieve an original result. [Project documentation](https://github.com/championswimmer/pi-context-prune/blob/3a9b6c81ec2d41afb1f95448450ede3315cae451/README.md#why-use-it) |
16
+ | **pi-fold** | A short brief can stand in for a whole span of messages. | Originals are stored on disk. `peek` gives the agent a plain-text view for one turn. `expand` restores the original messages in place until they are folded again. [Project documentation](https://github.com/shaneconner/fold/blob/98b0c7f083d873804a958e2dfbdda161b998a73d/README.md#how-it-works) |
17
+ | **Accordion** | Folded blocks appear as short digests. A visual map lets you inspect and fold individual blocks. | `recall` returns a block as a tool result while leaving it folded. `unfold` restores the block to the model’s view. [Project documentation](https://github.com/a-Fig/Accordion/blob/7e2c8cd10999f9d9079b6c1f2fcddfa790e51680/README.md) |
18
+ | **pi-dcp (PSU3D0)** | Rules filter the outgoing request. For example, one rule removes older payloads from repeated calls with identical arguments. | The session file keeps the history. For a large output replaced because of its age, the placeholder suggests rerunning the tool. In this example, that would produce the passing report. [Project documentation](https://github.com/PSU3D0/pi-dcp/blob/8d15a3331c51f3551ccd20583ac0f5ba499a13c3/README.md#features--strategies) |
19
+
20
+ ## When would Tacet fold that report?
21
+
22
+ The model first sees the output that Pi received from the tool. Tacet protects recent
23
+ results. At the end of a completed turn, it considers older results from a configured
24
+ list of tools. The standard profile uses the model’s declared cache and input prices
25
+ to set a threshold for how much space a batch must free. Folding takes no extra
26
+ model call. Pi can still run its own compaction. [Threshold worked example](GUIDE.en.md#nearly-full-window-with-no-folds) · [Selection and pricing rules](../tacet.ts)
@@ -0,0 +1,27 @@
1
+ # Чем Tacet отличается от других подходов
2
+
3
+ [English](COMPARISON.en.md) · **Русский** · [Tacet для Pi](../README.ru.md)
4
+
5
+ Допустим, утром тест падал, а теперь проходит. Вы помните объяснение модели,
6
+ но нужна точная строка с упавшей проверкой из первого прогона. Здесь важны два
7
+ вопроса. Что увидит модель в следующем запросе? Откуда она сможет взять исходную строку?
8
+
9
+ ## Один и тот же отчёт тестов в Pi
10
+
11
+ | Подход | Что увидит модель потом | Где остался прежний вывод |
12
+ | --- | --- | --- |
13
+ | **Tacet** | После ответа модели старый результат инструмента может свернуться в короткую пометку с идентификатором. Реплики и аргументы вызовов Tacet сохраняет дословно. | `unfold` берёт оригинал из текущей ветки Pi и возвращает копию как новый результат инструмента. Параметр `match` позволяет найти подстроку в том отчёте. Прежняя пометка остаётся на месте. [Примеры возврата](GUIDE.md#вернуть-отчёт-целиком-или-найти-в-нём-строку) · [Исходный код](../tacet.ts) |
14
+ | **Штатное сжатие Pi** | При достижении порога или по команде `/compact` модель составляет сводку ранней части разговора. В следующий запрос попадают сводка и недавние сообщения. | Прежние записи остаются в сохранённой сессии. Если строка с ошибкой попала в свёрнутую часть, модель увидит столько подробностей, сколько вошло в сводку. [Как Pi выполняет сжатие](https://github.com/earendil-works/pi/blob/356d346e48a8c88f59e92981b20ffe30245cc39f/packages/coding-agent/docs/compaction.md#how-it-works) |
15
+ | **pi-context-prune** | Модель составляет сводки по завершённым группам вызовов инструментов. В последующих запросах сводка может заменить исходный вывод. | Расширение хранит индекс в самой сессии Pi. Агент может получить исходный результат через `context_tree_query`. [Документация проекта](https://github.com/championswimmer/pi-context-prune/blob/3a9b6c81ec2d41afb1f95448450ede3315cae451/README.md#why-use-it) |
16
+ | **pi-fold** | Вместо целого фрагмента переписки модель может увидеть краткую запись о нём. | Оригиналы хранятся на диске. `peek` показывает текст на один ход. `expand` возвращает исходные сообщения на прежнее место до следующей свёртки. [Документация проекта](https://github.com/shaneconner/fold/blob/98b0c7f083d873804a958e2dfbdda161b998a73d/README.md#how-it-works) |
17
+ | **Accordion** | На месте свёрнутых блоков видны краткие описания. На визуальной карте можно изучать и сворачивать отдельные блоки. | `recall` возвращает блок как результат инструмента и оставляет его свёрнутым. `unfold` снова раскрывает блок в контексте модели. [Документация проекта](https://github.com/a-Fig/Accordion/blob/7e2c8cd10999f9d9079b6c1f2fcddfa790e51680/README.md) |
18
+ | **pi-dcp (PSU3D0)** | Правила фильтруют исходящий запрос. Например, при повторных вызовах с одинаковыми аргументами одно из правил убирает прежние результаты. | История остаётся в файле сессии. Если давний объёмный вывод заменён пометкой, она предлагает повторить вызов. В нашем примере это дало бы отчёт об успешном прогоне. [Документация проекта](https://github.com/PSU3D0/pi-dcp/blob/8d15a3331c51f3551ccd20583ac0f5ba499a13c3/README.md#features--strategies) |
19
+
20
+ ## Когда Tacet свернёт этот отчёт?
21
+
22
+ Сначала модель видит вывод, который Pi получил от инструмента. Свежие результаты
23
+ Tacet сохраняет целиком. В конце завершённого хода расширение рассматривает старые
24
+ результаты инструментов из заданного списка. Tacet оценивает, сколько места они
25
+ освободят вместе. В стандартном профиле порог зависит от объявленных цен модели
26
+ на ввод и кеш. Свёртка обходится без дополнительного вызова модели.
27
+ Штатное сжатие Pi также может сработать. [Расчёт порога на примере](GUIDE.md#почти-полное-окно-без-свёрток) · [Правила отбора и учёта цен](../tacet.ts)
@@ -0,0 +1,219 @@
1
+ # Tacet user guide
2
+
3
+ **English** · [Русский](GUIDE.md) · [Quick start](QUICKSTART.en.md)
4
+
5
+ When you spend a long Pi session reading files, running tests and comparing results, the output from early commands can fill much of the model’s context. Tacet can replace an old tool result with a short marking in later requests. The original stays in the session, ready for the model to retrieve.
6
+
7
+ [Installation](#installation) · [Everyday use](#everyday-use) · [Advanced use](#advanced-use) · [Common questions](#common-questions) · [Disabling and removing Tacet](#disabling-and-removing-tacet)
8
+
9
+ ## Installation
10
+
11
+ You need a working installation of [Pi](https://pi.dev). Run `pi --version` to see your Pi version. To install Tacet from GitHub for regular use, run
12
+
13
+ ```sh
14
+ pi install https://github.com/sekobus/tacet
15
+ pi list
16
+ ```
17
+
18
+ Start a new Pi session and type `/tacet`. To try it once, use `pi -e https://github.com/sekobus/tacet`. To remove the GitHub installation, use `pi remove https://github.com/sekobus/tacet`.
19
+
20
+ **Using a local copy.** If you prefer to load the [extension file](../tacet.ts) directly, open a terminal in the directory containing `tacet.ts` and follow the steps below.
21
+
22
+ **For regular use**, run these commands. If Tacet is already installed, just run `pi list`.
23
+
24
+ ```sh
25
+ pi install "$PWD/tacet.ts"
26
+ pi list
27
+ ```
28
+
29
+ Look for the path to `tacet.ts` in your list of user packages. Pi loads the file from that path, so leave it in place. Start `pi` in your work directory, or type `/reload` in an open session. Updating the file at the same path takes effect on reload or restart.
30
+
31
+ **For a single session**, run `pi -e "$PWD/tacet.ts"`. This loads the extension for that run only.
32
+
33
+ **For a single project**, run `pi install --local "/path/to/tacet.ts"` from that project’s root, supplying the full path to the file. Pi records it in `.pi/settings.json` and applies those settings in trusted projects. If installation or removal reports `Project is not trusted`, inspect the project’s `.pi` directory. You can record your trust decision for a familiar project with `/trust` inside Pi.
34
+
35
+ ### Installation checks
36
+
37
+ We tested the 0.2.0 Git package with Pi 1.7.0 on Linux in a fresh profile. A one-session run loaded Tacet. After installation, `/tacet` worked in English and Russian with `unfold` available. In a trusted test project, a file read was eligible to fold until we added its path to `.tacetprotect` and reopened the session. After removal, the package disappeared from `pi list`. The earlier standalone-file check used Tacet 0.1.0 and Pi 1.6.1. [Installation commands](#installation)
38
+
39
+ ## Everyday use
40
+
41
+ Work with the agent as usual. Suppose you ask it to run the tests. The model sees the full output returned by the tool. Later, after the model has answered and you have moved on, the old report may fold.
42
+
43
+ - **In your transcript**, you can still read the original report. A footer such as `tacet: 3 folded` means Tacet has recorded three folds on this branch. It appears after the first fold and counts the branch’s history, including markings that may have left the current context.
44
+ - **In subsequent model requests**, the tool call stays visible. Its result can become a marking with the original size and an ID. For `bash` and `powershell`, the marking keeps up to the last three lines (at most 300 characters). For example,
45
+
46
+ ```text
47
+ [tacet: 20165 chars folded; unfold("a1b2c3d4") returns them]
48
+ …
49
+ Tests: 1 failed, 72 passed
50
+ Time: 7.3 s
51
+ Command exited with code 1
52
+ ```
53
+
54
+ You can now ask, **“Which `payments` test failed before the fix? Show me the error from that run.”** The model can use `unfold` to look up the original error. You can ask in ordinary language without copying the ID. To find out whether the tests pass *now*, ask for a fresh run.
55
+
56
+ By default, only old text results from `read`, `bash`, `powershell`, `grep`, `find`, `ls` and `unfold` itself qualify. User and assistant messages, reasoning, tool-call arguments and results from other tools such as `edit` stay intact. Reads of instruction files named `SKILL.md`, `AGENTS.md` and `CLAUDE.md` are protected by the default path pattern. Recent output and results the model has yet to answer also stay in full. A result with an image or another non-text block stays **whole**, caption included. Tacet estimates text size, not the token cost of an image.
57
+
58
+ A user `!` command is a message, not a tool result: Tacet counts the command and output but never folds them. `!!` is not sent to the model and does not count.
59
+
60
+ A fold changes the **context** Pi sends to the model. Pi appends a `context_edit` record to the session file and retains the original entries. To find the edit, open `/tree` in Pi and enable the `all` filter (default key `Ctrl+A`). A branch taken from before that entry still sees the earlier state.
61
+
62
+ ### Protect project files
63
+
64
+ To keep a particular file’s `read` result in full, create `.tacetprotect` in the **active Pi session’s working directory**. For example, start Pi at the repository root and place this list there:
65
+
66
+ ```text
67
+ # .tacetprotect
68
+ docs/IDEA.md
69
+ docs/NEXT.md
70
+ ```
71
+
72
+ Tacet reads the list only in a trusted project. A session started in a subdirectory does not inherit its parent’s list. After adding, editing or removing the file, run `/reload`. The new snapshot applies to future decisions, including older results not yet folded. Existing markings stay unchanged; `unfold(id)` still returns the original.
73
+
74
+ Use UTF-8 and one relative path per line, with `/` as the separator. Outer whitespace, blank lines and lines starting with `#` are ignored; spaces and `#` inside a name are preserved. Duplicates and files that do not yet exist are fine. Matching uses the **whole, case-sensitive path**, not a basename or prefix. There are no globs, negations or recursive directory rules. Absolute paths, `~/`, a `..` component and a trailing `/` are invalid in the list. The list itself must be a regular file of at most 64 KiB, not a symlink. If it cannot be read safely or parsed, all new folds pause; `/tacet` explains why. Fix the file and run `/reload`. If the platform does not support opening the file safely, remove `.tacetprotect` and run `/reload` to continue without the list.
75
+
76
+ The list supplements the effective `instructions` pattern, even if you replaced it. Protection follows the **recorded `read` argument**: `./`, one leading `@`, absolute paths and `~/` can denote the same listed path. For example, listing `docs/Plan A.md` protects reads with either an ordinary space or a non-breaking space in the argument: Pi’s built-in `read` maps certain Unicode spaces to ordinary spaces. The spelling in the list itself stays literal. If Pi opens an alternate filename (for example, one with a separate accent mark), also list the spelling passed to `read`. Tacet does not resolve symlinks in listed paths, follow another extension’s redirection, or infer paths from `bash`, `grep` or `unfold` output. The list does not load files into context, refresh earlier reads or control `/compact`.
77
+
78
+ ## Advanced use
79
+
80
+ ### Retrieve a report or find a line
81
+
82
+ The **model** calls `unfold` using the `id` from a marking. In the example above, `{"id":"a1b2c3d4"}` retrieves the report. To look for lines containing either `payments` or `refund`, it can use
83
+
84
+ ```json
85
+ {"id":"a1b2c3d4","match":"payments|refund"}
86
+ ```
87
+
88
+ `match` searches inside one folded result. It matches plain substrings case-insensitively and accepts alternatives separated by `|`. A string such as `pay.*fail` matches those literal characters. Matches include up to two neighbouring lines on each side. Line numbers are relative to the original tool output. To edit a file, read its current contents.
89
+
90
+ If nothing matches, `unfold` reports that. When the selection or the no-match explanation would be as long as the original, the tool returns the original. Retrieval is limited to what Pi received, including any truncation by the original tool. It adds a copy to the current context. The marking and branch fold count remain in place.
91
+
92
+ ### Choose the available tools
93
+
94
+ With Pi’s usual tool selection, loading Tacet makes `unfold` available. When you supply a tool list for the model or a subagent, include `unfold` if you want automatic folding.
95
+
96
+ ```sh
97
+ pi --tools read,bash # New folds are paused
98
+ pi --tools read,bash,unfold # New folds are possible
99
+ ```
100
+
101
+ Tacet checks tool availability on each completed turn. If you disable `unfold` midway through a session, older markings remain. Re-enable the tool on the same branch to give the model access to those results again.
102
+
103
+ ### Fold earlier or later
104
+
105
+ Type `/tacet`. The first screen shows whether automatic folding is on, the active profile and the reason for its forecast. In the working session shown below (Russian interface), folding the eligible results would free 12.57% of the context. The active profile requires 50%, so Tacet waits. If rounding would hide a small difference, the message says “just below” or “just above” the threshold. Exact equality meets the threshold. The next line describes markings the model can already see. Focus starts on **Done**. Enter or Esc closes the screen. Viewing the forecast does not trigger a fold or record a branch choice.
106
+
107
+ ![Tacet in a working session with automatic folding on and the forecast below the standard profile’s threshold.](images/forecast.ru.png)
108
+
109
+ [See the file read and the branch’s fold count alongside this forecast.](images/session.ru.png)
110
+
111
+ Choose **Details…** to see the model, context window, profile source, calculation and settings. By default, ↑↓ scroll the text and Enter or Esc returns to the first screen. If you remapped these keys, follow the on-screen hints. **Change profile…** marks the current choice with a tick. **Back** or Esc leaves it as it was. RPC, print and JSON modes return the summary and details as text.
112
+
113
+ **Expanding visible markings** estimates how much larger the *current* context would be if its visible markings were replaced by the originals. An original of about 8,000 tokens in place of a 15-token marking would add about 7,985 tokens, or 4.99 percentage points of a 160,000-token window. This text-size estimate is separate from provider billing and Pi’s usage figure. When the window size is unknown, only the token estimate is shown.
114
+
115
+ The estimate covers markings visible on this branch now. Compaction or a later context edit can reduce it while the historical fold count stays the same. Pausing leaves old markings in place. Retrieving a copy with `unfold` also leaves the marking in place, so that retrieval alone does not change the estimate.
116
+
117
+ **No reliable answer boundary** means the model has yet to answer, or its answer was interrupted, failed or reached its output limit. Tacet waits for a fully completed answer before it can give a forecast or fold another result.
118
+
119
+ To lower the threshold, choose **Change profile… → Earlier** or type `/tacet earlier`. The choice applies on the next eligible completed turn, with the same selection rules. Changing the profile does not call the model. `later` raises the threshold, `standard` uses the price-based rule, and `custom` uses a fixed percentage. `/tacet default` returns to your configured default profile, which can itself be `later` or another profile.
120
+
121
+ ![The Change profile menu has a check mark next to Use settings profile (default).](images/profiles.en.png)
122
+
123
+ A choice belongs to the branch. It survives `/reload` and `/resume`, and applies to branches taken after the choice. `/new` starts with the configured default. RPC sends a `notify` without asking the client for a reply. Print (`-p`) and `--mode json` send command text to stderr and leave stdout to Pi. Use the direct commands in these modes. With `--no-session` the choice lives in memory. A new `--session-id` with no history may never create a file. To continue between runs, use `--session` with an existing saved session.
124
+
125
+ ### Nearly full window with no folds
126
+
127
+ Open **Details…** under `/tacet`. Pi’s **usage** shows how much of the model’s window is occupied. High usage alone does not trigger a fold or lower the threshold. Pi may run its own compaction before Tacet makes its first fold.
128
+
129
+ With folding on and `unfold` available, compare **Share** with **threshold**. Suppose Pi reports 85% usage. Replacing dozens of old results would save `S = 28,000` estimated tokens and leave `L = 72,000`. The share is `S/(S+L) = 28%`. This accounts for the total space a fold would free. Tacet estimates from text length, so `S+L` can differ from Pi’s token count.
130
+
131
+ **Composition** shows how much space is taken by messages, reasoning and tool-call arguments. Those and results in the recent protected tail stay in context.
132
+
133
+ When the model declares no prices, `standard` needs to save at least as much as it leaves (`S ≥ L`, a share of 50%). With the built-in settings, `earlier` needs about 33%, `later` about 67%, and `custom` 30%. All four would wait at 28%. These figures describe the forecast for the current context.
134
+
135
+ **Set a threshold for this branch.** Type `/tacet custom 25` or choose **Change profile… → Custom threshold…**, enter `25` and confirm. Use a whole number from `1` to `99` without a sign, leading zero or `%`. The current value in the dialog is a hint. Empty input or Esc cancels. The 28% share above now meets the 25% threshold. The forecast updates immediately. Tacet keeps the current pause state and checks whether to fold on the next eligible completed turn. You can do this without editing a file or reloading Pi.
136
+
137
+ ![Custom threshold dialog with 25 entered and 30% shown as the current threshold.](images/threshold.en.png)
138
+
139
+ **Use the shared percentage again.** Type `/tacet custom` without a number or choose **Custom threshold from settings**. The profile stays `custom` and uses `customPercent` (30% by default). To restore the configured *profile*, use `/tacet default`. Choosing another profile clears the previously pinned number.
140
+
141
+ **Set a shared percentage.** Set `"customPercent": 25` in [your settings](#settings-for-future-sessions) and type `/reload`. A number already pinned on a branch takes precedence. **Details…** shows the source of the profile and of its active percentage separately.
142
+
143
+ ### Pause on this branch
144
+
145
+ Type `/tacet off` or select **Pause folding** to keep new results in full. The footer count stays the same and the model can still use `unfold` for old markings. While paused, the forecast shows what Tacet could save with automatic folding on.
146
+
147
+ Type `/tacet on` or choose **Resume folding** to resume. On the next eligible completed turn, the current profile also considers results received **during the pause**. The usual checks still apply, including tool availability, valid settings and a completed answer.
148
+
149
+ The profile and pause are independent. You can use `/tacet later` or `/tacet default` while paused. Repeating `off` or `on` adds no new branch entry. A pause takes effect immediately, survives reopening a saved branch and is inherited when you fork from a point after `off`. `/new` starts with automatic folding on. Pi’s own `/compact` remains available.
150
+
151
+ ### Settings for future sessions
152
+
153
+ The optional `tacet.json` belongs in the Pi agent directory (normally `~/.pi/agent`, or the directory named by `PI_CODING_AGENT_DIR`). You manage this file. For example, to fold later by default, use
154
+
155
+ ```json
156
+ {"defaultProfile": "later"}
157
+ ```
158
+
159
+ Use `{"language":"en"}` for English or `{"language":"ru"}` for Russian. Otherwise Tacet checks `LC_ALL`, `LC_MESSAGES` and `LANG` in that order and uses the first nonempty value. A Russian locale such as `ru-RU` or `ru_RU.UTF-8` selects Russian. Other locales, including `C`, and an empty environment select English. This setting applies to the human interface. Commands, model-facing markings and `unfold` keep their original text. With invalid settings, the warning uses the environment’s language.
160
+
161
+ Save the file and type `/reload`. Removing it restores the built-in settings. On a branch with an explicit profile, `/tacet default` makes the branch follow the configured default again.
162
+
163
+ | Field | Built-in default | Accepted values |
164
+ |---|---|---|
165
+ | `language` | From the environment | `ru` or `en` |
166
+ | `defaultProfile` | `standard` | `standard`, `earlier`, `later`, `custom` |
167
+ | `earlierFactor` | 0.5 | Number greater than 0 and less than 1 |
168
+ | `laterFactor` | 2 | Finite number greater than 1 |
169
+ | `customPercent` | 30 | Integer from 1 to 99, independent of model prices |
170
+ | `keep` | 20000 | Nonnegative integer, in estimated tokens of recent context |
171
+ | `observations` | `read`, `bash`, `powershell`, `grep`, `find`, `ls`, `unfold` | Array of nonempty tool names. An empty array disables new folds |
172
+ | `instructions` | Protects three filenames (below) | An object with `source` and optional string `flags`. The flags `g` and `y` are invalid here |
173
+
174
+ The built-in instruction pattern expressed as JSON is `{"source":"(^|[/\\\\])(SKILL|AGENTS|CLAUDE)\\.md$"}`. It matches the exact filename after `/` or `\`, or at the start of the path. Tacet tests any pattern against the original path and, if it starts with `@`, also with that first character removed, as in Pi's `read`. Supplying a list or pattern replaces the whole default. Prefer a simple filename pattern. The model supplies the path, and a valid regex with excessive backtracking can still delay the turn.
175
+
176
+ Use strict JSON without comments. All fields are optional. An unreadable settings file, an unknown key or an invalid value pauses **all new folds**. Older markings can still be retrieved. `/tacet` reports the path and reason. Correct the file and type `/reload`.
177
+
178
+ ### Adjust how much recent context to keep
179
+
180
+ Tacet protects a recent **tail** of context. By default that tail is 20,000 estimated tokens, capped at one eighth of the model’s window. `keep` sets the size of the protected portion. The profile determines how much space a fold must free.
181
+
182
+ If long logs get in the way, try `{"keep":10000}` in `tacet.json`. If the model often retrieves files it has just read, a larger tail may help. A TypeScript wrapper can also set `keep`, `observations` and `instructions`. For each field, the wrapper takes precedence over the file, which takes precedence over the built-in value. Save this example as `my-tacet.ts` next to `tacet.ts`.
183
+
184
+ ```ts
185
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
186
+ import tacet from "./tacet.ts";
187
+
188
+ export default (pi: ExtensionAPI) => tacet(pi, { keep: 10_000 });
189
+ ```
190
+
191
+ The import is relative to the wrapper. Adjust it if you keep `tacet.ts` elsewhere. Install only one entry point. From the directory containing both files, remove the original registration if it is installed, then install the wrapper.
192
+
193
+ ```sh
194
+ pi remove "$PWD/tacet.ts"
195
+ pi install "$PWD/my-tacet.ts"
196
+ ```
197
+
198
+ Keep the original file on disk for the import. Restart Pi or type `/reload`. In a wrapper, `observations` lists tools whose **results** may fold and `instructions` is a regular expression matched against the path in the tool-call arguments. Each replaces its entire default, so retain the entries you want from [the defaults in tacet.ts](../tacet.ts). Pi’s `--tools` option controls which tools the model can call. With `g` or `y` on a wrapper’s `RegExp`, Tacet starts each path search at zero and preserves the original `lastIndex`. Those flags are invalid in the JSON setting `instructions.flags`.
199
+
200
+ ## Common questions
201
+
202
+ **I installed Tacet. Where is it?** A short session may have little old output. Type `/tacet` to see the reason, even before the first marking appears. If the window is nearly full, [compare the share with the threshold](#nearly-full-window-with-no-folds). If `unfold` is unavailable, check your tool list. If Pi does not recognise `/tacet`, check the path in `pi list`, the extension in `pi config`, and whether you started with `--no-extensions`. Reload or restart after changing settings. For a one-time trial, include `-e` when you launch Pi. The `pi -p` mode has no footer.
203
+
204
+ **The model received `Nothing is folded under the id …`.** It needs the ID printed in a marking on the current branch. A tool-call ID identifies a different entry. To retrieve output from yesterday’s run, reopen the saved session with `/resume` and return to the branch that contains the marking.
205
+
206
+ **Will every request cost less?** Folding takes no extra model call. Shorter requests can still make the provider reread part of the context instead of serving it from cache. A local model can incur extra processing too. Pi’s automatic compaction and `/compact` continue to work. The effect on the cost and speed of a long session depends on the provider and workload.
207
+
208
+ **Can a fold hide a secret printed in a log?** The model has already received that output. The original stays in the session history and remains retrievable.
209
+
210
+ ## Disabling and removing Tacet
211
+
212
+ Use `/tacet off` for a pause that keeps originals accessible. To disable the extension, run `pi config` in the terminal and turn off Tacet or its wrapper. Use `pi config --local` from the project directory for a project-local installation. To remove it, choose **one** alternative matching your installation:
213
+
214
+ - GitHub URL: `pi remove https://github.com/sekobus/tacet`.
215
+ - Local file: `pi remove "$PWD/tacet.ts"` from the file's directory.
216
+ - Wrapper: `pi remove "$PWD/my-tacet.ts"` from the wrapper's directory.
217
+ - Project-local: run `pi remove --local <source>` from the same project, using the URL or path you installed.
218
+
219
+ Restart Pi or type `/reload`. Existing folds are recorded in the saved session. To retrieve them again, load Tacet with `unfold` active and continue on the appropriate branch.