npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ai-memory/plugin-copilot-cli

v0.1.1

Published

GitHub Copilot CLI plugin for Agent Memory - enables persistent memory for CLI interactions

Downloads

243

Readme

Agent Memory Copilot CLI Integration

Persistent memory integration for GitHub Copilot CLI, powered by Agent Memory.

Phase B + C Implementation

This package now provides programmatic Copilot hook automation with comprehensive visual feedback for:

  • Context injection on session start (onSessionStart)
  • Prompt observation capture (onUserPromptSubmitted)
  • Tool-use observation capture (onPostToolUse)
  • Session summarization persistence (onSessionEnd)
  • NEW: Structured visual feedback with formatted output
  • NEW: Progress tracking and session summaries
  • NEW: Recovery suggestions for configuration errors

Use createCopilotAutomationHooks in Copilot SDK-style sessions to emulate Claude Code-style memory automation, but aligned to Copilot's callback model.

Usage

import { AgentMemoryClient } from '@ai-memory/sdk';
import { createCopilotAutomationHooks, SessionProgressIndicator } from '@ai-memory/plugin-copilot-cli';

const memory = new AgentMemoryClient({
  apiKey: process.env.AGENT_MEMORY_API_KEY!,
  workerUrl: process.env.AGENT_MEMORY_WORKER_URL!,
  apiUrl: process.env.AGENT_MEMORY_API_URL!,
});

const hooks = createCopilotAutomationHooks(memory, {
  projectFallback: 'my-project',      // (Optional, deprecated) Fallback project
  contextMaxTokens: 2000,             // (Optional) Context size limit
  verbose: true,                       // (Optional) Show memory operation logs
});

const progress = new SessionProgressIndicator();

// Pass `hooks` to your Copilot SDK session creation.

Visual Feedback Features

Verbose Mode Output

When verbose: true is set:

[memory:info] Session starting in /path/to/project
[memory:✓] Project resolved: my-project
[memory:info] Creating memory session for project: my-project
[memory:✓] Memory session created: mem-abc123def456
[memory:info] Loading context (max 2000 tokens)
[memory:✓] Context loaded: 3 items

━━━━ MEMORY CONTEXT (3 items) ━━━━
[Context from previous sessions...]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

[memory:info] Recording user prompt (142 chars)
[memory:✓] User prompt recorded

Formatted Context Injection

Use formatContextInjection() to display injected context:

┌─ MEMORY CONTEXT ─────────────────────────────────────┐
│ Items: 3                                             │
│ Size:  2.0KB                                         │
│ From:  recent-sessions, shared-project              │
│                                                       │
│ Preview:                                            │
│ Previous discussion about authentication             │
│ API endpoint definitions                            │
│ Test coverage notes                                 │
└───────────────────────────────────────────────────────┘

Observation Tracking

Track memory operations with SessionProgressIndicator:

const progress = new SessionProgressIndicator();
progress.recordObservation({ 
  type: 'user-message', 
  charCount: input.content.length 
});
console.log(progress.formatSummary());
// Output: [memory] Session: 3 observations, 2.0KB, 145ms

Error Messages with Recovery

Errors include helpful recovery suggestions:

[memory:✗] Configuration not found

Suggestions:
  • Create .memory/config.yml in your project root
  • Run: copilot memory init
  • Pass project: "your-project" to createCopilotAutomationHooks()

API Reference

createCopilotAutomationHooks(memory, options?)

Automatically:

  1. Create a memory session when Copilot CLI starts
  2. Track all observations (prompts, tool calls, results)
  3. Count and log total observations per session
  4. Persist and summarize on session end

Options:

  • projectFallback?: string — Legacy fallback project (deprecated, use config-first)
  • contextMaxTokens?: number — Context size limit (default: 2000)
  • verbose?: boolean — Show memory operation logs (default: false)

Visual Feedback Functions

  • formatMemoryStatus(status) — Format status messages
  • formatContextInjection(summary) — Format injected context display
  • formatObservationRecorded(obs) — Format observation confirmations
  • formatMemoryError(code, message) — Format errors with suggestions
  • formatBytes(bytes) — Format byte sizes (B, KB, MB)
  • SessionProgressIndicator — Track and summarize operations

Session Tracking

The hooks automatically:

  1. Create a memory session when Copilot CLI starts
  2. Track all observations (prompts, tool calls, results)
  3. Count and log total observations per session
  4. Persist and summarize on session end

Phase B: Config-First (Error-First)

Now requires .memory/config.yml for project identity:

# .memory/config.yml
project: my-project

# (Optional) Enable context from related projects
inherit_from:
  - shared-project

# (Optional) Share context with other projects  
shared_with:
  - related-project

Without config, memory operations fail gracefully with helpful error messages.

Exports

  • copilotCliAdapter - existing adapter-kit-based event normalization.
  • createCopilotAutomationHooks - Copilot callback automation with visual feedback.
  • HookOptions - Configuration interface (projectFallback, contextMaxTokens, verbose).
  • formatMemoryStatus, formatContextInjection, formatObservationRecorded, formatMemoryError, formatBytes - Visual feedback functions.
  • SessionProgressIndicator - Progress tracking class.

Testing

pnpm --filter @ai-memory/plugin-copilot-cli test
pnpm --filter @ai-memory/plugin-copilot-cli typecheck