a lot of meow
This commit is contained in:
+52
-165
@@ -9,94 +9,13 @@
|
||||
homeManager =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
sops = {
|
||||
secrets.scug-io-ai-key = {
|
||||
# sopsFile = ./secrets.yaml;
|
||||
# Decrypted file path (available at runtime, not eval time)
|
||||
path = config.home.homeDirectory + "/.secrets/scug_io_api_key";
|
||||
sopsFile = ../secrets/content/secrets.yaml;
|
||||
};
|
||||
secrets.opencode-go-zen-key = {
|
||||
# sopsFile = ./secrets.yaml;
|
||||
# Decrypted file path (available at runtime, not eval time)
|
||||
path = config.home.homeDirectory + "/.secrets/opencode-go-zen-key";
|
||||
sopsFile = ../secrets/content/secrets.yaml;
|
||||
};
|
||||
};
|
||||
programs.fish = {
|
||||
shellInit = ''
|
||||
if test -f "$HOME/.secrets/scug_io_api_key"
|
||||
set -x SCUG_IO_API_KEY (cat "$HOME/.secrets/scug_io_api_key")
|
||||
end
|
||||
if test -f "$HOME/.secrets/opencode-go-zen-key"
|
||||
set -x OPENCODE_GO_API_KEY (cat "$HOME/.secrets/opencode-go-zen-key")
|
||||
end
|
||||
set -x PI_LENS_STARTUP_MODE quick
|
||||
'';
|
||||
};
|
||||
programs.pi-coding-agent = {
|
||||
enable = true;
|
||||
extraPackages = [
|
||||
pkgs.nodejs
|
||||
# pkgs.lean-lsp-mcp
|
||||
];
|
||||
# package = pkgs.pi-coding-agent.overrideAttrs (
|
||||
# new: old: {
|
||||
# version = "0.81.1";
|
||||
#
|
||||
# src = pkgs.fetchFromGitHub {
|
||||
# owner = "earendil-works";
|
||||
# repo = "pi";
|
||||
# tag = "v${new.version}";
|
||||
# hash = "sha256-xo3uoR7HceOCL3wqoMcacOe8WXP1o7ReAXne5t6Hgao=";
|
||||
# };
|
||||
#
|
||||
# npmDepsHash = "sha256-lzKQZbnITzgV9koucsMno6f61ubBLYUcwQEXtak1r1s=";
|
||||
# # npmDepsHash = pkgs.lib.fakeHash;
|
||||
#
|
||||
# # npmDepsHash = "sha256-lDoj/94tjJd4ZGU9WgrMOqNSmdpeCljU4c6jGX+TSDY=";
|
||||
#
|
||||
# npmDeps = pkgs.fetchNpmDeps {
|
||||
# inherit (new) src;
|
||||
# name = "pi-coding-agent-0.81.1-npm-deps";
|
||||
# hash = new.npmDepsHash;
|
||||
# };
|
||||
# modelData = pkgs.fetchurl {
|
||||
# url = "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-${new.version}.tgz";
|
||||
# hash = "sha256-x53MD5DU370ZdNoz36P+OWZjGVpoM5sfVcEU2/ckDy8=";
|
||||
# # hash = pkgs.lib.fakeHash;
|
||||
# };
|
||||
# preConfigure = ''
|
||||
# mkdir -p packages/ai/src/providers/data
|
||||
# tar --extract --gzip --file=${new.modelData} \
|
||||
# --directory=packages/ai/src/providers/data \
|
||||
# --strip-components=4 \
|
||||
# package/dist/providers/data
|
||||
# '';
|
||||
# passthru.updateScript = pkgs.nix-update-script {
|
||||
# extraArgs = [
|
||||
# "--custom-dep"
|
||||
# "modelData"
|
||||
# ];
|
||||
# };
|
||||
# }
|
||||
# );
|
||||
settings = {
|
||||
"openrouter" = {
|
||||
"compat" = {
|
||||
"sendSessionAffinityHeaders" = true;
|
||||
};
|
||||
};
|
||||
"providers" = {
|
||||
"opencode-go" = {
|
||||
# "type" = "api_key";
|
||||
# "apiKey" = "$OPENCODE_GO_API_KEY";
|
||||
"compat" = {
|
||||
"supportsLongCacheRetention" = true;
|
||||
"sendSessionAffinityHeaders" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
"litellm" = {
|
||||
"providers" = {
|
||||
"litellm" = {
|
||||
@@ -122,34 +41,21 @@
|
||||
"showCacheMissNotices" = true;
|
||||
"vstack" = {
|
||||
"extensionManager" = {
|
||||
"config" = {
|
||||
"@vanillagreen/pi-qol" = {
|
||||
"statusline.enabled" = false;
|
||||
"showSessionNameTitle" = false;
|
||||
"permissionGate" = {
|
||||
"enabled" = true;
|
||||
"commands" = "rm -Rf,rm -rf,sudo,chmod,chown,mkfs,dd,shutdown,reboot,poweroff";
|
||||
"previewLines" = 12;
|
||||
"previewChars" = 1200;
|
||||
};
|
||||
"thinkingLabel" = {
|
||||
"text" = "🧠";
|
||||
"showTimer" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
"config" = { };
|
||||
};
|
||||
};
|
||||
packages = [
|
||||
# "npm:@odinlayer/pi-provider-litellm"
|
||||
"npm:pi-provider-litellm"
|
||||
# "npm:pi-web-access"
|
||||
# Web search / content extraction (opencode-crawlberg + opencode-html-to-markdown equivalent)
|
||||
"npm:pi-web-access"
|
||||
# Local document parsing / OCR (opencode-xberg equivalent)
|
||||
"npm:pi-docparser"
|
||||
# "npm:@gotgenes/pi-permission-system"
|
||||
"npm:@vanillagreen/pi-extension-manager"
|
||||
# "npm:@vanillagreen/pi-qol"
|
||||
"npm:pi-vitals"
|
||||
"npm:pi-spark"
|
||||
"npm:@zhushanwen/pi-context-engineering"
|
||||
"npm:pi-caveman"
|
||||
"npm:@tmustier/pi-usage-extension"
|
||||
"npm:@heyhuynhgiabuu/pi-pretty"
|
||||
@@ -157,63 +63,27 @@
|
||||
# "npm:pi-lean-ctx"
|
||||
# "npm:@rohaquinlop/pi-deepseek-cache"
|
||||
"npm:pi-cache-optimizer"
|
||||
"npm:pi-opencode-go-cache"
|
||||
];
|
||||
};
|
||||
context = ''
|
||||
[CORE TOOLING DOCTRINE — OBEY WITHOUT EXCEPTION]
|
||||
|
||||
[FILE OPERATIONS]
|
||||
- `read` (supports .nix, .ts, .js, .json, .yaml, .yml, .md, .html, .css, .sh, .bash, .c, .h, .rs, .go, .py, .rb, .lua, .toml, .cfg, .ini, .xml, .wasm, .wat, .wat, .webp, .bmp, .jpg, .png, .gif, .svg, .png, .ttf, .woff, .woff2): reads file content, truncates at 2000 lines / 50KB. Use offset/limit for large files. For images returns attachment. For text returns content.
|
||||
- `write` (supports any path): creates file if missing, overwrites if exists. Auto-creates parent dirs. Use for new files or full rewrites.
|
||||
- `edit` (supports any path): precise text replacement. Every edits[].oldText must match a unique, non-overlapping region. Merge nearby changes into single edit. Do NOT include large unchanged regions just to connect distant edits. Prefer smallest possible oldText for uniqueness.
|
||||
- NEVER use `cat`, `echo`, `tee`, `sed -i`, `head`, `tail` for file content. These bypass the dispatch pipeline and lose context.
|
||||
- NEVER use `find` on the nix store. It is DANGEROUS AND EVIL — walks /nix/store with no pruning. Use `ls` on known store paths, `grep`, `symbol_search`, or `module_report` instead.
|
||||
|
||||
[TEXT SEARCH]
|
||||
- `rg` (ripgrep) for pattern matching in files. Flags: `-n` (line numbers), `-u` (respect .gitignore, default), `-i` (case-insensitive), `--no-heading` (suppress filename prefix).
|
||||
- NEVER combine `find` + `xargs grep` or `find` + `ls` + `grep`. `rg` is always available and respects .gitignore.
|
||||
- For glob-based file discovery: use `find` (the tool) with patterns like `*.ts`, `**/*.json`. This is fine — `find` is the file-system tool, not the nix-store walker.
|
||||
- For content search across files: `grep` with optional glob filter (e.g. `grep -rn "pattern" --glob="*.rs"`).
|
||||
|
||||
[CODE NAVIGATION]
|
||||
- `symbol_search`: ranked BM25 identifier search over persisted word index. Answers "which files are relevant to <query>". Pair with `module_report` for file outline and `read_symbol` for symbol body.
|
||||
- `module_report`: structured file outline — returns each symbol's name/kind/signature/line-range, who-uses-this, risk flags, recommendedReads. Pass `blastRadius: true` for transitive dependents.
|
||||
- `read_enclosing`: smallest enclosing symbol/callback for a given line. Use after `ast_grep_search`, diagnostics, or LSP locations when you need exact body without reading whole file.
|
||||
- `lsp_diagnostics`: LSP-level errors/warnings/hints. Use BEFORE building. Supports paths (file or directory), severity filter, concurrency control.
|
||||
- NEVER use `find` + manual parsing for code navigation. Always use symbol_search/module_report/read_symbol first.
|
||||
|
||||
[DIAGNOSTICS]
|
||||
- `lens_diagnostics` (default: mode=delta, current turn's fixable warnings): fast, current-turn only. Use for "what needs fixing right now?"
|
||||
- `lens_diagnostics` (mode=all): session diagnostics for ALL files edited this session. Shows blocking errors with messages, not just counts. Unedited files with pre-existing errors DO NOT appear.
|
||||
- `lens_diagnostics` (mode=full): expensive project-wide LSP scan + cached runner diagnostics. Use before declaring work done. Bounded by slowest analyzer (~180s ceiling for trivy).
|
||||
- `lsp_diagnostics`: LSP-only diagnostics. Use before builds to proactively catch type errors.
|
||||
- NEVER use `grep` + manual diagnostic interpretation. Always route through lens_diagnostics/lsp_diagnostics.
|
||||
|
||||
[SHARED TOOLS]
|
||||
- `recall_context(id)`: recall original content compressed by context engineering. Use when full content of expired/truncated/condensed tool result is needed.
|
||||
- `bash`: execute shell commands. For text search: `rg -n`. For text extraction: `rg --output-format json`. For file operations: prefer `read`/`write`/`edit`. For system commands: git, nix, builds, scripts, network.
|
||||
- `bash` with `timeout`: set timeout for long-running operations. Use for builds, nix operations, network requests.
|
||||
|
||||
[BEHAVIORAL CONSTRAINTS]
|
||||
- Always prefer `read`/`write`/`edit` over any raw shell equivalent for file operations.
|
||||
- Always prefer `rg` over `find` + `grep` for text search.
|
||||
- Always prefer `symbol_search`/`module_report` over `find` + manual parsing for code navigation.
|
||||
- Always prefer `lens_diagnostics`/`lsp_diagnostics` over `grep` + manual diagnostic interpretation.
|
||||
- Use `bash` ONLY for commands that genuinely need a shell (git, nix, builds, scripts, network, system management).
|
||||
- When editing files, always use `edit` (not `write` with partial content). `edit` is precise and tracks what changed.
|
||||
- When creating new files or doing full rewrites, use `write`.
|
||||
- When searching file contents, always use `grep`.
|
||||
- When running builds, always check `lsp_diagnostics`/`lens_diagnostics` first.
|
||||
- When declaring work done, always run `lens_diagnostics mode=full` to verify no blocking errors remain.
|
||||
- When context is expired/truncated/condensed, use `recall_context(id)` to recover full content.
|
||||
- When reading large files, use offset/limit to navigate — never read entire 10000+ line files.
|
||||
|
||||
[CRITICAL RULES]
|
||||
- NEVER use `find` on the nix store (/nix/store/*). It is DANGEROUS AND EVIL — extremely expensive, slow, locks up execution.
|
||||
- Use `ls` on known store paths. Use `grep`, `symbol_search`, or `module_report` for discovery.
|
||||
- If you need to discover something, ask the user for the path rather than guessing.
|
||||
- This rule is ABSOLUTE. No exceptions. No edge cases.
|
||||
'';
|
||||
Core Directive: precise execution, strict safety, long-term solutions.
|
||||
1. Standards: hard fail unless overridden; files <=300 lines (refactor if exceeded); no hardcoding — config/env/consts only; no defaults — fail on missing config; no legacy/shims/auto-migrations, assume clean state; root fixes only, no cosmetic patches (report unrelated bugs).
|
||||
2. Safety: never run destructive ops (rm, reset --hard, deletions) without explicit prior approval; respect sandbox mode (ro/write), request approval if blocked; new code = creative, existing code = minimal deltas (no style/rename drift).
|
||||
3. Tools: todowrite for multi-step — exactly one in_progress, update on completion; rg for search; outputs truncated (~256 lines/10KB), read large files in chunks (<250 lines); edit = trust tool, no re-read, no added headers/comments; build/test/lint before yielding, yield only after todowrite done.
|
||||
4. Communication: AGENTS.md governs — deepest file wins, user prompt overrides; 1-sentence next-action preamble before any tool call; final output GFM with clickable file refs (src/main.ts:50), no file://, technical/dense/impersonal.
|
||||
|
||||
[CORE TOOLING DOCTRINE]
|
||||
- Files: read truncates at 2000 lines/50KB (use offset/limit); write creates/overwrites/auto-parents; edit = smallest unique oldText, merge nearby, never include huge unchanged regions. Never cat/echo/tee/sed -i/head/tail for file content.
|
||||
- Search: rg -n for text; grep tool (glob filter) for content; find tool for glob discovery only.
|
||||
- Navigation: symbol_search → module_report → read_symbol/read_enclosing; never find + manual parsing.
|
||||
- Diagnostics: lens_diagnostics (delta=this turn, all=session, full=project-wide before done); lsp_diagnostics before builds.
|
||||
- Context: recall_context(id) to recover compressed/expired/truncated content.
|
||||
- bash: only for git/nix/builds/scripts/network/system mgmt; set timeout for long ops.
|
||||
- CRITICAL: never find on /nix/store — unpruned walk locks up execution; ls known paths, ask user for unknown paths. ABSOLUTE.
|
||||
- You have a web-search tool. Use it sparingly but reach for it in situations where info isnt directly known. (i.e, "common problem" -> get from memory, think hard if needed, "hard problem that isnt in your training data or request for you to read docs for a lib or program" -> search online)
|
||||
- Searching for anything (including with wildcards ("/nix/store/*/**" or others)) isnt permitted at all. You must find paths inside the project, such a result/
|
||||
'';
|
||||
};
|
||||
|
||||
# pi-vitals config
|
||||
@@ -293,6 +163,10 @@
|
||||
"type" = "api_key";
|
||||
"key" = "$OPENCODE_GO_API_KEY";
|
||||
};
|
||||
"opencode" = {
|
||||
"type" = "api_key";
|
||||
"key" = "$OPENCODE_GO_API_KEY";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -303,13 +177,37 @@
|
||||
"opencode-go" = {
|
||||
compat = {
|
||||
supportsLongCacheRetention = true;
|
||||
# sendSessionAffinityHeaders = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Restrict providers to a subset of their built-in models.
|
||||
# Filter config: ~/.pi/agent/model-filters.json (see below).
|
||||
home.file.".pi/agent/extensions/model-filter.ts" = {
|
||||
source = ./model-filter.ts;
|
||||
};
|
||||
|
||||
# Model filter config: per-provider filters applied by model-filter.ts
|
||||
home.file.".pi/agent/model-filters.json" = {
|
||||
text = builtins.toJSON {
|
||||
providers = {
|
||||
# opencode: only free models (all cost zero)
|
||||
opencode = {
|
||||
freeOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# pi-web-access config: raw results, no curator / no AI summarising
|
||||
home.file.".pi/web-search.json" = {
|
||||
text = builtins.toJSON {
|
||||
workflow = "none";
|
||||
};
|
||||
};
|
||||
|
||||
# pi-spark config
|
||||
home.file.".pi/agent/spark.json" = {
|
||||
text = builtins.toJSON {
|
||||
@@ -334,17 +232,6 @@
|
||||
thinkingLevel = "medium";
|
||||
};
|
||||
};
|
||||
recap = {
|
||||
idle = "5m";
|
||||
provider = "openai-codex";
|
||||
model = "gpt-5.4-mini";
|
||||
thinkingLevel = "off";
|
||||
};
|
||||
title = {
|
||||
provider = "openai-codex";
|
||||
model = "gpt-5.4-mini";
|
||||
thinkingLevel = "off";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user