← Browse

@d-o-hub/memory-harness

A

Universal agent memory harness — record, replay, and benchmark real agent sessions. Use when testing memory system learning, generating test fixtures, or benchmarking CLI performance.

skillclaude

Install

agr install @d-o-hub/memory-harness --target claude

Writes 4 files into .claude/skills/, pinned to git-7a123218.

  • .claude/skills/memory-harness/SKILL.md
  • .claude/skills/memory-harness/evaluate-learning.sh
  • .claude/skills/memory-harness/export-fixtures.sh
  • .claude/skills/memory-harness/replay-trace.sh

Document


name: memory-harness description: "Universal agent memory harness — record, replay, and benchmark real agent sessions. Use when testing memory system learning, generating test fixtures, or benchmarking CLI performance." version: "1.0" category: testing

Memory Harness

Record, replay, and benchmark real agent sessions against do-memory-cli.

Modes

ModePurposeCommand
recordCapture live session as JSON traceDuring normal agent work
replayReplay traces, measure latencyCI, benchmarking
evaluateRun N traces, measure learningQuality gates

Record Mode

# Create trace file
TRACE_DIR=".memory-traces"
mkdir -p "$TRACE_DIR"
TRACE_FILE="$TRACE_DIR/$(date +%Y%m%d-%H%M%S)-$(echo "$TASK" | tr ' ' '-' | head -c 40).json"

# Create episode via CLI
EPISODE_ID=$(do-memory-cli --format json episode create --task "$TASK" --domain "$DOMAIN" 2>/dev/null | jq -r '.id')

# Write trace header
echo '{"version":"1.0","episode_id":"'$EPISODE_ID'","steps":[]}' > "$TRACE_FILE"

# Log steps (after each tool use)
do-memory-cli episode log-step "$EPISODE_ID" --tool "$TOOL" --action "$ACTION" --latency-ms "$MS" --success

# Complete episode
do-memory-cli episode complete "$EPISODE_ID" success

Replay Mode

# Single trace replay (script in skill directory)
bash .agents/skills/memory-harness/replay-trace.sh "$TRACE"

# All traces
for trace in .memory-traces/*.json; do bash replay-trace.sh "$trace"; done

Evaluate Mode

Measure learning effectiveness over N episodes:

  • Pattern count should increase with more data
  • Search latency should stay <100ms
  • Retrieval relevance should improve

Tools to Record

ToolRecord As
Readread
Grepgrep
Editedit
Bash (cargo test)test
Bash (cargo build)build
Bash (git)git

Trace Format

{
  "version": "1.0",
  "episode_id": "...",
  "steps": [{"tool":"read","action":"...","latency_ms":12,"success":true}]
}

Performance Targets

OperationTarget
Episode create< 50ms
Step logging< 20ms
Episode complete< 500ms
Search (100 episodes)< 100ms

Trustgrade A

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • passLicense

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-7a12321885552026-07-31