feat(pi): add local skills and file-backed prompts - #1
Merged
Merged
Conversation
AnonymousMorris
added a commit
that referenced
this pull request
Sep 15, 2026
Load explicitly configured local skills independently of discovery, preserving literal path characters and expanding only a leading ~/. Compose appended system prompts from text and files at each session startup. Pass prompt text through private temporary files to support large inputs and preserve filename-like text, with cleanup on exit, cancellation, and failure. Cover prompt delivery, file ownership, cleanup, and failure paths with E2E tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Validate and push the completed changes to the existing open PR #1 on feat/local-skills-and-prompts, then check CI and any other issues. The user explicitly chose temporary prompt files before pushing, superseding the earlier error-only approach. Nonempty composed appended prompts must be written to private per-session temporary files and passed to Pi as short absolute paths, so large prompts start and text equal to an existing filename stays literal. Preserve configured text before file contents, list order, startup-time file reads, and Ctrl-N rereading. Large literal system_prompt text also uses a temp file; preserve the separate system_prompt option existing explicit-file semantics and never delete user-owned source files. Create prompt files exclusively with owner-only permissions, handle short writes and creation/write/close failures, and clean resources on normal exit, cancellation, or failed startup before callbacks can interrupt cleanup. Keep the current session if replacement startup fails. Command inspection must not create files; custom cmd overrides and absent/empty prompts must not allocate them. Preserve raw unrelated startup errors. Do not restore obsolete prompt-size guesses or misleading E2BIG attribution. Preserve selectable local skills independently of discovery and the previous review fix that expands only leading home tilde while keeping other skill path characters literal. All prior pipeline fix commits are retained. Local verification passed all 11 E2E suites, including actual oversized prompts, permissions, cleanup, injected file failures, short writes, and session replacement. Real Pi startup checks confirmed successful large prompts and literal filename-like contents without making model requests. Review the final implementation, update the existing PR description to match it, push if checks pass, and check CI. Do not merge or create a replacement PR. Do not manually modify CHANGELOG.md or autogenerated files, and do not add agent co-authors to commits.
What Changed
skill_pathsfor loading local skill files or directories independently of Pi skill discovery, with expansion limited to a leading~/.append_system_prompt_filepathand compose literal prompt text before file contents in configured order, reading files at each session startup.system_promptvalues through owner-only temporary files, while preserving explicit prompt files and cleaning temporary files after exit, cancellation, or failed startup.Risk Assessment
✅ Low: The prompt-file lifecycle is well bounded, cleanup precedes callbacks, failures preserve the active session, and the source satisfies the stated prompt and skill-path requirements.
Testing
The supplied baseline reported all 11 E2E suites passing. This phase reran the three focused suites and performed three manual end-to-end checks through
:AI, including an installed Pi 0.85.1 startup without a model request. The first observer attempt had an incorrect trailing-newline expectation in the temporary test harness; it was corrected and passed. Evidence logs record exact delivered sizes and hashes, mode 0600 permissions, ownership, error, and cleanup behavior. No screenshot was needed because this change affects backend process arguments and file lifecycle, not rendered UI. The worktree is clean and no test processes or temporary data remain.Evidence: Observed :AI prompt delivery
Evidence: Real Pi startup without model request
Evidence: Prompt resource lifecycle
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
nvim --headless -u NONE -l tests/prompts_e2e.luanvim --headless -u NONE -l tests/pi_command_e2e.luanvim --headless -u NONE -l tests/config_e2e.luanvim --headless -u NONE -l /dev/stdinwith a subprocess observer for prompt bytes, hashes, permissions, ordering, literal paths, skills, and normal-exit cleanupnvim --headless -u NONE -l /dev/stdinagainst Pi 0.85.1 for actual large-prompt startup and cancellation cleanup without a model requestnvim --headless -u NONE -l /dev/stdinfor explicit system-file ownership, cleanup-before-callback ordering, inspection and override allocation behavior, empty prompts, and failed-start cleanupPost-test hygiene check withgit status --short, targeted temporary-directory scan, and process scan✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.