Arnie016/codex-prompt-templates / skills/auto-skill-build-memsearch-codex-memory
auto-skill-build-memsearch-codex-memory
VerifiedUse memsearch as an on-demand semantic index for project markdown memory (search → expand → optional deep drill). Use when the user asks to recall past decisions, prior debugging, or “have we seen this before?” and a `.memsearch/memory/` store exists (or the user wants to set one up). Skip when the question is only about current code state (use Read/Grep) or when the user explicitly does not want semantic indexing / installs.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.8 KB |
SKILL.md
View on GitHub---
name: auto-skill-build-memsearch-codex-memory
description: >
Use memsearch as an on-demand semantic index for project markdown memory
(search → expand → optional deep drill). Use when the user asks to recall past
decisions, prior debugging, or “have we seen this before?” and a
`.memsearch/memory/` store exists (or the user wants to set one up). Skip when
the question is only about current code state (use Read/Grep) or when the
user explicitly does not want semantic indexing / installs.
---
# memsearch + Codex memory recall (on-demand)
Generated by: Codex Supercharge maintenance automation.
This skill is for manual recall using the `memsearch` CLI. It does **not**
install hooks or run upstream installers.
Reference notes: `references/memsearch-codex-memory.md`.
## Preconditions
- Prefer `.memsearch/memory/` if it exists.
- If there is no `.memsearch/memory/`, fall back to `$agent-memory-ledger` and
`rg` across `.codex-memory/`.
- If `memsearch` is not installed, stop and ask the user whether they want to
install it. Do not run `curl | sh` installers.
## Workflow
1. Confirm the memory store location:
- `PROJECT_ROOT/.memsearch/memory/` (preferred)
- otherwise `.codex-memory/` + `rg` fallback
2. Derive a stable project collection, then index memory when needed:
```bash
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
COLLECTION="$(plugins/codex-supercharge/scripts/derive_memsearch_collection.sh "$PROJECT_ROOT")"
memsearch index "$PROJECT_ROOT/.memsearch/memory" --collection "$COLLECTION"
```
If indexing fails because the ONNX embedding model needs a first-run download,
either:
- temporarily allow network access, or
- switch to a provider you already have configured (high-trust only).
3. Search for relevant chunks and expand the best hit:
```bash
memsearch search "<query>" --top-k 5 --json-output --collection "$COLLECTION"
memsearch expand <chunk_hash> --collection "$COLLECTION"
```
4. If `expand` fails, read the source file directly using the `source` and
line-range fields from JSON output:
```bash
sed -n '<start_line>,<end_line>p' "<source>"
```
5. Return a curated summary:
- focus on decisions, constraints, prior fixes, and “why”
- cite the memory file/date (and heading if present)
- if nothing relevant: say so, and propose a tighter query
## Skip when
- The task is purely about the current repo state (prefer Read/Grep/tests).
- The user asked to ignore memory or avoid semantic tools.
- There is no `.memsearch/memory/` and the user does not want to create one.
## Validation
- If `memsearch` exists: `memsearch --version` and a dry run search against a
small collection.
- Otherwise: ensure the fallback path uses `$agent-memory-ledger` + `rg`.
- Validate the helper with
`plugins/codex-supercharge/scripts/derive_memsearch_collection.sh "$PWD"`.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |