Skip to content

Latest commit

 

History

History
185 lines (129 loc) · 3.59 KB

File metadata and controls

185 lines (129 loc) · 3.59 KB

CLI Guide - Copilot Memory Store

Interactive command-line interface for managing your memory store.

Prefer a GUI? Use the Memory agent in VS Code for natural language interaction with GitHub Copilot.

Starting the CLI

npm run dev

You'll see:

Loaded 0 memories
Type "help" for available commands, "exit" to quit.

memory>

Commands Reference

add - Store a Memory

Memories are automatically indexed with extracted keywords for better search.

# Basic usage
add I prefer TypeScript over JavaScript for large projects

# With tags for organization
add --tags preference,language I prefer TypeScript over JavaScript

# Multi-word with quotes
add --tags architecture,decision "We chose PostgreSQL for ACID compliance"

search - Find Memories

Returns prettified markdown output by default.

# Basic search
search typescript

# Limit results
search database --limit 5

# Multi-word query
search "error handling patterns"

# Raw output (compact, for scripting)
search typescript --raw

Scoring: Results ranked by keyword matches (5pts) + tag matches (8pts) + extracted keyword matches (6pts) + recency bonus (0-5pts)

compress - Context Engineering

The key feature for context injection into LLMs.

# Basic compression (deterministic, no LLM needed)
compress --query "react patterns"

# With character budget
compress --query "authentication" --budget 800

# Limit memories considered
compress --query "database" --budget 1200 --limit 10

# LLM-assisted compression (requires DEEPSEEK_API_KEY)
compress --query "project decisions" --budget 1000 --llm

delete - Soft Delete

# Delete by ID (creates tombstone, recoverable)
delete m_20241213T150000000Z_abc123

purge - Hard Delete

# By exact ID
purge --id m_20241213T150000000Z_abc123

# By tag (deletes ALL with this tag)
purge --tag temporary

# By substring match
purge --match "test data"

# Preview what would be deleted
purge --match "test" --dry-run

export - Dump All Data

# Outputs raw JSON (including tombstoned items)
export

stats - View Statistics

stats
# Output:
# total=42 active=40 deleted=2
# top tags:
# - preference: 12
# - architecture: 8
# - pattern: 6

help - Show Commands

help

exit - Quit

exit
# or
quit

Tips for Context Engineering

1. Use Consistent Tags

add --tags pref I like X        # Bad - inconsistent
add --tags preference I like X  # Good - consistent

2. Keep Memories Atomic

# Bad - too broad
add We use React, TypeScript, Jest, PostgreSQL, and Docker

# Good - atomic, searchable individually
add --tags stack,frontend We use React 18 with TypeScript
add --tags stack,testing Jest for unit tests
add --tags stack,database PostgreSQL as primary database

3. Include Searchable Keywords

# Bad - vague
add Don't do that thing with the stuff

# Good - searchable
add --tags antipattern,react Avoid prop drilling - use Context or Zustand

4. Budget-Aware Compression

# Small context window
compress --query "react" --budget 400

# Larger context available
compress --query "react" --budget 2000

# Let LLM prioritize what's important
compress --query "react" --budget 600 --llm

5. Recommended Tags

  • preference - Personal coding preferences
  • pattern - Design patterns to follow
  • antipattern - Things to avoid
  • architecture - System design decisions
  • decision - ADRs and rationale
  • stack - Technology choices
  • convention - Team conventions