Skip to content

feat(tui): plan 0.5 call graph tool and phase C closeout (acceptance probes, 7-page guide, notices; plan r11) - #13

Merged
zy1233 merged 9 commits into
mainfrom
chore/phase-c-closeout
Oct 12, 2026
Merged

zy1233 merged 9 commits into
mainfrom
chore/phase-c-closeout

Conversation

@zy1233

@zy1233 zy1233 commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Summary

Plan item 0.5 and phase C (C.1 to C.4), plan r11. Nine commits on top of main (df812d1). The Python agent does not change its behaviour: one docstring, one AGENTS.md and two example files change wording. The record is section 10.14 of docs/PLAN/archive/PLAN-RUST-AGENT-RUNTIME-REMOVAL-EXECUTION-LOG.md. The status is in docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md.

What a user of zypi sees. zypi no longer writes documentation files into <home>/docs/user-guide/ at start. The embedded user guide has 7 pages (was 33 files). The tutorial overlay is gone (it had no entry point). Some messages that named missing files now say something true. Old copies of the extracted guide stay where they are.

Nothing was deleted from the source tree because of the call graph. The tool only lists candidates (item D.8).

  • 0.5, call graph tool. scripts/tui_callgraph.py (crates, units, keep) reads the Rust source as text. It needs no cargo and no network. keep writes docs/baselines/tui-support.md: of 305,581 non-test lines in the 7 support crates, 17 modules (6,190 lines, 2 %) have no live reference. pi-hooks has 4,339 of its 9,026 lines in that list. I checked the list with the compiler in 5 runs on a pruned copy. The first runs found 3 classes of live code that the tool called dead: paths inside attribute strings, paths that start at a child module, and an impl that no path names. The tool now counts the first two as references and marks the third as "check first". In the last good run, 16 modules (6,143 lines) were removed and cargo check passed for the three product crates and for --workspace --tests. The 17th (pi-tools types::error) must stay: it holds the impl From<...> for ToolError that ? needs.
  • C.1, run-time acceptance (Linux, WSL2). scripts/tui_pty/net_audit.py samples the socket tables of zypi and of every process below it, about every 9 ms, during one conversation turn. zypi has no connection to a non-local address and listens on nothing. Mock model: 13 of 13 checks. Whole process tree in an empty network namespace: 13 of 13 (the turn still finishes). One real-model turn: 13 of 13, with a positive control (the agent's own outside connections were seen). The model key went to the child process through an environment variable only. scripts/tui_pty/status_line_probe.py: the custom status line is never drawn under the Python agent (4 of 4 runs), because the agent never sends session_status. This is decision 15 below.
  • C.2, embedded user guide. 33 files become 7 pages and a README, rewritten from the code and agent.example.toml. The start-up extraction is removed. The tutorial overlay (688 + 149 lines) is removed. Six strings that pointed to files that do not exist are fixed (4 in mcp.rs, 1 in glob.rs, 1 help line of zypi wrap), and so is the picker footer. pi-pager tests: 5,626 to 5,608.
  • C.3, notices. scripts/tui_notices.py (check, update [--write]) compares tui/THIRD-PARTY-NOTICES with Cargo.lock for the 5 release targets. The file had 1,167 entries for 989 packages: 222 stale entries are removed and 44 missing entries are added (18,898 to 16,548 lines). tui/NOTICE is rewritten: the product is zypi and tui/ is a hard fork. This is a comparison with Cargo.lock, not a legal review.
  • C.4, documents and leftover words. config.toml limits measured and written down, docs/TUI-AND-CODE-AGENT.md corrected, a revision note in the phase 4 spec, the admission rule for pi/ extensions in docs/DESIGN.md section 8.5. grok agent: 28 lines to 0 (pi-shell/README.md was the upstream Grok manual, 2,682 lines, now 43). leader (245) and x.ai (304) cannot go to 0 yet, so [gates.residue] in scripts/tui_baseline.toml holds them as ceilings that only go down.

Decisions for you

  1. Decision 15, the custom status line. It cannot show under the Python agent. Options: (a) the Python agent sends session_status (a new pi/ extension, it must pass the five admission rules first); (b) the pager draws the line from data it already has (working directory, model, permission mode, git branch); (c) delete the setting, the code and the guide page. I lean to (b) or (c). Status: open.
  2. Phase D candidates D.5 to D.9. None is done here. D.5: pi-test-support has 5,003 of 7,384 lines without an outside user. D.6: the embedded guide viewer has no entry point, so nobody reads the 7 pages. D.7: npm and updater leftovers that never run. D.8: delete the 16 compiler-checked modules (6,143 lines) and pi-hooks/tests/integration.rs. D.9: tui_baseline.py test does not isolate HOME, so some tests write into the real ~/.pi-python and /tmp (found after the runs; 18 trust entries for deleted temp folders and 46 grok-unified-log-test-* folders).

Not verified, left

  • No CI run has seen this branch before this PR. The Rust numbers are from one local run on WSL2.
  • The real model was used only for the network audit (one turn).
  • The network audit and the status-line probe ran on Linux (WSL2) only. The audit reads the TCP and UDP tables; it does not see Unix sockets and it can miss a connection that opens and closes between two samples.
  • No person has read the wording of THIRD-PARTY-NOTICES. tui_notices.py check needs cargo, so it is not in CI yet.
  • The compiler check ran once, on the tree of commit 24907ef. The 16 deletable modules were not deleted and no test ran in the pruned copy.
  • The <user_guide> block in pi-agent/templates/prompt.md still names ~/.grok/docs/user-guide/. I found no code that renders this template, so it probably reaches no prompt. I did not prove it. zypi --help still lists Grok-era flags (--agent, --agents, --no-plan, --no-subagents, --oauth); I did not check each one.

Review guide

Files What
scripts/tui_callgraph.py, scripts/tests/test_tui_callgraph.py (new), docs/baselines/tui-support.md (new, generated) the call graph tool (39 tests, 17 mutation checks) and its generated keep list
scripts/tui_notices.py, scripts/tests/test_tui_notices.py (new), tui/NOTICE, tui/THIRD-PARTY-NOTICES, tui/third_party/* the notices tool (62 tests); notices rewritten and reconciled with Cargo.lock
scripts/tui_pty/net_audit.py, status_line_probe.py, status_proxy_agent.py (new), scripts/tests/test_tui_pty.py, scripts/tui_pty/README.md the C.1 probes and 27 new helper tests
tui/crates/codegen/pi-pager/docs/**, src/docs.rs, src/tutorial_docs.rs, src/views/tutorial.rs, src/views/modal.rs, src/app/app_view*.rs C.2: guide cut to 7 pages, tutorial overlay and start-up extraction removed (45 files, +388 / -10,008)
tui/crates/codegen/pi-shell/README.md, pi-shell/src/util/config/mcp.rs, pi-sandbox/src/deny/glob.rs, pi-agent, pi-http, pi-status-line, pi-test-support, pi-tty-utils C.4: grok agent pointers removed, strings fixed; comments, labels and READMEs only
scripts/tui_baseline.py, scripts/tui_baseline.toml, scripts/tests/test_tui_baseline.py the leftover-word gate ([gates.residue]), pi-pager reference_passed 5,608
docs/PLAN/**, docs/baselines/**, docs/DESIGN.md, docs/TUI-AND-CODE-AGENT.md, docs/WINDOWS.md, docs/specs/...phase4..., CHANGELOG.md, AGENTS.md, packages/pi-agent-cli/{AGENTS.md,agent.example.toml,config.toml.example,pi_agent_cli/config.py} records and wording fixes (the config.py change is a docstring)

Verification

All numbers are local. No CI ran on this branch before this PR.

  • Rust, whole manifest on WSL2 (python scripts/tui_baseline.py test, scrubbed environment, PI_E2E_PYTHON and PI_E2E_REQUIRED=1), at 4fadcf3: 10 suites, 8,665 passed, 0 failed, 22 ignored (22 m 22 s). That is the last CI result (8,683) minus the 18 tests that went with the guide. pi-pager: 5,608 (13 ignored). Every other suite equals its reference_passed. After 4fadcf3, tui/ changed only in doc comments, one label and two READMEs, so the tests did not run again.
  • python scripts/tui_baseline.py check at 24907ef: passes in 5 m 24 s (dependency graph 980, warnings 0, leftover words 0 / 245 / 304).
  • python scripts/tui_notices.py check at 71286ed: 989 packages, 989 entries, 0 missing, 0 stale.
  • pytest, without real_llm: 2,510 passed, 0 failed, 39 skipped on Windows (Python 3.12.7); 2,538 passed, 0 failed, 11 skipped on Linux (WSL2, Python 3.12.3).
  • ruff check . and ruff format --check .: clean with the project's Ruff 0.16.10 and with CI's pinned 0.16.0 (234 files).
  • Document links, anchors and reference labels in the plan, the execution log and the baselines: checked, 0 problems.
  • Expected in CI: TUI CI (cargo test, about 30 minutes) shows 8,665 passed, 0 failed, 22 ignored. If pi-pager is not 5,608, look at the manifest first.

…he TUI workspace (plan 0.5)

The tool reads the Rust sources and reports which modules live code refers to.
It replaces the hand-written list of examples of what the support layer keeps.
Subcommands: crates, units, keep. 35 tests; each mutation of the tool fails them.
…NOTICE (plan C.3)

scripts/tui_notices.py finds the packages that ship in zypi (normal and build
dependency closure of pi-pager-bin, five targets) and fixes the notices file:
222 stale entries out, 44 missing entries in, hand-written sections kept.
The wording of a new entry is copied from the entries with the same license.
tui/NOTICE now names the product (zypi), says tui/ is a hard fork that does
not follow upstream, and lists the changes. The stale nfsserve entry in
third_party/ is gone. 62 tests.
…ial overlay removed, no per-start extraction

- docs: seven pages (getting started, slash commands, theming, sessions,
  terminal support, permissions and safety, status line) written against
  the code and agent.toml; sixteen pages of removed features deleted.
  The status-line page says the row stays empty with the Python agent
  (it is filled from a session-status update only the Rust agent sent).
- docs.rs: USER_GUIDE lists the seven pages; extract_user_guide_docs and
  its call in pi-pager-bin are gone; two tests guard the pages (no old
  product names, every file in the directory is listed).
- tutorial overlay (views/tutorial.rs, tutorial_docs.rs, docs/tutorial/)
  removed: no entry point since A.3, and its pages described commands
  zypi does not have.
- doc picker: the footer tip pointed at files zypi no longer writes.
- strings that pointed at ~/.grok/docs/user-guide/*.md (mcp.rs, glob.rs),
  the zypi wrap help line that pointed at a README that does not exist,
  and two comments.
…lan C.1)

net_audit.py plays one turn under a pseudo-terminal and samples the sockets of zypi and of each process below it (/proc/<pid>/fd joined with /proc/<pid>/net/*). zypi must hold no connection to a non-loopback address and listen on none. --mock checks that the agent is silent too, --no-network runs it in an empty network namespace, and --model-from FILE plays one real turn (the agent must hold an established connection: the positive control; the output names no host, address or key). status_line_probe.py shows that the status row is not drawn with the plain Python agent and is drawn when status_proxy_agent.py adds the session_status message. Unit tests for the three run on Windows and Linux.
…se 4 spec revised, P2 admission rule in DESIGN

AGENTS.md (pi-agent-cli) says what zypi really does with config.toml: strict types for the keys it knows (a top-level permission string, a [[models]] array and invalid TOML stop it with exit 1), unknown keys ignored; the agent falls back to config.toml only when agent.toml is missing. TUI-AND-CODE-AGENT.md: ACP link, real [model] keys (id, not model_id; no context_window; permission values ask|auto|always-approve; [skills] paths), the real slash commands, no model client / tool runner / MCP client in zypi, pointer to the network audit. Phase 4 spec section 1.3 #2 and section 3 get a revision note (runtime part of the shell is gone; pi-tools and pi-workspace still tie the pager to the tree; tui/ is a hard fork). DESIGN section 8.5 states the five-condition admission rule for pi/ extensions (plan P2).
…tover words (plan C.4)

The pi-shell README was the upstream Grok CLI manual (1,968 lines, an install script that installs the official CLI): replaced by a short note on what the crate is now. Doc comments and a label in pi-agent, pi-http, pi-tty-utils and pi-test-support no longer name a 'grok agent' command. pi-test-support's README now says that only EnvGuard, scaled, TestProcess/TestSandbox, env_parse and ResourceGrowth have users outside the crate (plan D.5). tui_baseline.py gets count_residue and a [gates.residue] ceiling per phrase: 'grok agent' 0, 'leader' 245, 'x.ai' 304 lines under tui/crates (the plan's literal zero cannot be met before phase D: the lines are the removed leader process, xAI endpoints in the auth, voice and update code, and the vendor-method filter itself). A test runs the same ratchet in the Python CI job.
…et the pi-pager baseline to 5,608

tui-support.md is the output of tui_callgraph.py keep (item 0.5). The tui.md section on leftover words classifies the 245 leader and 304 x.ai lines that the new residue gate holds as ceilings. pi-pager is 5,626 -> 5,608 after the embedded user guide change (item C.2); the other nine suites did not move (8,665 over ten suites, one local run on Linux).
…list (plan 0.5)

Check: copy tui/, delete the files of every unit the tool calls dead, run
cargo check on the consumer crates. The first run listed 21 dead units and
4 of them were live:

- a path inside a string of an attribute (`serde(with = "crate::util::serde_base64")`):
  `util::serde_base64`, `serde_helpers`
- a path that starts at a child module, with no `use` and no `crate::`
  (`hub_auth::init_metrics()` in lib.rs): `hub_auth`, `hub_auth::proactive`

Both are references now. A third kind cannot be seen from the text: an impl
that code uses without a name (`types::error` holds the `impl From<TodoError>
for ToolError` that `?` calls). A dead unit with `impl` blocks for types it
does not define is listed apart as "check first", and the summary table gets
a column for it.

Result on 24907ef: 17 dead units, 6,190 lines. With all 17 deleted, cargo check
fails at exactly one unit (`types::error`, 5 errors, and it is in the "check
first" list); with that one kept, the check passes and shows one new warning
(an unused function in pi-hooks, which is a function, not a module).

Tests 35 -> 39. Each of the 17 mutations of the tool makes a test fail.
docs/baselines/tui-support.md is regenerated.
…g, baselines and changelog

Plan: 0.5 and C.1-C.4 are done; decision 15 (the status line) and the phase D
candidates D.5-D.9 are new; index, status and revision text say r11. D.9: the
Rust test run does not isolate HOME, so some tests write the developer's real
~/.pi-python and /tmp. Execution log: section 10.14, appendix B.7 and the
revision log. Baselines: tui.md gets the r11 numbers and a keep-list section;
tui-history.md gets the r11 paragraph. CHANGELOG: the call graph tool, the
notices check, the network audit, the status line probe, the 7-page user
guide, NOTICE, the leftover-word ratchet, the config.toml notes. AGENTS.md:
the two new TUI tools, the new PTY scripts and the HOME warning.

Numbers: 10 suites 8,665 passed / 0 failed / 22 ignored (WSL2, one local run);
pytest Windows 2,510 and Linux 2,538 passed; Ruff 0.16.10 and 0.16.0 clean.
Nothing is pushed.
@zy1233
zy1233 merged commit 4fc028a into main Oct 12, 2026
7 checks passed
@zy1233
zy1233 deleted the chore/phase-c-closeout branch October 12, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant