Skip to content

feat(init): add --memory-provider mode for pi, claude, cursor - #577

Merged
ajianaz merged 3 commits into
developfrom
feat/pi-memory-provider
Jul 6, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/pi-memory-provider

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #575 — automatic memory-provider for non-Hermes agents.

Problem

uteke init --agent hermes --memory-provider gives automatic recall injection. But pi, claude, and cursor only install manual instructions — users must remember to call uteke recall/ uteke remember themselves.

Changes

Agent Mode What's installed
pi --memory-provider TypeScript extension at ~/.pi/agent/extensions/uteke-memory-provider/ — hooks before_agent_start to auto-inject relevant memories every turn. Includes slash commands: /uteke-recall, /uteke-save, /uteke-stats, /uteke-on, /uteke-off.
claude --memory-provider Enhanced UTEKE.md with auto-recall rules + MCP server config snippet. Updates CLAUDE.md with auto-recall reference.
cursor --memory-provider Enhanced .cursor/rules/uteke.mdc with auto-recall rules + MCP config snippet (alwaysApply: true).

New files

extensions/pi-memory-provider/
├── index.ts       # Pi TypeScript extension
└── package.json   # Manifest

Modified files

  • crates/uteke-cli/src/init.rs — updated run_init() dispatch + added init_pi_memory_provider(), init_claude_memory_provider(), init_cursor_memory_provider(). Added compile-time template guard tests.

Usage

uteke init --agent pi --memory-provider
uteke init --agent claude --memory-provider
uteke init --agent cursor --memory-provider

Without --memory-provider, behavior is unchanged (manual instructions only).

Test plan

  • cargo fmt --all -- --check passes
  • CI: check, fmt, clippy, test, build
  • Template guard tests: pi extension has before_agent_start hook

Adds automatic memory-provider integrations for non-Hermes agents,
mirroring the Hermes --memory-provider experience:

- pi: TypeScript extension (extensions/pi-memory-provider/) that hooks
  before_agent_start to auto-inject relevant memories every turn.
  Includes slash commands (/uteke-recall, /uteke-save, /uteke-stats,
  /uteke-on, /uteke-off).

- claude: Enhanced UTEKE.md with auto-recall rules + MCP server config
  snippet. Updates CLAUDE.md with auto-recall reference.

- cursor: Enhanced .cursor/rules/uteke.mdc with auto-recall rules +
  MCP server config snippet.

Updated run_init() dispatch to accept --memory-provider flag for all
agents. Added compile-time template guards (tests) for the pi extension.

Usage:
  uteke init --agent pi --memory-provider
  uteke init --agent claude --memory-provider
  uteke init --agent cursor --memory-provider
Comment thread crates/uteke-cli/src/init.rs Fixed
@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (4)

  • extensions/pi-memory-provider/index.ts:54 — runUteke builds a shell command with ${bin} ${args.join(" ")} and callers pass user-controlled values such as query and content wrapped only in quotes. A prompt or slash-command argument containing shell metacharacters can break out of the intended uteke command and execute arbitrary commands.
  • extensions/pi-memory-provider/index.ts:54 — execSync is called from async extension hooks and command handlers, including before_agent_start, with a 15 second timeout. This blocks the Node event loop before every agent turn and can make the extension or host UI appear hung while recall runs.
  • extensions/pi-memory-provider/index.ts:150 — /uteke-save calls runUteke(["remember", ...]) and always returns ✓ Memory saved.. Since runUteke catches all errors and returns an empty string, missing binaries, timeouts, or failed writes are silently reported as successful.
  • crates/uteke-cli/src/init.rs:307 — init_claude_memory_provider unconditionally writes UTEKE.md, and init_cursor_memory_provider similarly writes .cursor/rules/uteke.mdc. If either file already contains user-authored instructions, running init will replace them and can cause data loss.

Review powered by cora-cli · BYOK · MIT

Format string had literal { } which Rust interprets as format
placeholders. Escape with {{ }}.
Comment thread crates/uteke-cli/src/init.rs Fixed
Comment thread crates/uteke-cli/src/init.rs Fixed

## Auto-Recall Rule
**At the start of every task**, before asking the user, run:
```
try {
return execSync(`${bin} ${args.join(" ")}`, {
encoding: "utf-8",
timeout,
try {
return execSync(`${bin} ${args.join(" ")}`, {
encoding: "utf-8",
timeout,
return formatMemories(memories);
},
});

@ajianaz
ajianaz merged commit 8434868 into develop Jul 6, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/pi-memory-provider branch July 6, 2026 04:15
ajianaz added a commit that referenced this pull request Jul 16, 2026
The heading 'Memory-Provider for Other Agents (#575/#577)' produced a
confusing concatenated anchor #memory-provider-for-other-agents-575577.
Drop the issue refs from the heading (move into the body) so the anchor
becomes the clean #memory-provider-for-other-agents. Fixes CodeCora alert.

Verified via github-slugger: 0 broken links; no other file references the
old anchor.
ajianaz added a commit that referenced this pull request Aug 13, 2026
feat(init): add --memory-provider mode for pi, claude, cursor
ajianaz added a commit that referenced this pull request Aug 13, 2026
The heading 'Memory-Provider for Other Agents (#575/#577)' produced a
confusing concatenated anchor #memory-provider-for-other-agents-575577.
Drop the issue refs from the heading (move into the body) so the anchor
becomes the clean #memory-provider-for-other-agents. Fixes CodeCora alert.

Verified via github-slugger: 0 broken links; no other file references the
old anchor.
ajianaz added a commit that referenced this pull request Aug 29, 2026