9 Commits

Author SHA1 Message Date
shahondin1624 eb1063da28 add cross-agent memory extension
A pi extension for reading and writing persistent memory across agent systems.

Reads its own canonical store (project ./.pi/memory/ + user ~/.pi/memory/, typed
markdown with frontmatter — Claude's user/feedback/project/reference taxonomy)
AND other agents' memory verbatim (Claude CLAUDE.md + ~/.claude/projects/<slug>/
memory/, Copilot, AGENTS.md, GEMINI.md, Aider CONVENTIONS.md). Writes only ever
touch the canonical store; foreign files are never modified.

Surfaces: memory_read / memory_search / memory_write / memory_forget tools,
/memory-* commands, and a canonical index appended to the system prompt at
agent start.

Enum-valued args (type/scope/system) are lenient strings normalized in-tool
rather than anyOf/const unions: some local models emit const-union values
JSON-quoted (e.g. "\"feedback\""), which strict schema validation rejected
before the tool ran. normalizeEnumArg strips the stray quoting; memory_read by
name also falls back to a foreign file of that name.

store.ts / sources.ts import only Node built-ins so tests load them directly
under --experimental-strip-types. 31 unit tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 08:23:39 +02:00
shahondin1624 3876968bfa make llama.cpp base URL configurable via settings + document live-symlink dev setup
Resolve the local llama.cpp provider's server URL from LLAMA_BASE_URL env →
localLlama.baseUrl in settings.json → built-in default, reading settings inline
(node:fs) so the flat-copy test build stays self-contained. A PI_SETTINGS_PATH
override keeps the suite deterministic across hosts.

Document the live-development workflow of symlinking each extension dir AND
shared/ into ~/.pi/agent/extensions/, with a warning that a symlinked extension
paired with a stale copied shared/ silently loads the wrong helpers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 08:23:25 +02:00
Tobias Addicks 4dabc93ac1 reshape pi-extensions layout to match installed extensions 2026-05-18 22:21:48 +02:00
Tobias Addicks c44c12dd5d update readme 2026-05-17 23:02:42 +02:00
Tobias Addicks 01564df5be Refactor extension structure 2026-05-17 22:55:46 +02:00
shahondin1624 5a1d738892 feat(scripts): install-client.sh component selection + update-only mode
Two new top-level flags:

  --components LIST     Comma-separated subset of:
                        certs, ssh, ai-server, dark-mechanicus, themes,
                        local-llama, ai-complete, shared, all
                        Default: all (matches previous behavior).
                        'shared' is auto-added when 'dark-mechanicus' is
                        selected (it imports from ../shared/).

  --update-only         Non-destructive: rsync with --ignore-existing, so
                        no file in $PI_DIR gets replaced. Add only.
                        Useful after a 'git pull' when you have local
                        edits in ~/.pi/agent/extensions/.

Three new components added to the rsync set:

  dark-mechanicus       The new theme TUI bundle (banner, footer, etc.).
                        Wasn't synced before because the legacy script
                        only copied ai-server/ + local-llama.ts.
  shared                Shared TS utils that dark-mechanicus imports.
                        Auto-included whenever dark-mechanicus is.
  ai-complete           Standalone shell CLI; installed to
                        --ai-complete-dir (default ~/bin/) and PATH'd
                        via .bashrc/.zshrc if missing.

Backward-compat:
  --no-certs / --no-ssh-setup still work (translated to component
  removal). --force still controls cert overwriting.

Cert handling unchanged in spirit: certs are NEVER overwritten unless
--force is passed, regardless of --update-only. (A working client
identity is more valuable than a fresh one.)

Verification step (mTLS /health probe) skipped if certs weren't part
of this run, or via new --skip-verify.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:55:06 +02:00
shahondin1624 4968c44f2c refactor: group dark-mechanicus theme files into a folder
Seven loose root-level .ts files were the dark-mechanicus theme bundle:
indicator, banner, footer, status-line, session-names, thinking-label,
and markdown-body-color. They share visual language with
themes/dark-mechanicus.json and only make sense together.

Moved them under dark-mechanicus/ as a multi-file extension. The
pi-coding-agent loader auto-discovers <subdir>/index.ts as a single
extension entry, so dark-mechanicus/index.ts now sequences each
sub-module's default registrar.

File renames also drop the redundant 'mechanicus-' / 'dark-mechanicus-'
prefix since the directory name carries it. Symbol names, command names,
and external behavior are unchanged — disabling each piece still works
via its own /<name>-off command.

Imports inside each moved file: ./shared/ → ../shared/.

local-llama.ts stays at the root — separate stub provider, not part of
the theme.

.gitignore updated: 8 individual !/<file>.ts allowlist entries replaced
with a single !/dark-mechanicus/.

README.md: theme entries collapsed into one row pointing at the folder;
tree diagram updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:50:19 +02:00
shahondin1624 2a8a3e8e22 feat(scripts): add ai-complete CLI for direct llama-server router access
Minimal shell wrapper around llama.cpp router's OpenAI-compatible API
(/v1/chat/completions), gated by the same mTLS cert as the pi extension.
Single-file, runtime deps: bash + curl + jq. Useful for scripts and agents
(Claude Code, etc.) that want to delegate generation without pulling in
a full SDK.

Features:
  --list / --status / --load <model>
  --stream <model> "..." for SSE token-stream output
  --raw <model> '...'    for full openai-format json bodies (also @file)
  --prompt-file <path>   reads prompt from disk via jq --rawfile, bypassing
                         Linux's MAX_ARG_STRLEN (~128KB per argv) so prompts
                         up to the model's context window work
  --temperature / --top-p / --max-tokens / --system  sampling overrides
  Auto-retry with exponential backoff on transient empty/non-JSON
  responses (model-loading window). Short-circuits on structured 4xx
  errors (e.g. exceed_context_size).

AI_CERT_DIR / AI_ENDPOINT / AI_RETRIES env overrides.

Includes scripts/AI-COMPLETE.md with install + usage docs and a row in
the top-level README's scripts table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:43:34 +02:00
shahondin1624 24c9a92a62 Add top-level README
Lists every extension, the theme, setup scripts, tests, a quick
onboarding section, and a repo layout diagram. Links each extension
to its source file. Specifically notes the deferred stream-parsing
tests and the reason (mock HTTPS harness not worth it for single-user
deployment).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 23:45:47 +02:00