pi-usereq
v0.109.41
Published
Requirements-oriented pi extension plus Node CLI for prompt delivery, source summarization, static-check orchestration, git worktree automation, and npm release automation.
Maintainers
Readme
[!CAUTION]
🚨 STRICTLY EXPERIMENTAL — PROOF OF CONCEPT (PRE-ALPHA)
![]()
![]()
![]()
PLEASE READ CAREFULLY BEFORE USING THIS SOFTWARE:
- Very Early Stage: This project is currently a raw Proof of Concept (PoC) in a pre-alpha state. It is nowhere near production-ready and may contain severe bugs, breaking changes, or incomplete logic.
- Personal Use Only: This repository is developed, maintained, and shared strictly for personal use.
- No Support or Feature Requests: Please do not open issues, bug reports, or feature requests. They will not be addressed or accepted at this stage of development.
- No Warranty: This software is provided "AS IS", without warranty of any kind, express or implied. You may use it strictly for testing and evaluation purposes at your own sole risk.
PI-useReq/pi-usereq (0.109.41)
Quick Start
- Install the extension (see Install) and restart pi.
- Configure the project (optional): run
/pi-usereqto set the documentation directory, unit-tests directory, source directories, static code checkers, enabled tools, git automation, and notifications. - Write the requirements: run
/req-write <User Request>to produce a first SRS draft, or/req-createto derive the SRS from the existing source code. - Implement the source code: run
/req-implementto build the source from the requirements, or/req-coverto make the minimal changes that cover uncovered requirements. - Update the documentation: run
/req-workflow,/req-flowchart, and/or/req-referencesto regenerate the project documentation from the source;/req-readmekeeps this file aligned with the implementation. - Iterate: use
/req-change,/req-new,/req-fix,/req-refactor, and/req-checkto evolve requirements and code together. - Recover (if a run fails or is interrupted): invoke the next
/req-*command directly — it auto-recovers the errored workflow state and continues on the retained worktree; run/req-wtdto restore the original base path and remove generated worktrees and branches.
Requirements
- Node.js - 24.0.0 or newer, per the
enginesconstraint inpackage.json. - pi CLI (
pi.dev) - the extension runs inside pi; requires@earendil-works/pi-coding-agent1.5.2 or newer. A resolvable older host version surfaces one warning notification while the extension keeps working. - Git repository - every prompt-backed
req-*slash command plus the non-agentic/req-referencesruns slash-command-owned git validation (/req-print-result, parameter-less/req-continue, and/req-auditdo not;/req-wtdvalidates only repository discoverability): the project must be inside a git work tree, the tracked working tree must be clean, andHEADmust resolve (a detachedHEADis tolerated; a working branch is recommended because the branch name is embedded in generated worktree names). - Requirements documentation - the configured
docs-dir(defaultusereq/docs) must contain the canonical documents required by the executed commands (REQUIREMENTS.md,WORKFLOW.md,REFERENCES.md); the command table below lists each command's requirement, and/req-write,/req-create,/req-workflow, and/req-referencesare the entry points that generate them. - Static code checkers - the bundled checkers (
pyright,ruff,eslint) install best-effort through thepostinstallscript; the native C/C++ checkers (cppcheck,clang-format) and the Rust toolchain (cargoforcargo clippyandcargo geiger) require a system install (see Install). Default configured languages: C, C++, JavaScript, Python, Rust, TypeScript. - Models - model selection and model configuration are managed by the pi client, not by pi-usereq: the extension bundles no model files and exposes no model-related configuration or management surface (custom providers and models are configured in the pi client, e.g.
~/.pi/agent/models.json, and selected through its model picker). The extension is model-agnostic: it captures the active provider, model id, and thinking level at command start and re-applies them after a worktree session switch and after/req-wtdrestoration.
Feature Highlights
- 20 slash commands - 15 prompt-backed
req-*commands plus the dedicated/req-references,/req-audit,/req-wtd,/req-continue, and/req-print-resultcommands. - 12 built-in agent tools - token counting, summarization, compression, construct search, static-check, and final-output JSON validation tools for explicit files or for the configured project surface.
- Interactive configuration menu -
/pi-usereqmanages local (<base-path>/.pi-usereq.json) and global (~/.config/pi-usereq/config.json) configuration with no manual JSON editing required. - Standalone management and configuration CLI - the
pi-usereqbin exposes--help,--ver/--version,--upgrade [--dev|--develop] [--force],--uninstall, plus--get/--set/--unset/--print/--info/--print-raw/--write-configover the same local and global scopes (see Standalone CLI). - Worktree-isolated runs - prompt-command executions run in an isolated git worktree (created with
<prefix><project>-<branch>-<YYYYMMDDHHMMSS>names) and are merged back with a stash-assisted fast-forward only when the final agent output parses as a final-output JSON object withresultok; runs carryingresulterroror violating the final-output JSON contract retain the worktree inerror, and the next/req-*command auto-recovers the errored state and continues on the retained worktree instead of creating a new one. - Automatic commit guidance -
AUTO_GIT_COMMIT=enable(default) injects structured commit instructions (<TYPE>(<COMPONENT>)<BREAKING>: <DESCRIPTION> [useReq]) into every prompt; disabling it forces read-only git behavior and turns worktree orchestration off. - Notifications - desktop notify command, sound effects (levels
none/low/mid/high, defaultalt+stoggle) and Pushover push messages on prompt completion, interruption, or failure. - Runtime status bar - the extension renders its workflow state, current branch, context usage, elapsed time, and sound level in the pi status line.
- Context-occupancy guardrails - the
Context Filessettings row and every command invocation summary show the measured[<percent>% context]occupancy of the enabled context files against the selected model's max input context (or the documented 1,000,000-token fallback); prompt dispatch is aborted before worktree creation when the enabled context files exceed that limit. - Debug surface - config-gated
debug-*slash commands and a standalone debug harness (scripts/debug-extension.ts,scripts/pi-usereq-debug.sh) for offline inspection and replay.
Prompts and Agents
Each /req-<name> command is invoked inside pi as /req-<name> [<User Request>]. Prompt commands first run git validation and the
prompt-specific required-document checks, then (when Auto git commit and Git worktree are enabled) switch the session into an
isolated worktree, render the bundled prompt with the project context, and on success merge the changes back and leave the
repository clean. Merge and worktree deletion run only when the final agent output parses as a final-output JSON object with
result ok: outputs carrying result error park the workflow in error, and outputs violating the final-output JSON
contract (mandatory result, summary, and next_commands fields) park it in error with a diagnostic, both retaining the
worktree so the next /req-* command auto-recovers the errored state and continues on the retained worktree, or /req-wtd
disposes of it. Every prompt-backed req-* command prints an on-screen invocation summary (command name, passed arguments, and active
configuration); the full rendered prompt content is delivered only to the LLM agent and is never displayed on screen.
/req-references is non-agentic: it executes directly without starting an LLM session or
creating a worktree. /req-audit is non-agentic too: it loads the effective static-check configuration of the audited
project base (an optional --prj-base <path> argument, otherwise the current directory), verifies on the operating system the
installation of every configured Command checker executable through the same resolution used by static-check execution, and
writes into the editor one table of all configured static checkers grouped by language with the columns language,
static-check, and installed (or a documented line when no checker is configured). /req-print-result reprints the final-output notification of the last completed agentic workflow through
one info notification; parameter-less /req-continue prints captured Next-Workflow data into the
editor; a parameterized /req-continue delegates to the selected captured command, which owns its own orchestration.
Clean context between commands — every
/req-*orchestration keeps the session context content in place when it completes, so a subsequent command continues with the retained transcript. It is therefore recommended to start a new session with a clean context (run/new, pi'sStart a new sessionaction) before each new/req-*command, unless you actually need to keep the previous context (for example when the next command builds on the outputs of the previous one). At the end of every successful orchestration the extension emits one info notification with the parsed final-output report (markdown sections such as Summary and Outcome), the captured Next-Workflow command table, the context-retention sentence stating that the context was retained, the current context-usage percentage when available, and the/req-continuecommand table listing the captured follow-up commands. The extension retains that exact notification until the next agentic flow starts:/req-print-resultre-prints it byte-identically (same ANSI formatting, same info severity) whenever the pi TUI cleared it, for example after opening the model picker.
Recommended context for analysis — for the most effective analysis it is recommended to place the requirements, reference, and workflow documents in the prompt context by enabling the
Context Filestoggles forREQUIREMENTS.md,REFERENCES.md, andWORKFLOW.md(the settings-menu row then readsContext Files requirements:on (<chars>c/<tokens>t) • references:on (<chars>c/<tokens>t) • workflow:on (<chars>c/<tokens>t) [<percent>% context]). The enabled canonical documents are injected into every bundled prompt through%%CONTEXT_FILES%%, so the agent analyzes the requirements, the reference index, and the workflow documentation together with the source code. When at least one context file is enabled, the measured occupancy is reported as a[<percent>% context]suffix whenever at least one enabled context file exists and contributes tokens, and prompt dispatch aborts before worktree creation if the enabled context files exceed the selected model's max input context (or the 1,000,000-token fallback).
| Command | Description | Required docs |
| --- | --- | --- |
| /req-write | Produce a SRS draft based on the User Request description | none |
| /req-create | Write a Software Requirements Specification using the project's source code | none |
| /req-recreate | Reorganize and update the Software Requirements Specification based on source code analysis (preserve requirement IDs) | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-renumber | Deterministically renumber requirement IDs in the Software Requirements Specification without changing requirement text or order | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-analyze | Produce an analysis report | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-change | Update the requirements and implement the corresponding changes | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-check | Run the requirements check | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-cover | Implement minimal changes to cover uncovered existing requirements | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-fix | Fix a defect without changing the requirements | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-implement | Implement source code from requirements from scratch | REQUIREMENTS.md |
| /req-new | Implement a new requirement and the corresponding source code changes | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-refactor | Perform a refactor without changing the requirements | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-readme | Write README.md from user-visible implementation evidence | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-references | Write a REFERENCES.md using the project's source code (non-agentic, commits the regenerated file) | none |
| /req-workflow | Write a WORKFLOW.md using the project's source code | none |
| /req-flowchart | Write a FLOWCHART.md using the project's source code | REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md |
| /req-wtd | Restore the base path, switch to the main branch, and remove the current or generated worktree (non-agentic) | none |
| /req-audit | Audit the installation of configured static checker executables (non-agentic; optional --prj-base <path>; writes the grouped language/static-check/installed table into the editor) | none |
| /req-continue | Continue the previous agentic workflow with a captured Next-Workflow command: with an integer ordinal, dispatch the captured command of that rank with its captured input text; without arguments, print the captured Next-Workflow command table into the editor | depends on the delegated command |
| /req-print-result | Re-print the retained final-output notification of the last completed agentic workflow exactly as it was emitted (non-agentic) | none |
Bundled prompts substitute project-derived values through %% placeholders, including %%SRC_PATHS%% (configured source directories), %%ARGS%% (command arguments), %%PROMPT%% (command name), %%COMMIT%% (git commit or read-only instruction), and %%CONTEXT_FILES%% (the canonical docs, when the corresponding context-file toggles are enabled in the settings menu).
The prompt-backed commands /req-analyze, /req-change, /req-check, /req-cover, /req-fix, /req-new, /req-readme, /req-refactor, and /req-write resolve their User Request from the raw command input: empty (or whitespace-only) input substitutes a fixed placeholder stating that no specific request was given; input whose first non-whitespace character is @ is treated as a file reference — the referenced text file's content becomes the request text (the path may be double-quoted, single-quoted, backslash-escaped, or plain; a leading ~ expands to the home directory; missing files, non-regular files, binary content, and empty files are rejected with deterministic errors naming the file path); any other input passes through verbatim. All other prompt-backed commands keep verbatim raw-input passthrough.
Default Workflow
Click to zoom flowchart image.
Project's Documentation
Project's Tree
.
├── .pi-usereq.json # local project configuration (auto-generated)
├── usereq/ # configured docs-dir (default)
│ └── docs/
│ ├── REQUIREMENTS.md # Software Requirements Specification (SRS)
│ ├── WORKFLOW.md # runtime/execution units and call traces
│ ├── REFERENCES.md # symbol index generated from the source
│ └── FLOWCHART.md # workflow flowchart (generated on demand)
├── src/ # source code
├── tests/ # unit tests suite
├── scripts/ # release/build gate, debug harness, launcher, checker installer
├── images/ # project assets (flowchart, logo)
└── ~/.config/pi-usereq/ # global configuration (outside the repo)
└── config.json # cross-project settings (checkers, git, notifications)The documentation directory, unit-tests directory, and source directories are configurable via the
settings menu (defaults: usereq/docs, tests, src).
Install/Uninstall
Install
Install the extension package with the pi CLI:
pi install npm:pi-usereqOr install it directly from the git repository:
pi install git:github.com/Ogekuri/PI-useReqReload pi (restart the session).
On pi-package installations (npm or git source, user scope or project scope) the extension also deploys a best-effort
pi-usereq launcher symlink in the pi agent bin directory (~/.pi/agent/bin by default, honoring PI_CODING_AGENT_DIR)
targeting the packaged scripts/pi-usereq.js, plus one additional ~/bin/pi-usereq link when the ~/bin directory already
exists. Existing links resolving to the current target are left untouched, divergent symlinks are replaced, and foreign
non-symlink entries are never overwritten. If the same package ends up installed twice from different pi-managed sources,
only one installation activates: the duplicate skips registration instead of emitting per-tool conflict diagnostics.
Bundled static checkers (pyright, ruff, eslint) install best-effort via the postinstall script. Native checkers (cppcheck, clang-format) require a one-line system install:
- Debian/Ubuntu:
sudo apt install cppcheck clang-format - macOS:
brew install cppcheck clang-format - Arch:
sudo pacman -S cppcheck clang - Windows:
choco install cppcheck llvmorscoop install cppcheck llvm - Rust toolchain (provides
cargofor the defaultcargo clippyandcargo geigercheckers): https://rustup.rs ; optionalcargo geigersupport:cargo install cargo-geiger
Uninstall
Remove the extension package with the pi CLI (use the same source you installed from):
pi remove npm:pi-usereqOr, if it was installed from git:
pi remove git:github.com/Ogekuri/PI-useReqOr, for a global npm installation, run the management CLI, which removes the global npm package and the deployed launcher links:
pi-usereq --uninstallThen reload pi. Optionally delete the persisted configuration files: the global ~/.config/pi-usereq/config.json
and the project-local .pi-usereq.json files.
Extension Usage
The bulk of the extension capabilities are covered by the Prompts and Agents table; this section documents the tools, the standalone CLI, the settings menu, and the side features.
Extension Custom Tools
The extension registers the following agent tools (available to the LLM inside pi). All parameters are exposed through the pi tool-call contract; FILE entries may be project-relative or absolute paths. Compressed and search outputs always prefix every code-block line with its original source line number; search excerpts reproduce matched construct source lines as-is, including comments.
Count tokens and chars for the given files
req-files-tokens FILE [FILE ...]Generate LLM summary markdown for the given files
req-files-summarize FILE [FILE ...]Generate compressed output for the given files
req-files-compress FILE [FILE ...]Find and extract specific constructs from the given files
req-files-search TAG PATTERN FILE [FILE ...]Run static analysis on the given files using the checkers configured for their extensions
req-files-static-check FILE [FILE ...]Count tokens and chars for the canonical docs in the configured
docs-dir(REQUIREMENTS.md,WORKFLOW.md,REFERENCES.md)req-tokensGenerate LLM summary markdown for the configured
src-dirdirectoriesreq-summarizeGenerate
REFERENCES.mdfrom the configuredsrc-dirdirectories and overwrite<docs-dir>/REFERENCES.mdreq-referencesGenerate compressed output for the configured
src-dirdirectoriesreq-compressFind and extract specific constructs from the configured
src-dirdirectoriesreq-search TAG PATTERNRun static analysis on the configured
src-dirplustests-dirselections (excludingfixtures/)req-static-checkValidate inline JSON text and/or JSON files against the final-output JSON contract (
resultmust beokorerror,summarya string,next_commandsan array) and return a monolithic markdown verdictreq-result-json-validator [content] [files FILE [FILE ...]]
The set of startup tools active for a project is configurable through Enable tools in the
settings menu.
Supported <TAG> in search commands
- Python: CLASS, FUNCTION, DECORATOR, IMPORT, VARIABLE
- C: STRUCT, UNION, ENUM, TYPEDEF, MACRO, FUNCTION, IMPORT, VARIABLE
- C++: CLASS, STRUCT, ENUM, NAMESPACE, FUNCTION, MACRO, IMPORT, TYPE_ALIAS
- C#: CLASS, INTERFACE, STRUCT, ENUM, NAMESPACE, FUNCTION, PROPERTY, IMPORT, DECORATOR, CONSTANT
- Rust: FUNCTION, STRUCT, ENUM, TRAIT, IMPL, MODULE, MACRO, CONSTANT, TYPE_ALIAS, IMPORT, DECORATOR
- JavaScript: CLASS, FUNCTION, COMPONENT, CONSTANT, IMPORT, MODULE
- TypeScript: INTERFACE, TYPE_ALIAS, ENUM, CLASS, FUNCTION, NAMESPACE, MODULE, IMPORT, DECORATOR
- Java: CLASS, INTERFACE, ENUM, FUNCTION, IMPORT, MODULE, DECORATOR, CONSTANT
- Go: FUNCTION, METHOD, STRUCT, INTERFACE, TYPE_ALIAS, CONSTANT, IMPORT, MODULE
- Ruby: CLASS, MODULE, FUNCTION, CONSTANT, IMPORT, DECORATOR
- PHP: CLASS, INTERFACE, TRAIT, FUNCTION, NAMESPACE, IMPORT, CONSTANT
- Swift: CLASS, STRUCT, ENUM, PROTOCOL, EXTENSION, FUNCTION, IMPORT, CONSTANT, VARIABLE
- Kotlin: CLASS, INTERFACE, ENUM, FUNCTION, CONSTANT, VARIABLE, MODULE, IMPORT, DECORATOR
- Scala: CLASS, TRAIT, MODULE, FUNCTION, CONSTANT, VARIABLE, TYPE_ALIAS, IMPORT
- Lua: FUNCTION, VARIABLE
- Shell: FUNCTION, VARIABLE, IMPORT
- Perl: FUNCTION, MODULE, IMPORT, CONSTANT
- Haskell: MODULE, TYPE_ALIAS, STRUCT, CLASS, FUNCTION, IMPORT
- Zig: FUNCTION, STRUCT, ENUM, UNION, CONSTANT, VARIABLE, IMPORT
- Elixir: MODULE, FUNCTION, PROTOCOL, IMPL, STRUCT, IMPORT
Standalone CLI (pi-usereq)
The npm package ships the pi-usereq bin (scripts/pi-usereq.js), which runs the TypeScript CLI entry point src/cli.ts. Inside a pi-package installation the extension deploys a best-effort pi-usereq launcher symlink into the pi agent bin directory, so the command is available directly; from a source checkout run it with npm run cli -- <options>.
Analysis and static-check options mirror the agent tools for scripting and debugging:
--files-tokens FILE [FILE ...]
--files-summarize FILE [FILE ...]
--files-compress FILE [FILE ...] [--verbose]
--files-find TAG PATTERN FILE [FILE ...] [--verbose]
--files-static-check FILE [FILE ...]
--summarize [--verbose]
--compress [--verbose]
--find TAG PATTERN [--verbose]
--tokens
--static-check
--test-static-check {dummy,command} [FILES...]
--enable-static-check LANG=Command,CMD[,PARAM...] (repeatable; e.g. --enable-static-check python=command,ruff,check)
--base <path> # project base for explicit-file and config-repair flows
--here # use the current directory as project base
--verboseProject-scoped commands (--summarize, --compress, --tokens, --find, --static-check) always target the current project configuration and reject --base (use --here).
Management commands are dispatched before the analysis flags; an empty invocation prints the full help screen:
--help [--upgrade|--dev|--develop|--uninstall|--ver|--version]
--ver | --version # three aligned lines: Current Installed, Latest @ NPMjs, Latest @ GitHub
--upgrade [--dev|--develop] [--force]
--uninstall--upgrade updates through the pi CLI (pi update npm:pi-usereq by default; with --dev/--develop it resolves the latest GitHub release tag and runs pi install git:github.com/Ogekuri/PI-useReq@<tag>, aborting with an error when the release probe fails), skips the update when the npm channel is already latest, and reconciles a different installed source with pi remove plus pi install; --force only skips that already-latest gate (the pi CLI --force option affects its own self-update path and adds no forced-reinstall semantics for extension packages). --uninstall runs npm uninstall -g pi-usereq and removes the deployed launcher links.
The additive configuration CLI reads and writes the same local and global scopes as the settings menu. Paths are case-sensitive, colon-separated, and rooted at Local (<base-path>/.pi-usereq.json) or Global (~/.config/pi-usereq/config.json); array tokens support :append, :+, :insert:<Idx>, :<Idx>, and :<Idx>:<Field>:
--print [Path] # deterministic tree with current values and default/custom status
--info [Path] # schema documentation, allowed values, and ready-to-use commands
--print-raw # unmodified global configuration file bytes
--get Path # undecorated JSON value
--set Path VALUE # typed mutation; silent on success
--unset Path # restore a default, remove a row, or reset an optional field
--write-config # materialize absent schema defaults into both configuration files, preserving persisted valuespi-usereq --get Local:docs-dir
pi-usereq --set Local:docs-dir documentation
pi-usereq --set Local:src-dir:+ lib
pi-usereq --print Global
pi-usereq --info Global:static-check:Python:checkersSettings Menu (/pi-usereq)
The interactive configuration menu exposes every user-facing setting; changes are persisted automatically:
- Document directory —
docs-dir(defaultusereq/docs) used for the canonical documents. - Source-code directories —
src-dir(default["src"]) used by the analysis tools. - Unit tests directory —
tests-dir(defaulttests). - Context Files — toggles to inject
REQUIREMENTS.md,REFERENCES.md, andWORKFLOW.mdinto the prompt context through%%CONTEXT_FILES%%. Each toggle shows the measured file size (<chars>c/<tokens>t) plus its occupancy share, and the summary row appends the overall[<percent>% context]suffix. It is recommended to keep all three toggles enabled (requirements:on • references:on • workflow:on) so the analysis commands receive the canonical documents in their context. - Auto git commit —
enable(default) injects git commit instructions into every prompt;disableforces read-only git behavior (git_read-only.md) and turns worktree orchestration off. - Git worktree / Worktree prefix — enable/disable prompt-command worktree isolation and set the name prefix (default
PI-useReq-). - Language static code checkers — per-language
enable/disableflags and the globalCommand-module checker definitions (view/remove/reset with confirmation). - Enable tools — the subset of configurable startup tools activated for the project: the
files-*and project tools plus the embedded pi tools (read,bash,edit,writeenabled by default;find,grep,lsconfigurable and disabled by default). - Notifications — command-notify, sound, and Pushover settings with per-event routing (completed/interrupted/failed). Non-agentic
/req-references,/req-audit, and/req-wtdruns never dispatch command-notify, sound, or Pushover effects. - Debug — local debug logging: global enablement, prompt-content logging (
Enable debug promptsplusLog path for prompts), log file, log-on-status filter, status-change/workflow-event toggles, enabled tools/prompts, andEnable debug commands for tools. - Show local/global configuration — write the exact config file contents into the editor.
- Reset defaults — restore the default configuration with a confirmation preview.
Extension Side Features
Sound
The extension plays a bundled sound effect when a prompt ends (completed, interrupted, or failed - each event is independently toggleable) and the active sound level is not none.
- Sound levels:
none→low→mid→high. - Default toggle shortcut:
alt+s(cycles the active runtime level; configurable vianotify-sound-toggle-shortcut). - Each level maps to a configurable shell command; the defaults use
paplayon the bundledSoft-high-tech-notification-sound-effect.mp3with the%%INSTALLATION_PATH%%keyword resolved to the installed extension path.
Notifications
- Command notify — a configurable desktop-notification command (
PI_NOTIFY_CMD) run when the selected prompt-end events occur for agentic/req-*prompt runs. - Pushover — optional Pushover push notifications (
notify-pushover-*): user key, API token, priority, title, and text template; disabled until both credentials are set. Only agentic/req-*prompt runs dispatch Pushover messages.
Status Bar
The extension renders a status field in the pi status line showing: extension identity, workflow state (idle/checking/running/merging/done/warning/error, prefixed with the active request name while an orchestration runs, e.g. analyze ➔ running), current branch, context-usage gauge, elapsed timers (running orchestration, accumulated context, and session total), and the active sound level.
Debug
Config-gated slash commands that run the project tools and write the output into the editor:
debug-compress,debug-references,debug-static-check,debug-summarize,debug-tokens.Standalone debug harness:
scripts/pi-usereq-debug.sh(bash wrapper) andscripts/debug-extension.tswith subcommandsinspect,session-start,command,tool, andsdk-smoke.Debug logging writes JSON entries into one
<project>-<branch>-<timestamp>-<command>-debug.jsonfile underLog path for prompts(DEBUG_PROMPTS_LOG_PATH), filtered by prompt/tool name and workflow status; the JSON log filename is derived per run and is not user-configurable.Prompt content logging — when both
DebugandEnable debug promptsare enabled (theDebug > Enable debug promptsmenu entry), the exact rendered prompt delivered to the LLM agent throughsendMessage/sendUserMessageis saved underLog path for prompts(DEBUG_PROMPTS_LOG_PATH, default/tmp/PI-useReq). Every debug file of one run is prefixed<project>-<branch>-<timestamp>-<command>, reusing exactly the components of the run's generated worktree/branch name without the configured worktree prefix (e.g.GAlias-work-20261119083733-req-implement-request.mdandGAlias-work-20261119083733-req-implement-prompt.mdfor a run launched from branchworkof theGAliasrepository). The-prompt.mdfile is byte-identical to the rendered prompt delivered to the model; the-request.mdfile contains the exact on-screen command invocation summary. Prompt logging depends only on the globalDebugflag plusEnable debug prompts(it is exempt from theLog on statusworkflow filter); nothing is written whileDebugis disabled. Relative log paths resolve against the project root, and trailing slashes are stripped from the configured path.Because the saved file contains exactly what pi-usereq sent, you can replicate the same send from the
piCLI, outside pi-usereq and without the extension installed:# Replay the exact saved prompt as a one-shot task argument pi -p "$(cat /tmp/PI-useReq/GAlias-work-20261119083733-req-implement-prompt.md)" # Feed extra material on stdin while replaying an analysis request cat errors.log | pi -p "Analyze these errors and suggest how to fix them" # Reuse a saved prompt as coding-style guidance through an appended system prompt pi -p "Rewrite this function" --append-system-prompt /tmp/PI-useReq/GAlias-work-20261119083733-req-implement-prompt.mdProvider error logging — when a dispatched
req-*run receives a provider response with status >= 400, pi-usereq writes the exact failing request payload into<project>-<branch>-<timestamp>-<command>-error-<status>.json(raw provider-request JSON), the provider error message text into<project>-<branch>-<timestamp>-<command>-error-<status>-response.txt, a byte-for-byte snapshot of the retained execution session into<project>-<branch>-<timestamp>-<command>-error-<status>-session.jsonl, and replay metadata into<project>-<branch>-<timestamp>-<command>-error-<status>-replay.json, all beside the run's-request.mdand-prompt.mdfiles; additional same-status failures of the same run append a-retry-<n>marker before the extension. The-replay.jsonsidecar carries the provider, base URL, model id, thinking level, context window, max output tokens, the retained execution-session file, and ready-to-use replay commands;replayCommands.piForktargets the log-local-session.jsonlsnapshot, which freezes the transcript exactly at the failing provider request (before any context edit or compaction). You can re-generate the failure for immediate pi CLI debugging:# Run the complete failing provider request recorded in the sidecar # (`replayCommands.provider` is a ready-to-use curl command line) bash -c "$(jq -r '.replayCommands.provider' /tmp/PI-useReq/20261012070707447-req-analyze-error-400-replay.json)" # Or replay the request body directly curl -sS https://openrouter.ai/api/v1/chat/completions \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ -H "Content-Type: application/json" \ --data @/tmp/PI-useReq/20261012070707447-req-analyze-error-400.json # Replay the saved prompt through pi with the same model and thinking level pi --no-session --model '~deepseek/deepseek-flash-latest' --thinking high \ -p "$(cat /tmp/PI-useReq/20261012070647580-req-analyze-prompt.md)" # Resume the exact failing state using only log files, then re-trigger the failing request: # the -session.jsonl snapshot is the execution session frozen at the 400, so any # continuation message re-sends the same oversized request and reproduces the error pi --fork /tmp/PI-useReq/20261012091841114-req-analyze-error-400-session.jsonl \ --model '~deepseek/deepseek-flash-latest' --thinking high "continue"
Note on Git usage
This section describes the Git behavior of the req-* commands. The commands own their git workflow: every prompt-backed req-* command plus /req-references validates the repository before dispatch (/req-print-result and parameter-less /req-continue perform no git validation; a parameterized /req-continue inherits the validation of the delegated command), and finalization happens at the end of each worktree-backed run.
Required state before execution (every prompt-backed
req-*command plus/req-references):- The project must be inside a git work tree with a clean tracked working tree (
git status --porcelainempty; the configured debug-log file is ignored by the validation). HEADmust resolve. A working branch is recommended: the current branch name is embedded in the generated worktree names (it falls back tounknownon a detachedHEAD).- All files must be saved and you must be in the correct project directory.
- The project must be inside a git work tree with a clean tracked working tree (
What the commands do to the repository:
- Each
req-*prompt command runs git validation and the required-document checks, then (whenAuto git commitandGit worktreeare enabled) creates an isolated git worktree and branch named<GIT_WORKTREE_PREFIX><project>-<branch>-<YYYYMMDDHHMMSS>(default prefixPI-useReq-), switches the session into it, and executes the prompt there. When the live session is already anchored inside a previously generated worktree — for example after a failed run — no new worktree is created and the command continues on the retained worktree and the current session, validating the main repository instead of the (possibly dirty) reused worktree. - On success with a final-output JSON object carrying
resultokin the final agent output, the extension restores the originalbase-pathsession, applies a stash-assisted fast-forward merge of the worktree branch, and deletes the worktree and branch. - A completed run whose final output carries
resulterror, or that violates the final-output JSON contract (no parsable JSON object, or missing/invalidresult,summary, ornext_commands), parks the workflow inerrorwith a diagnostic and keeps the worktree and branch so the produced artifacts can be inspected or recovered: the next/req-*command auto-recovers the errored state and continues on the retained worktree, or/req-wtdrestores the original base path and force-removes the generated worktrees and branches. Interrupted, failed, aborted, or incomplete runs also retain the worktree execution session and park the workflow inerror. /req-referencesregenerates<docs-dir>/REFERENCES.md, stages only that file, and commits it with the fixed messagedocs(references): Update REFERENCES.md document. [useReq]whenever the regenerated content differs fromHEAD; when the content already matches, the commit is skipped and the run still reports success. Completed runs notify whether the references file changed and whether the commit was created or skipped. When the configuredsrc-dirinventory holds no supported source file,/req-referenceswrites a documented no-source placeholder directive intoREFERENCES.mdinstead of extracting references;/req-workflowbehaves the same forWORKFLOW.mdand completes without dispatching a prompt.- With
Auto git commit = enable(default), every prompt receives structured commit instructions and commits follow the message template<TYPE>(<COMPONENT>)<BREAKING>: <DESCRIPTION> [useReq]. WithAuto git commit = disable, prompts receive a read-only git restriction and worktree orchestration is forced off. - The extension never rewrites git history; destructive cleanup is limited to generated worktrees and branches: successful closure and command-side rollback remove only the run's own worktree, while
/req-wtdforce-removes the resolved target worktree and branch (see above).
- Each
Recommended practice:
- Review the changes produced by each command before pushing them.
- Do not use destructive commands (e.g.,
git reset --hard,git clean -fd) to "clean" the repository without verifying the impact; prefer/req-wtdfor worktree disposal after failed runs.
