Codex

memory-query-capture

Capture query synthesis as durable pages in semantic memory

104 stars

Best use case

memory-query-capture is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

It is a strong fit for teams already working in Codex.

Capture query synthesis as durable pages in semantic memory

Teams using memory-query-capture should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/memory-query-capture/SKILL.md --create-dirs "https://raw.githubusercontent.com/jmagly/aiwg/main/.agents/skills/memory-query-capture/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/memory-query-capture/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How memory-query-capture Compares

Feature / Agentmemory-query-captureStandard Approach
Platform SupportCodexLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Capture query synthesis as durable pages in semantic memory

Which AI agents support this skill?

This skill is designed for Codex.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# memory-query-capture

Capture valuable assistant synthesis from conversation into durable semantic memory pages. This is the compounding primitive — explorations accumulate as reusable knowledge rather than evaporating into chat history.

## When to Use

Any time an assistant response produces analytical output worth preserving: comparisons, gap analyses, architectural assessments, synthesis narratives. Invoked explicitly by the user, suggested ambiently by the system, or chained automatically by other skills.

## Parameters

### --consumer (optional)
Consumer ID to write against. Resolved via ADR-021 D4 precedence: explicit > wrapper > auto-detect.

### --type (optional)
Page type: `synthesis`, `comparison`, `analysis`, or `gap`. If omitted, determined by heuristic or user prompt.

### --title (optional)
Page title. If omitted, derived from content via headline extraction or summarization.

## Invocation Modes

### Ambient mode
Suggested automatically when a query response exceeds a length/value threshold. The system presents a capture prompt; the user confirms or dismisses.

### Explicit mode
User invokes directly: "save this as a page", "capture that comparison", or calls `memory-query-capture` with parameters.

### Skill-chain mode
Any skill can call `memory-query-capture` as a final step after producing analytical output. The calling skill passes `--type` and `--title` to skip heuristics.

## Operation

1. **Capture synthesis** — extract the last assistant synthesis from conversation state.
2. **Determine page type** — from `--type` flag, content heuristic, or user prompt.
3. **Resolve consumer** — determine target consumer via ADR-021 D4 precedence (explicit > wrapper > auto-detect).
4. **Resolve destination** — read `memory.topology.derivedPages` from consumer's `manifest.json` and select the matching subdirectory (`derivedPages.synthesis`, `derivedPages.comparison`, etc.).
5. **Title the page** — from `--title` flag or derived from content (first heading, key noun phrase, or summarized label).
6. **Add cross-references** — identify source pages cited in the synthesis and insert cross-reference links per the consumer's `crossRefStyle` setting.
7. **Write page** — create the Markdown file at the resolved destination path.
8. **Update index and log** — call `memory-log-append` with `--op query-capture` and metadata about the captured page.
9. **Mark provenance** (optional) — record query origin, model actor, and sources cited in a provenance block at the end of the page.

## Page-Type Heuristics

When `--type` is not provided, the skill inspects the synthesis content:

| Content pattern | Assigned type |
|-----------------|---------------|
| Comparison table, side-by-side columns | `comparison` |
| Narrative prose with connective reasoning | `synthesis` |
| Gap analysis, missing coverage, "what's absent" | `gap` |
| Bullet-point assessment, evaluation criteria | `analysis` |

If the heuristic is ambiguous, prompt the user to select.

## Consumer Resolution

Follows ADR-021 D4 precedence:

1. **Explicit** — `--consumer` flag provided on invocation.
2. **Wrapper** — a parent skill passes consumer context down the chain.
3. **Auto-detect** — inspect `.aiwg/frameworks/registry.json` for the active consumer with a `memory.topology` contract.

If no consumer can be resolved, abort with a clear error requesting `--consumer`.

## Cross-Reference Style

The consumer's `manifest.json` declares a `crossRefStyle` — one of:

- `wikilink` — `[[page-name]]`
- `markdown` — `[page name](relative/path.md)`
- `at-mention` — `@consumer/path/to/page.md`

The skill reads this setting and formats all source-page links accordingly.

## Error Handling

- If no synthesis content is available in conversation state, report "nothing to capture" and exit.
- If the destination directory does not exist, create it before writing.
- Log write failures via `memory-log-append` are **non-blocking** — the page write is the primary operation.
- If consumer topology lacks a `derivedPages` mapping for the resolved type, fall back to the consumer's base memory directory.

## Schema Reference

@semantic-memory/schemas/memory-log-event.md

## Examples

```
# Explicit capture after a deep comparison
memory-query-capture --consumer research-complete --type comparison --title "Redis vs Valkey feature matrix"

# Ambient capture (system-suggested, user confirms)
> Your comparison of caching strategies looks worth preserving. Capture as a page? [Y/n]
memory-query-capture --type synthesis

# Skill-chain: architecture-evolution calls capture after producing assessment
memory-query-capture --consumer sdlc-complete --type analysis --title "Microservices migration readiness"
```

Related Skills

rlm-query

104
from jmagly/aiwg

Spawn sub-agent to process focused context and return structured result

Codex

research-query

104
from jmagly/aiwg

Search the local research corpus, read matching findings, and synthesize an answer with inline citations to REF-XXX sources. The "query" operation for the research pipeline.

Codex

ralph-memory

104
from jmagly/aiwg

Manage Al semantic memory entries — list, query, and clear lessons learned across loop iterations

Codex

provenance-query

104
from jmagly/aiwg

Query provenance chains to trace artifact derivation and impact

Codex

memory-log-render

104
from jmagly/aiwg

Generate a human-readable Markdown view from a consumer's JSON Lines event log

Codex

memory-log-append

104
from jmagly/aiwg

Append a structured event to a consumer's semantic memory log

Codex

memory-ingest

104
from jmagly/aiwg

Ingest a source into any consumer's semantic memory by reading the topology contract

Codex

memory-forensics

104
from jmagly/aiwg

Volatility 3 memory forensics workflows covering acquisition with LiME and WinPmem, and structured analysis using Volatility 3 plugin reference

Codex

debug-memory

104
from jmagly/aiwg

Query and manage the executable feedback debug memory

Codex

aiwg-orchestrate

104
from jmagly/aiwg

Route structured artifact work to AIWG workflows via MCP with zero parent context cost

venv-manager

104
from jmagly/aiwg

Create, manage, and validate Python virtual environments. Use for project isolation and dependency management.

pytest-runner

104
from jmagly/aiwg

Execute Python tests with pytest, supporting fixtures, markers, coverage, and parallel execution. Use for Python test automation.