New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Queue-based workflow assistant that captures decisions and commitments in under 50ms, then processes them later.

version
1.0.0
GitHub stars
36
View on GitHub

What it does

  • Adds /secretary:init, /secretary:status, /secretary:track, /secretary:goals, and 7 more commands for managing your workflow data
  • Covers decisions, commitments, ideas, and session data, with an AI extraction worker running every 5 minutes via cron
  • Enforces zero-latency capture: each hook event does one SQLite INSERT, with AI calls deferred to the background worker
  • Designed for developers who want Claude Code sessions to stay fast while syncing notes to an Obsidian vault

Queue-based personal workflow assistant. Captures decisions, commitments, ideas, and session data via ultra-fast hooks (< 50ms), processes them in a background worker with AI extraction, and syncs to Obsidian vault. Replaces my-workflow with zero-latency capture architecture.

Add marketplace

/plugin marketplace add mwguerra/claude-code-plugins

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install secretary@mwguerra-marketplace

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Assistant Skill

Provide context-aware assistance, intelligent briefings, memory recall, and knowledge graph queries.

When to Use

  • User asks "What should I work on?" or "What do I have pending?"
  • User asks "What did I decide about X?" or "Remind me about..."
  • User wants context about current or past work
  • Session just started and a briefing is needed
  • User wants to search across all captured knowledge
  • User needs cross-project awareness or related item discovery
  • User asks about the status of tracked items
  • User wants to explore the knowledge graph

Database Locations

# Main database
SECRETARY_DB_PATH="$HOME/.claude/secretary/secretary.db"

# Encrypted memory (sensitive data)
SECRETARY_MEMORY_DB_PATH="$HOME/.claude/secretary/memory.db"

# Scripts
PLUGIN_ROOT="$HOME/.claude/plugins/secretary"

Generate Briefing

Query and format a comprehensive briefing based on current context.

1. Pending Commitments

SELECT id, title, due_date, priority, project, status, stakeholder
FROM commitments
WHERE status IN ('pending', 'in_progress')
ORDER BY
    CASE WHEN due_date IS NOT NULL AND due_date < date('now') THEN 0
         WHEN due_date = date('now') THEN 1
         WHEN due_date IS NOT NULL THEN 2
         ELSE 3 END,
    CASE priority WHEN 'critical' THEN 1 WHEN 'high' THEN 2 WHEN 'medium' THEN 3 ELSE 4 END;

2. Recent Decisions (Project-Specific)

SELECT id, title, category, created_at
FROM decisions
WHERE status = 'active'
  AND (project = :current_project OR project IS NULL)
  AND created_at >= datetime('now', '-7 days')
ORDER BY created_at DESC LIMIT 5;

3. Goal Progress

SELECT id, title, progress_percentage, target_date, goal_type
FROM goals WHERE status = 'active'
ORDER BY
    CASE WHEN target_date IS NOT NULL THEN 0 ELSE 1 END,
    progress_percentage DESC
LIMIT 5;

4. Ideas Inbox

SELECT id, title, idea_type, priority
FROM ideas WHERE status = 'captured'
ORDER BY created_at DESC LIMIT 5;

5. GitHub Items (Cache Only)

SELECT data FROM github_cache
WHERE id = 'combined' AND expires_at > datetime('now');

6. Queue Status

SELECT COUNT(*) as pending FROM queue WHERE status = 'pending';

Memory Recall

When the user asks about past work, search across all knowledge stores.

FTS5 Search (Primary)

-- Search decisions
SELECT d.id, d.title, d.description, d.rationale, d.category,
       d.project, d.created_at
FROM decisions d
JOIN decisions_fts ON decisions_fts.rowid = d.rowid
WHERE decisions_fts MATCH :query AND d.status = 'active'
ORDER BY rank LIMIT 10;

-- Search commitments
SELECT c.id, c.title, c.description, c.priority, c.status,
       c.project, c.created_at
FROM commitments c
JOIN commitments_fts ON commitments_fts.rowid = c.rowid
WHERE commitments_fts MATCH :query
ORDER BY rank LIMIT 10;

-- Search ideas
SELECT i.id, i.title, i.description, i.idea_type, i.status,
       i.project, i.created_at
FROM ideas i
JOIN ideas_fts ON ideas_fts.rowid = i.rowid
WHERE ideas_fts MATCH :query
ORDER BY rank LIMIT 10;

-- Search knowledge nodes
SELECT kn.id, kn.name, kn.node_type, kn.description, kn.importance
FROM knowledge_nodes kn
JOIN knowledge_nodes_fts ON knowledge_nodes_fts.rowid = kn.rowid
WHERE knowledge_nodes_fts MATCH :query
ORDER BY rank LIMIT 10;

LIKE Fallback

When FTS5 is too strict or the query contains special characters:

SELECT id, title, description, rationale, category, project, created_at
FROM decisions
WHERE status = 'active'
  AND (title LIKE '%' || :query || '%'
       OR description LIKE '%' || :query || '%'
       OR rationale LIKE '%' || :query || '%')
ORDER BY created_at DESC LIMIT 10;

Encrypted Memory Search

bash "$PLUGIN_ROOT/scripts/memory-manager.sh" search "query"

Session History Search

SELECT id, project, started_at, summary, duration_seconds / 60 as minutes
FROM sessions
WHERE summary LIKE '%' || :query || '%'
ORDER BY started_at DESC LIMIT 5;

Knowledge Graph Queries

Find Entity Relationships

SELECT
    kn_target.name as related_entity,
    kn_target.node_type as entity_type,
    ke.relationship,
    ke.strength
FROM knowledge_edges ke
JOIN knowledge_nodes kn_target ON kn_target.id = ke.target_node_id
WHERE ke.source_node_id = :entity_id
ORDER BY ke.strength DESC;

Find All Connections for an Entity

SELECT
    CASE WHEN ke.source_node_id = :entity_id THEN kn_t.name ELSE kn_s.name END as connected_to,
    CASE WHEN ke.source_node_id = :entity_id THEN kn_t.node_type ELSE kn_s.node_type END as type,
    ke.relationship,
    ke.strength
FROM knowledge_edges ke
JOIN knowledge_nodes kn_s ON kn_s.id = ke.source_node_id
JOIN knowledge_nodes kn_t ON kn_t.id = ke.target_node_id
WHERE ke.source_node_id = :entity_id OR ke.target_node_id = :entity_id
ORDER BY ke.strength DESC;

Find Paths Between Entities

SELECT
    kn1.name as entity_a,
    ke1.relationship as rel_1,
    kn_bridge.name as bridge,
    ke2.relationship as rel_2,
    kn2.name as entity_b
FROM knowledge_edges ke1
JOIN knowledge_nodes kn1 ON kn1.id = ke1.source_node_id
JOIN knowledge_nodes kn_bridge ON kn_bridge.id = ke1.target_node_id
JOIN knowledge_edges ke2 ON ke2.source_node_id = kn_bridge.id
JOIN knowledge_nodes kn2 ON kn2.id = ke2.target_node_id
WHERE kn1.name LIKE '%' || :entity_a || '%'
  AND kn2.name LIKE '%' || :entity_b || '%';

Context Awareness

Determine what is relevant to current work:

1. Get Current Project Context

-- Recent sessions in this project
SELECT id, started_at, summary, branch, duration_seconds / 60 as minutes
FROM sessions
WHERE project = :current_project AND status = 'completed'
ORDER BY started_at DESC LIMIT 3;

2. Project-Specific Items

-- Active decisions for this project
SELECT id, title, category FROM decisions
WHERE project = :project AND status = 'active'
ORDER BY created_at DESC LIMIT 10;

-- Pending commitments for this project
SELECT id, title, due_date, priority FROM commitments
WHERE project = :project AND status IN ('pending', 'in_progress')
ORDER BY priority DESC, due_date ASC;

3. Cross-Project Connections

-- Projects with shared concerns
SELECT DISTINCT d1.project as this_project, d2.project as related_project,
    d1.category, COUNT(*) as shared_categories
FROM decisions d1
JOIN decisions d2 ON d1.category = d2.category AND d1.project != d2.project
WHERE d1.project = :current_project AND d1.status = 'active' AND d2.status = 'active'
GROUP BY d2.project, d1.category
ORDER BY shared_categories DESC;

Status Dashboard

SELECT
    (SELECT COUNT(*) FROM commitments WHERE status IN ('pending', 'in_progress')) as pending_commitments,
    (SELECT COUNT(*) FROM commitments WHERE status = 'pending' AND due_date < date('now')) as overdue,
    (SELECT COUNT(*) FROM decisions WHERE status = 'active') as active_decisions,
    (SELECT COUNT(*) FROM ideas WHERE status = 'captured') as idea_inbox,
    (SELECT COUNT(*) FROM goals WHERE status = 'active') as active_goals,
    (SELECT COUNT(*) FROM queue WHERE status = 'pending') as queue_pending,
    (SELECT COUNT(*) FROM sessions WHERE date(started_at) = date('now')) as sessions_today;

Output Guidelines

Briefing Format

# Secretary Briefing

**Project:** {project} | **Date:** {date} ({day_of_week})

## Attention Needed

### Overdue
- [C-0001] Fix bug - 2 days overdue

### Due Today
- [C-0003] Review PR

## Context

### Recent Decisions (this project)
- [D-0015] Use Redis for caching

### Active Goals
- [G-0001] MVP Launch [=========-] 90%

### Ideas Inbox
- [I-0010] GraphQL migration (exploration)

---
*Use `/secretary:track` to manage commitments*

Memory Recall Format

# Recall: "{query}"

## Decisions (3 found)
- [D-0015] Use Redis for caching (Jan 25)
  Rationale: Better performance, built-in TTL
- [D-0012] Cache invalidation strategy (Jan 20)

## Commitments (1 found)
- [C-0030] Implement caching layer - In Progress

## Ideas (1 found)
- [I-0008] Cache warming on deploy - Captured

## Related Sessions
- Jan 25: Caching discussion (45 min) - claude-code-plugins

## Knowledge Graph
- Redis -> used by -> api-service, claude-code-plugins
- Redis -> related to -> Memcached

Status Dashboard Format

# Secretary Status

| Category | Count |
|----------|-------|
| Pending Commitments | 12 |
| Overdue | 3 |
| Active Decisions | 28 |
| Ideas Inbox | 7 |
| Active Goals | 3 |
| Queue Pending | 0 |

Error Handling

  • If database does not exist: "Secretary database not initialized. It will be created automatically on next session start."
  • If no results: "No matching records found for: {query}"
  • If GitHub cache unavailable: Skip the section gracefully
  • If encrypted memory unavailable: Note that SQLCipher is not installed

Related Commands

  • /secretary:briefing - Generate a full context briefing
  • /secretary:status - Show dashboard with counts and overview
  • /secretary:memory - Search and manage encrypted memory entries
  • /secretary:search - Search across all knowledge stores
  • /secretary:track - View and manage commitments
  • /secretary:graph - Explore knowledge graph relationships

Readme

Secretary

A queue-based personal workflow assistant for Claude Code. Captures decisions, commitments, ideas, and session data via ultra-fast hooks (< 50ms), processes them in a background worker with AI extraction, and syncs everything to an Obsidian vault.

Why Secretary?

The predecessor plugin (my-workflow) made Claude Code noticeably slow — each PostToolUse event triggered 3 independent AI calls on the same text (up to 60s of blocking), and Stop/SessionEnd fired identical scripts, doubling session-end processing.

Secretary replaces all of that with a "Capture Fast, Process Later" architecture:

Eventmy-workflow (old)Secretary (new)
PostToolUse(Bash)45-75s (3x AI + vault + DB)< 50ms (1 SQLite INSERT)
PostToolUse(Edit/Write)30-60s (3x AI + vault)< 30ms (1 SQLite INSERT)
UserPromptSubmit30s (AI + vault + DB)< 20ms (1 SQLite INSERT)
Stop140s (Sonnet + Haiku + git)< 50ms (1 INSERT + UPDATE)
SessionEnd140s (duplicate of Stop)< 50ms (dedup check + INSERT)
SessionStart90s (git sync + briefing)< 15s (SQL queries + time-boxed processing)
AI calls per tool use3 (triplicate)0 (deferred to worker)

Architecture

                    ┌─────────────────────────────────┐
                    │         Claude Code Hooks        │
                    │  SessionStart  UserPromptSubmit  │
                    │  PostToolUse   SubagentStop      │
                    │  Stop          SessionEnd        │
                    └──────────────┬──────────────────┘
                                   │
                                   ▼
                    ┌─────────────────────────────────┐
                    │         capture.sh (< 50ms)      │
                    │    SQLite INSERT into queue       │
                    │    (WAL mode for concurrency)     │
                    └──────────────┬──────────────────┘
                                   │
                                   ▼
                    ┌─────────────────────────────────┐
                    │     queue table (SQLite)          │
                    │  Pending items wait for worker    │
                    └──────────────┬──────────────────┘
                                   │
                    ┌──────────────┼──────────────────┐
                    │              │                    │
                    ▼              ▼                    ▼
             ┌────────────┐ ┌──────────┐ ┌──────────────────┐
             │  worker.sh  │ │ Session  │ │  /secretary:     │
             │  (cron 5m)  │ │  Start   │ │  process         │
             │  up to 50   │ │ (inline  │ │  (manual trigger)│
             │  items/run   │ │  10 max) │ │                  │
             └──────┬─────┘ └──────────┘ └──────────────────┘
                    │
         ┌──────────┼──────────┐
         ▼          ▼          ▼
    ┌─────────┐ ┌────────┐ ┌─────────┐
    │    AI    │ │ Vault  │ │  Git    │
    │Extract  │ │ Notes  │ │  Sync   │
    │(1 call  │ │(.md)   │ │(commit  │
    │per item)│ │        │ │ +push)  │
    └────┬────┘ └────┬───┘ └────┬────┘
         │           │          │
         ▼           ▼          ▼
    ┌─────────┐ ┌────────┐ ┌─────────┐
    │decisions│ │Obsidian│ │ Remote  │
    │ideas/   │ │vault/  │ │ repo    │
    │commits  │ │secrty/ │ │         │
    └─────────┘ └────────┘ └─────────┘

How It Works

  1. Every hook event (user prompt, tool use, stop, etc.) calls capture.sh which does a single SQLite INSERT into the queue table. This completes in under 50ms — no AI, no network, no file I/O beyond the DB write.

  2. A background worker (worker.sh) runs every 5 minutes via cron. It processes pending queue items: extracts decisions/ideas/commitments with a single AI call per item (not 3 like before), creates Obsidian vault notes, syncs to git.

  3. At session start, if unprocessed items exist, a time-boxed (5s) inline processing handles up to 10 items. A SQL-only briefing (no AI) shows your commitments, recent decisions, goals, and GitHub items.

  4. No cron? Still works. Queue items accumulate and get processed at the next session start (time-boxed) or via /secretary:process.

Requirements

Required

  • sqlite3 — Database engine (pre-installed on most systems)
  • jq — JSON processing (required for hook data parsing)

Optional

  • sqlcipher — AES-256 encryption for the memory database
  • flock — File locking for cron worker (Linux built-in, macOS via brew install flock)
  • timeout — Process timeout for cron safety (Linux built-in, macOS via brew install coreutils)
  • gh — GitHub CLI for issue/PR tracking in briefings

Installation

Ubuntu / Debian
sudo apt-get install sqlite3 jq
# Optional:
sudo apt-get install sqlcipher
macOS
brew install sqlite3 jq
# Optional:
brew install sqlcipher flock coreutils
Windows (Git Bash / MSYS2)
choco install sqlite jq
# Or via MSYS2: pacman -S sqlite3 jq

Quick Start

  1. Initialize the plugin:

    /secretary:init
    

    This creates the databases, config file, vault structure, and encryption key. If my-workflow data exists, it offers to migrate.

  2. Set up the background worker (recommended):

    /secretary:cron setup
    

    Installs a cron job that runs every 5 minutes to process the queue.

  3. Start working! The hooks automatically capture everything. Use these commands:

    • /secretary:status — Dashboard with session info, queue depth, commitments, goals
    • /secretary:briefing — Manual briefing (same as session start)
    • /secretary:track — Manage commitments (add, complete, defer, list)
    • /secretary:goals — Manage goals with progress tracking
    • /secretary:review — Weekly/monthly productivity reviews
    • /secretary:memory — Encrypted memory for sensitive data
    • /secretary:process — Manually trigger queue processing
    • /secretary:sync — Force vault sync + git push
    • /secretary:patterns — View detected behavior patterns

File Structure

secretary/
├── .claude-plugin/
│   └── plugin.json                    # Plugin manifest
├── hooks/
│   ├── hooks.json                     # All events → capture.sh
│   └── scripts/
│       ├── capture.sh                 # THE single hook (< 50ms)
│       └── lib/
│           ├── utils.sh               # Dates, paths, config, escaping
│           ├── db.sh                  # ensure_db, db_exec, queue_item
│           └── git-detect.sh          # Fast git commit detection
├── scripts/
│   ├── worker.sh                      # Cron entry point
│   ├── process-queue.sh               # Queue item processing
│   ├── ai-extract.sh                  # AI extraction (1 call/item)
│   ├── briefing.sh                    # SQL-only briefing generator
│   ├── vault-sync.sh                  # Create vault markdown notes
│   ├── vault-git-sync.sh             # Git commit+push for vault
│   ├── memory-manager.sh             # Encrypted memory operations
│   └── install-cron.sh               # Cron setup helper
├── commands/                          # 11 slash commands (*.md)
├── agents/                            # 3 agents (secretary, executive, assistant)
├── skills/                            # 3 skills with SKILL.md
├── schemas/
│   ├── secretary.sql                  # Main database (15+ tables, FTS5)
│   ├── memory.sql                     # Encrypted memory schema
│   └── config.schema.json             # Configuration JSON schema
├── config/
│   └── secretary.example.json         # Example configuration
├── tests/
│   ├── test-capture.sh                # Hook timing tests
│   ├── test-worker.sh                 # Queue processing tests
│   └── test-queue.sh                  # Schema & DB tests
└── README.md

Two Databases

Main: ~/.claude/secretary/secretary.db

SQLite with WAL mode. Contains all workflow data:

TablePurpose
queueRaw captured events, pending/processed status
sessionsSession records with summary, commits, duration
commitmentsAction items with priority, due dates, status (FTS5)
decisionsArchitecture/process decisions with rationale (FTS5)
ideasIdea backlog with type, effort, impact (FTS5)
goalsObjectives with progress tracking
patternsDetected behavior patterns
knowledge_nodes / knowledge_edgesKnowledge graph (FTS5)
activity_timelineUnified activity log
daily_notesDaily summaries and planning
github_cacheCached GitHub issues/PRs
worker_stateWorker run stats

Memory: ~/.claude/secretary/memory.db

Encrypted with SQLCipher (AES-256) when available. Falls back to plain sqlite3 with a warning.

TablePurpose
memorySensitive data (credentials, IPs, secrets)
memory_ftsFull-text search on title, content, tags
memory_access_logAudit trail of all reads/writes

The encryption key is auto-generated during /secretary:init and stored in ~/.claude/secretary/auth.json (chmod 600).

Obsidian Vault Integration

Secretary creates structured markdown notes in your Obsidian vault:

vault/secretary/
├── daily/          # YYYY-MM-DD.md — daily work logs
├── sessions/       # Session summaries with commits and duration
├── decisions/      # D-XXXX.md — decisions with rationale
├── commitments/    # C-XXXX.md — action items with status
├── ideas/          # I-XXXX.md — idea backlog with assessment
├── goals/          # G-XXXX.md — goals with progress
├── reviews/        # Weekly/monthly productivity reviews
├── patterns/       # Behavior observations
└── index.md        # Dashboard linking all sections

Entity IDs are used as filenames (e.g., D-0001.md) — no AI calls needed for note creation.

Reads vault path from ~/.claude/obsidian-vault.json (shared with the obsidian-vault plugin).

Background Worker

Cron Entry (installed by /secretary:cron setup)

*/5 * * * * flock -n /tmp/secretary-worker.lock timeout 120 bash ~/.claude/plugins/secretary/scripts/worker.sh >> ~/.claude/secretary/worker.log 2>&1
  • flock -n — Non-blocking lock. If another worker is running, exit immediately.
  • timeout 120 — Hard kill after 2 minutes. Prevents runaway processes.

Worker Flow

  1. Process up to 50 pending queue items (AI extraction, DB inserts)
  2. Sync vault notes to git if changes exist (single commit+push)
  3. Refresh GitHub cache if expired
  4. Expire old queue items (> 24h unprocessed)

No Cron Fallback

If cron is never set up:

  1. Queue items accumulate
  2. At each session start, 5-second time-boxed processing handles up to 10 items
  3. /secretary:process triggers the worker manually

Data Migration

/secretary:init detects ~/.claude/my-workflow/workflow.db and offers to migrate all data:

  • Sessions, commitments, decisions, ideas, goals, patterns
  • Knowledge graph (nodes + edges)
  • Activity timeline, daily notes, GitHub cache
  • All entity IDs preserved (C-XXXX, D-XXXX, etc.)

Both plugins can coexist during transition (different DB paths).

Commands Reference

CommandDescription
/secretary:initInitialize databases, config, vault, encryption key
/secretary:statusDashboard: session, queue, commitments, goals, activity
/secretary:briefingManual briefing (same as session start)
/secretary:trackCommitment CRUD: add, complete, defer, edit, delete, list
/secretary:reviewWeekly/monthly reviews with metrics
/secretary:goalsGoal CRUD: add, update-progress, complete, abandon
/secretary:memoryEncrypted memory: add, search, list, show, delete
/secretary:processManually trigger queue processing
/secretary:syncForce vault sync + external change detection
/secretary:cronSetup/check/remove background worker cron job
/secretary:patternsView and analyze detected behavior patterns

Testing

Run the test suite:

# Hook performance tests (must be < 100ms)
bash secretary/tests/test-capture.sh

# Queue and schema tests
bash secretary/tests/test-queue.sh

# Worker and processing tests
bash secretary/tests/test-worker.sh

Configuration

Config file: ~/.claude/secretary.json

See config/secretary.example.json for all available options:

{
  "briefing": {
    "showOnStart": true,
    "includePendingCommitments": true,
    "includeRecentDecisions": true,
    "includeGoalProgress": true,
    "includeGitHub": true,
    "daysBack": 7
  },
  "ai": {
    "enabled": true,
    "model": "haiku",
    "maxBudget": "0.50"
  },
  "vault": {
    "enabled": true,
    "secretaryFolder": "secretary"
  },
  "worker": {
    "cronEnabled": true,
    "maxItemsPerRun": 50,
    "retryLimit": 3
  },
  "memory": {
    "enabled": true
  }
}

Cross-Platform Support

Secretary works on:

  • Linux (Ubuntu, Debian, Fedora, Arch) — full support including flock and timeout
  • macOS — full support, optional brew install flock coreutils for cron safety
  • Windows (Git Bash / MSYS2) — core functionality, Task Scheduler for background worker

Platform detection is automatic. Date functions, process detection, and file operations all have cross-platform implementations.

License

MIT

Details

Marketplace
mwguerra/claude-code-plugins
Source
secretary
Category
Productivity
Keywords
secretary, workflow, productivity, queue, background-worker, commitments, decisions, ideas, goals, briefing, github, obsidian, tracking, sessions, patterns, knowledge-graph, encrypted-memory, cron
Listed since
Apr 7, 2026

More from mwguerra/claude-code-plugins

All 18

Similar to secretary

More Productivity & Notes