memory-journal-mcp 7.6.1 → 7.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![MCP Registry](https://img.shields.io/badge/MCP_Registry-Published-green)](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.neverinfamous/memory-journal-mcp)
11
11
  [![Security](https://img.shields.io/badge/Security-Enhanced-green.svg)](SECURITY.md)
12
12
  [![TypeScript](https://img.shields.io/badge/TypeScript-Strict-blue.svg)](https://github.com/neverinfamous/memory-journal-mcp)
13
- ![Coverage](https://img.shields.io/badge/Coverage-91.25%25-green.svg)
13
+ ![Coverage](https://img.shields.io/badge/Coverage-91.12%25-green.svg)
14
14
  ![Tests](https://img.shields.io/badge/Tests-1782_passed-brightgreen.svg)
15
15
  ![E2E Tests](https://img.shields.io/badge/E2E_Tests-391_passed-brightgreen.svg)
16
16
  [![CI](https://github.com/neverinfamous/memory-journal-mcp/actions/workflows/gatekeeper.yml/badge.svg)](https://github.com/neverinfamous/memory-journal-mcp/actions/workflows/gatekeeper.yml)
@@ -1,4 +1,4 @@
1
- import { TOOL_GROUPS, logger, getGitHubIntegration, parseToolFilter, getFilterSummary, getToolFilterFromEnv, getTools, getRequiredScope, getEnabledGroups, callTool, MetricsAccumulator, getAuthContext, getRequestContext, ConfigurationError, sendProgress, SUPPORTED_SCOPES, enforceAccessBoundary, runWithAuthContext, isValidScope, requestContextStorage, ConnectionError, ResourceNotFoundError, QueryError, assertNoPathTraversal, ValidationError, resolveGitHubRepo, isResourceError, markUntrustedContentInline, milestoneCompletionPct, sanitizeAuthor, markUntrustedContent, parseFlagContext, DEFAULT_FLAG_VOCABULARY, parseScopes, BASE_SCOPES, validateDateFormatPattern, getAllToolNames, assertSafeFilePath, assertSafeDirectoryPath, MemoryJournalMcpError, sanitizeSearchQuery, DEFAULT_BRIEFING_CONFIG } from './chunk-SYTB5YNH.js';
1
+ import { TOOL_GROUPS, logger, getGitHubIntegration, parseToolFilter, getFilterSummary, getToolFilterFromEnv, getTools, getRequiredScope, getEnabledGroups, callTool, MetricsAccumulator, getAuthContext, getRequestContext, ConfigurationError, sendProgress, SUPPORTED_SCOPES, enforceAccessBoundary, runWithAuthContext, isValidScope, requestContextStorage, ConnectionError, ResourceNotFoundError, QueryError, assertNoPathTraversal, ValidationError, resolveGitHubRepo, isResourceError, markUntrustedContentInline, milestoneCompletionPct, sanitizeAuthor, markUntrustedContent, parseFlagContext, DEFAULT_FLAG_VOCABULARY, parseScopes, BASE_SCOPES, validateDateFormatPattern, getAllToolNames, assertSafeFilePath, assertSafeDirectoryPath, MemoryJournalMcpError, sanitizeSearchQuery, DEFAULT_BRIEFING_CONFIG } from './chunk-ARLYSFSI.js';
2
2
  import { createRequire } from 'module';
3
3
  import { appendFile, open, mkdir, stat, rename } from 'fs/promises';
4
4
  import * as path4 from 'path';
@@ -2144,8 +2144,12 @@ var BackupManager = class {
2144
2144
  const tempDbPath = `${this.ctx.getDbPath()}.restore_tmp_${randomUUID()}`;
2145
2145
  await fs2.promises.copyFile(backupPath, tempDbPath);
2146
2146
  try {
2147
- await fs2.promises.rename(this.ctx.getDbPath(), oldDbBackupPath);
2148
- await fs2.promises.rename(tempDbPath, this.ctx.getDbPath());
2147
+ await fs2.promises.copyFile(this.ctx.getDbPath(), oldDbBackupPath);
2148
+ try {
2149
+ await fs2.promises.rename(tempDbPath, this.ctx.getDbPath());
2150
+ } catch {
2151
+ await fs2.promises.copyFile(tempDbPath, this.ctx.getDbPath());
2152
+ }
2149
2153
  await this.ctx.initialize();
2150
2154
  const integrityResult = this.ctx.exec("PRAGMA integrity_check");
2151
2155
  if (integrityResult[0]?.values[0]?.[0] !== "ok") {
@@ -2155,19 +2159,42 @@ var BackupManager = class {
2155
2159
  }
2156
2160
  try {
2157
2161
  await fs2.promises.unlink(oldDbBackupPath);
2162
+ await fs2.promises.unlink(tempDbPath);
2158
2163
  } catch {
2159
2164
  }
2160
2165
  } catch (error) {
2161
- logger.error(
2162
- "Restore failed, rolling back to pre-restore backup using atomic rename",
2163
- {
2164
- module: "SqliteAdapter",
2165
- operation: "restoreFromFile",
2166
- error: error instanceof Error ? error.message : String(error)
2167
- }
2168
- );
2166
+ logger.error("Restore failed, rolling back to pre-restore backup using copy", {
2167
+ module: "SqliteAdapter",
2168
+ operation: "restoreFromFile",
2169
+ error: error instanceof Error ? error.message : String(error),
2170
+ stack: error instanceof Error ? error.stack : void 0
2171
+ });
2169
2172
  this.ctx.closeDbBeforeRestore();
2170
- await fs2.promises.rename(oldDbBackupPath, this.ctx.getDbPath());
2173
+ let rollbackSuccess = false;
2174
+ try {
2175
+ await fs2.promises.copyFile(oldDbBackupPath, this.ctx.getDbPath());
2176
+ rollbackSuccess = true;
2177
+ } catch (rollbackErr) {
2178
+ if (rollbackErr.code !== "ENOENT") {
2179
+ logger.error("Rollback copy failed", { error: rollbackErr });
2180
+ }
2181
+ }
2182
+ if (rollbackSuccess) {
2183
+ try {
2184
+ await fs2.promises.unlink(oldDbBackupPath);
2185
+ } catch {
2186
+ }
2187
+ }
2188
+ try {
2189
+ await fs2.promises.unlink(tempDbPath);
2190
+ } catch {
2191
+ }
2192
+ if (!rollbackSuccess) {
2193
+ throw new Error(
2194
+ `CRITICAL: Database restore failed AND rollback failed. The database may be in an inconsistent state. Your previous database is preserved at: ${oldDbBackupPath}. Original error: ${error instanceof Error ? error.message : String(error)}`,
2195
+ { cause: error }
2196
+ );
2197
+ }
2171
2198
  await this.ctx.initialize();
2172
2199
  throw error;
2173
2200
  }
@@ -3816,7 +3843,8 @@ var MS_PER_DAY = 864e5;
3816
3843
  function buildRulesFileInfo(rulesFilePath, allowedIoRoots = []) {
3817
3844
  if (!rulesFilePath) return void 0;
3818
3845
  try {
3819
- assertSafeFilePath(rulesFilePath, allowedIoRoots);
3846
+ const expandedRoots = [...allowedIoRoots, path4.dirname(rulesFilePath)];
3847
+ assertSafeFilePath(rulesFilePath, expandedRoots);
3820
3848
  const stat2 = fs2.statSync(rulesFilePath);
3821
3849
  const ageMs = Date.now() - stat2.mtimeMs;
3822
3850
  const ageHours = Math.floor(ageMs / MS_PER_HOUR);
@@ -3840,7 +3868,8 @@ function buildRulesFileInfo(rulesFilePath, allowedIoRoots = []) {
3840
3868
  function buildSkillsDirInfo(skillsDirPath, allowedIoRoots = []) {
3841
3869
  if (!skillsDirPath) return void 0;
3842
3870
  try {
3843
- assertSafeDirectoryPath(skillsDirPath, allowedIoRoots);
3871
+ const expandedRoots = [...allowedIoRoots, skillsDirPath];
3872
+ assertSafeDirectoryPath(skillsDirPath, expandedRoots);
3844
3873
  const entries = fs2.readdirSync(skillsDirPath, { withFileTypes: true });
3845
3874
  const skillDirs = entries.filter((e) => e.isDirectory());
3846
3875
  return {
@@ -4196,6 +4225,7 @@ var CORE_INSTRUCTIONS = `# memory-journal-mcp
4196
4225
  - **FORMATTING**: Group related properties (use \`<br>\` for line breaks).
4197
4226
  - **REQUIRED GROUPS**: GitHub, Issues, Entry Counts, Latest Entries/Summaries, Analytics, Milestones, Workspaces.
4198
4227
  6. **STOP & WAIT**: Do NOT autonomously resume past tasks or start work on new issues. The briefing is strictly for context.
4228
+
4199
4229
  - **AntiGravity**: Tools are \`mcp_{name}_{tool}\` \u2192 server name = \`memory-journal-mcp\`
4200
4230
  - **Cursor**: Tools are \`user-{name}-{tool}\` \u2192 server name = \`user-memory-journal-mcp\`
4201
4231
  - **Other clients**: Use configured name exactly. Use tool-prefix discovery if unsure.
@@ -4243,7 +4273,7 @@ When you notice the user consistently applies patterns, preferences, or workflow
4243
4273
 
4244
4274
  ### Native Agent Skills (NPM Distribution)
4245
4275
 
4246
- This server leverages the \`neverinfamous-agent-skills\` package. If the user's \`SKILLS_DIR_PATH\` environment variable targets these, you have native access to foundational frameworks (\`mastering-typescript\`, \`react-best-practices\`, \`playwright-standard\`, \`golang\`, \`rust\`, \`python\`, \`docker\`, \`tailwind-css\`, \`shadcn-ui\`) and the \`github-commander\` DevOps workflows (\`issue-triage\`, \`pr-review\`, \`github-actions\`, etc.).
4276
+ This server leverages the \`neverinfamous-agent-skills\` package. If the user's \`SKILLS_DIR_PATH\` environment variable targets these, you have native access to foundational frameworks (\`typescript\`, \`react-best-practices\`, \`playwright-standard\`, \`golang\`, \`rust\`, \`python\`, \`docker\`, \`tailwind-css\`, \`shadcn-ui\`) and the \`github-commander\` DevOps workflows (\`issue-triage\`, \`pr-review\`, \`github-actions\`, \`copilot-audit\`, etc.). The \`adversarial-planner\` skill provides multi-pass plan review with structured critique stages.
4247
4277
 
4248
4278
  - The user can distribute or update these skills across their repositories by running \`npx neverinfamous-agent-skills@latest\`.
4249
4279
  - If you need to create a new skill, reference the bundled \`skill-builder\` instructions!
@@ -6910,7 +6940,7 @@ function getHelpResourceDefinitions() {
6910
6940
  var toolIndexModule = null;
6911
6941
  async function getAllToolDefinitionsAsync(context) {
6912
6942
  try {
6913
- toolIndexModule ??= await import('./tools-JQPK5JFS.js');
6943
+ toolIndexModule ??= await import('./tools-P4VGG4FH.js');
6914
6944
  if (toolIndexModule === null) return [];
6915
6945
  const tools = toolIndexModule.getTools(context.db, null);
6916
6946
  return tools.map((t) => ({
@@ -2381,6 +2381,10 @@ var ENTRY_TYPES = [
2381
2381
  "flag",
2382
2382
  "system_integration_test",
2383
2383
  "test_entry",
2384
+ "plan_draft",
2385
+ "adversarial_review",
2386
+ "plan_refinement",
2387
+ "copilot_validation",
2384
2388
  "other"
2385
2389
  ];
2386
2390
  var SIGNIFICANCE_TYPES = [
@@ -3331,7 +3335,10 @@ function getSearchTools(context) {
3331
3335
  }
3332
3336
  return {
3333
3337
  success: true,
3334
- entries: personalEntries,
3338
+ entries: personalEntries.map((e) => ({
3339
+ ...e,
3340
+ source: "personal"
3341
+ })),
3335
3342
  count: personalEntries.length,
3336
3343
  degraded: false
3337
3344
  };
@@ -4117,6 +4124,10 @@ var VALID_ENTRY_TYPES = /* @__PURE__ */ new Set([
4117
4124
  "milestone",
4118
4125
  "system_integration_test",
4119
4126
  "test_entry",
4127
+ "plan_draft",
4128
+ "adversarial_review",
4129
+ "plan_refinement",
4130
+ "copilot_validation",
4120
4131
  "other"
4121
4132
  ]);
4122
4133
  function toEntryType(value) {
@@ -6985,7 +6996,7 @@ function getBackupTools(context) {
6985
6996
  description: "Restore the journal database from a backup file. WARNING: This replaces all current data. Enforce single-writer / single-instance only for restore-capable deployments. An automatic backup is created before restore.",
6986
6997
  group: "backup",
6987
6998
  inputSchema: z.object({
6988
- filename: z.string().describe("Backup filename to restore from (e.g., backup_2025-01-01.db)"),
6999
+ filename: z.string().optional().describe("Backup filename to restore from (e.g., backup_2025-01-01.db)"),
6989
7000
  confirm: z.boolean().optional().describe("Must be set to true to confirm the restore operation")
6990
7001
  }),
6991
7002
  outputSchema: RestoreResultOutputSchema,
@@ -6998,7 +7009,7 @@ function getBackupTools(context) {
6998
7009
  handler: async (params) => {
6999
7010
  try {
7000
7011
  const input = z.object({
7001
- filename: z.string(),
7012
+ filename: z.string().min(1, "filename cannot be empty"),
7002
7013
  confirm: z.boolean().optional()
7003
7014
  }).parse(params);
7004
7015
  if (!input.confirm) {
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
- import { VERSION, DEFAULT_AUDIT_LOG_MAX_SIZE_BYTES, createServer } from './chunk-DFQG7UR5.js';
2
- import { logger } from './chunk-SYTB5YNH.js';
1
+ import { VERSION, DEFAULT_AUDIT_LOG_MAX_SIZE_BYTES, createServer } from './chunk-6LPTBIB6.js';
2
+ import { logger } from './chunk-ARLYSFSI.js';
3
3
  import { Command } from 'commander';
4
4
  import * as path from 'path';
5
5
  import * as fs from 'fs';
package/dist/index.d.ts CHANGED
@@ -183,7 +183,7 @@ interface ToolFilterConfig {
183
183
  /**
184
184
  * Entry types for journal entries
185
185
  */
186
- type EntryType = 'personal_reflection' | 'project_decision' | 'technical_achievement' | 'bug_fix' | 'feature_implementation' | 'code_review' | 'meeting_notes' | 'learning' | 'research' | 'planning' | 'retrospective' | 'standup' | 'technical_note' | 'development_note' | 'enhancement' | 'milestone' | 'flag' | 'system_integration_test' | 'test_entry' | 'other';
186
+ type EntryType = 'personal_reflection' | 'project_decision' | 'technical_achievement' | 'bug_fix' | 'feature_implementation' | 'code_review' | 'meeting_notes' | 'learning' | 'research' | 'planning' | 'retrospective' | 'standup' | 'technical_note' | 'development_note' | 'enhancement' | 'milestone' | 'flag' | 'system_integration_test' | 'test_entry' | 'plan_draft' | 'adversarial_review' | 'plan_refinement' | 'copilot_validation' | 'other';
187
187
  /**
188
188
  * Significance types for important entries
189
189
  */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { VERSION, createServer } from './chunk-DFQG7UR5.js';
2
- export { META_GROUPS, TOOL_GROUPS, calculateTokenSavings, filterTools, getAllToolNames, getFilterSummary, getToolFilterFromEnv, getToolGroup, isToolEnabled, logger, parseToolFilter } from './chunk-SYTB5YNH.js';
1
+ export { VERSION, createServer } from './chunk-6LPTBIB6.js';
2
+ export { META_GROUPS, TOOL_GROUPS, calculateTokenSavings, filterTools, getAllToolNames, getFilterSummary, getToolFilterFromEnv, getToolGroup, isToolEnabled, logger, parseToolFilter } from './chunk-ARLYSFSI.js';
3
3
 
4
4
  // src/types/index.ts
5
5
  var DEFAULT_CONFIG = {
@@ -0,0 +1 @@
1
+ export { callTool, getTools } from './chunk-ARLYSFSI.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-journal-mcp",
3
- "version": "7.6.1",
3
+ "version": "7.7.1",
4
4
  "description": "Project context management for AI-assisted development - Persistent knowledge graphs and intelligent context recall across fragmented AI threads",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -74,15 +74,16 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@eslint/js": "^10.0.1",
77
- "esbuild": "^0.28.0",
78
77
  "@playwright/test": "^1.59.1",
79
78
  "@types/better-sqlite3": "^7.6.13",
80
79
  "@types/express": "^5.0.6",
81
80
  "@types/node": "^25.6.0",
82
81
  "@vitest/coverage-v8": "^4.1.3",
82
+ "esbuild": "^0.28.0",
83
83
  "eslint": "^10.2.0",
84
84
  "globals": "^17.4.0",
85
85
  "tsup": "^8.5.1",
86
+ "tsx": "4.22.0",
86
87
  "typescript": "^6.0.2",
87
88
  "typescript-eslint": "^8.58.1",
88
89
  "vitest": "^4.1.3"
@@ -98,6 +99,7 @@
98
99
  "minimatch": "10.2.5",
99
100
  "tar": "7.5.13",
100
101
  "tmp": "^0.2.5",
101
- "vite": "^8.0.5"
102
+ "vite": "^8.0.5",
103
+ "ip-address": "10.2.0"
102
104
  }
103
105
  }
package/skills/README.md CHANGED
@@ -40,6 +40,7 @@ The markdown body contains the full instructions the agent follows once the skil
40
40
 
41
41
  | Skill | Description |
42
42
  | ---------------------- | --------------------------------------------------------------------------------------------------------------------- |
43
+ | `adversarial-planner` | Multi-pass adversarial planning — iterative plan drafting, structured critique, and Copilot validation |
43
44
  | `autonomous-dev` | Harness for autonomous software development — alignment gates, adversarial agents, Git workflows, and CI/CD pipelines |
44
45
  | `bun` | Master the Bun all-in-one toolkit — runtime, package manager, test runner, and bundler |
45
46
  | `docker` | Production-grade Docker — multi-stage builds, security hardening, Compose v2, BuildKit, and CI/CD integration |
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: adversarial-planner
3
+ description: |
4
+ Multi-pass adversarial planning and review skill that improves agent-generated
5
+ plans through structured critique stages. Combines an initial planning agent
6
+ (structure, logic, task sequencing) with an adversarial review agent
7
+ (performance, security, maintainability) and a final Copilot CLI validation
8
+ pass. Use when creating implementation plans, designing architecture, planning
9
+ roadmaps or milestones, or when the user says "plan this", "review my plan",
10
+ "adversarial review", or "multi-pass plan".
11
+ ---
12
+
13
+ # Adversarial Planner
14
+
15
+ A multi-pass planning and review system that produces high-quality plans by
16
+ introducing structured adversarial critique stages. Plans pass through an
17
+ iterative pipeline of drafting, review, refinement, and optional external
18
+ validation — producing output optimized for correctness, performance, security,
19
+ and maintainability.
20
+
21
+ ## When to Load
22
+
23
+ Load this skill when any of these apply:
24
+
25
+ - Creating an implementation plan for a new feature or architectural change
26
+ - Designing multi-file refactors or system migrations
27
+ - Planning project roadmaps, milestones, or sprint scopes
28
+ - The user asks for an adversarial or multi-pass review of a plan
29
+ - The user says "plan this", "review my plan", "critique this plan", or
30
+ "multi-pass plan"
31
+ - You want to reduce confirmation bias in your own planning output
32
+
33
+ ## Agent Roles
34
+
35
+ This skill operates with two distinct mental models. You are both agents — you
36
+ switch perspectives at phase boundaries.
37
+
38
+ ### Agent A — The Planner
39
+
40
+ **Mandate:** Produce a comprehensive, well-structured plan.
41
+
42
+ - Gather requirements from user request, code context, and prior work
43
+ - Structure the plan with clear scope, file changes, task ordering, and risk
44
+ assessment
45
+ - Optimize for completeness and logical sequencing
46
+ - Reference prior planning sessions via journal search before starting
47
+
48
+ ### Agent B — The Adversarial Reviewer
49
+
50
+ **Mandate:** Find every weakness the Planner missed.
51
+
52
+ - Switch to a skeptical senior reviewer mindset
53
+ - Challenge assumptions, flag gaps, and identify risks
54
+ - Score findings across weighted review dimensions (see protocol reference)
55
+ - Provide concrete, actionable remediation suggestions — not vague concerns
56
+
57
+ The reason for explicit role separation is that it counteracts the natural
58
+ tendency to defend your own output. By formally switching perspective, you
59
+ engage different evaluation criteria than the ones that guided the draft.
60
+
61
+ ## The Multi-Pass Protocol
62
+
63
+ The protocol runs in 4 phases. Each phase produces a journaled artifact.
64
+
65
+ | Phase | Agent | Output | Entry Type | Tags |
66
+ | --------------------- | ------------ | -------------------------------------- | -------------------- | ----------------------------------- |
67
+ | 1. Plan Draft | A (Planner) | Structured plan document | `plan_draft` | `adversarial-planner`, `plan-draft` |
68
+ | 2. Adversarial Review | B (Reviewer) | Critique table with severity ratings | `adversarial_review` | `adversarial-planner`, `review` |
69
+ | 3. Plan Refinement | A (Planner) | Refined plan with disposition notes | `plan_refinement` | `adversarial-planner`, `refinement` |
70
+ | 4. Copilot Validation | External | Independent architecture/security pass | `copilot_validation` | `adversarial-planner`, `copilot` |
71
+
72
+ For the full protocol with review dimensions, scoring weights, and output
73
+ templates, read [references/multi-pass-protocol.md](references/multi-pass-protocol.md).
74
+
75
+ ## Copilot Integration
76
+
77
+ Phase 4 triggers an independent validation pass using the GitHub Copilot CLI.
78
+ This provides a fundamentally different model's perspective on the plan,
79
+ reducing confirmation bias that persists even after adversarial self-review.
80
+
81
+ For Copilot-specific prompt templates and integration details, read
82
+ [references/copilot-integration.md](references/copilot-integration.md).
83
+
84
+ **Prerequisites:** The `github-copilot-cli` skill must be available for CLI
85
+ setup and authentication. The `copilot-audit` workflow in `github-commander`
86
+ handles full repo audits — this skill focuses on plan-specific review.
87
+
88
+ ## Feedback Loop & Documentation
89
+
90
+ Every phase creates a journal entry with structured tags and entry types. This
91
+ builds a searchable audit trail that informs future planning sessions.
92
+
93
+ For journal templates, tag conventions, cross-session learning patterns, and
94
+ retrospective templates, read
95
+ [references/feedback-loop.md](references/feedback-loop.md).
96
+
97
+ ## Configuration
98
+
99
+ | Variable | Default | Description |
100
+ | -------------------- | ---------- | ----------------------------------------------- |
101
+ | `MAX_PLAN_PASSES` | `2` | Maximum refinement cycles (phases 2–3 repeat) |
102
+ | `PLAN_REVIEW_DEPTH` | `standard` | Review depth: `light`, `standard`, or `deep` |
103
+ | `COPILOT_VALIDATION` | `true` | Enable/disable the Copilot CLI validation phase |
104
+
105
+ ### Review Depth Profiles
106
+
107
+ - **Light**: Focus on correctness and security only. Best for small, low-risk
108
+ changes.
109
+ - **Standard**: Full 5-dimension review. Default for most planning tasks.
110
+ - **Deep**: Extended review with additional focus on long-term maintainability,
111
+ API surface design, and migration safety. Use for architectural decisions.
112
+
113
+ ## Synergies
114
+
115
+ | Skill/Workflow | Relationship |
116
+ | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
117
+ | `autonomous-dev` | The Generator/Evaluator pipeline in `autonomous-dev` applies at the code level; this skill applies the same adversarial pattern at the planning level |
118
+ | `github-copilot-cli` | Provides the CLI setup and auth required for Phase 4 |
119
+ | `github-commander/copilot-audit` | Full repo/PR audit; this skill uses Copilot for plan-specific review instead |
120
+ | `skill-builder` | Use to refine this skill's instructions based on observed agent behavior |
@@ -0,0 +1,98 @@
1
+ # Copilot Integration
2
+
3
+ Reference for Phase 4 of the adversarial planning protocol — the independent
4
+ external validation pass using the GitHub Copilot CLI.
5
+
6
+ ## Why Copilot?
7
+
8
+ After self-adversarial review (Phases 2–3), confirmation bias can still persist
9
+ because the same model produced both the plan and the critique. The Copilot CLI
10
+ invokes a fundamentally different model with a separate context window, catching
11
+ blind spots that internal review misses.
12
+
13
+ ## Prerequisites
14
+
15
+ 1. **Copilot CLI installed**: `npm list -g @github/copilot`
16
+ 2. **Authenticated**: `copilot auth` (requires browser approval)
17
+ 3. **Skill dependency**: The `github-copilot-cli` skill documents setup details
18
+
19
+ If Copilot CLI is not available, skip Phase 4 gracefully and note the skip in
20
+ the journal entry.
21
+
22
+ ## Plan-Specific Prompt Templates
23
+
24
+ These prompts differ from the full codebase/PR audit prompts in
25
+ `github-commander/workflows/copilot-audit.md` — they focus on architectural
26
+ decisions rather than code diffs.
27
+
28
+ ### Architecture Review
29
+
30
+ ```bash
31
+ echo "You are a senior systems architect. Review this implementation plan for a software project. Focus on:
32
+ 1. Architectural soundness — are the proposed abstractions appropriate?
33
+ 2. Security gaps — are there missing auth checks, injection vectors, or data boundary issues?
34
+ 3. Performance risks — will this scale? Are there N+1 queries or hot-path allocations?
35
+ 4. Missing considerations — what did the planner forget?
36
+ 5. Task ordering — are dependencies correctly sequenced?
37
+
38
+ Here is the plan:
39
+
40
+ $(cat plan.md)
41
+
42
+ Output a Markdown table of findings with columns: #, Category, Severity (Critical/Moderate/Low), Finding, Suggestion." | copilot
43
+ ```
44
+
45
+ ### Roadmap/Milestone Review
46
+
47
+ ```bash
48
+ echo "You are a technical program manager reviewing a project roadmap. Evaluate:
49
+ 1. Scope creep — are the milestones focused and achievable?
50
+ 2. Risk distribution — are high-risk items front-loaded for early feedback?
51
+ 3. Dependency chains — are there single points of failure in the timeline?
52
+ 4. Resource assumptions — are the estimates realistic?
53
+ 5. Missing milestones — what validation checkpoints are missing?
54
+
55
+ Here is the roadmap:
56
+
57
+ $(cat roadmap.md)
58
+
59
+ Output a structured assessment with recommendations." | copilot
60
+ ```
61
+
62
+ ### Targeted Security Review
63
+
64
+ For plans that touch authentication, data access, or external integrations:
65
+
66
+ ```bash
67
+ echo "You are a security engineer. This implementation plan proposes changes to a system. Review it exclusively for security implications:
68
+ 1. New attack surfaces introduced
69
+ 2. Auth/authz gaps
70
+ 3. Data validation boundaries
71
+ 4. Secret management
72
+ 5. Supply chain risks from new dependencies
73
+
74
+ Plan:
75
+
76
+ $(cat plan.md)
77
+
78
+ List each finding with severity and a concrete mitigation." | copilot
79
+ ```
80
+
81
+ ## Parsing Copilot Output
82
+
83
+ Copilot returns unstructured Markdown. To integrate findings into the protocol:
84
+
85
+ 1. **Extract findings** — parse the Markdown for tables or numbered lists
86
+ 2. **Map to dimensions** — classify each finding against the 5 review dimensions
87
+ (Correctness, Security, Performance, Maintainability, Completeness)
88
+ 3. **Deduplicate** — compare against Phase 2 findings; skip items already
89
+ addressed in the refinement
90
+ 4. **Disposition** — apply the same Accept/Reject/Modify framework from Phase 3
91
+
92
+ ## Cross-References
93
+
94
+ - **`github-copilot-cli` skill** — CLI installation, authentication, and
95
+ non-interactive piping patterns
96
+ - **`github-commander/workflows/copilot-audit.md`** — Full repo and PR-level
97
+ audits; use that workflow for post-implementation validation rather than
98
+ plan review
@@ -0,0 +1,148 @@
1
+ # Feedback Loop & Documentation
2
+
3
+ Reference for journaling, cross-session learning, and retrospective patterns
4
+ used throughout the adversarial planning protocol.
5
+
6
+ ## Journal Entry Templates
7
+
8
+ Each phase of the protocol creates a journal entry using `create_entry`. The
9
+ structured entry types and tags enable precise retrieval in future sessions.
10
+
11
+ ### Phase 1 — Plan Draft
12
+
13
+ ```
14
+ create_entry({
15
+ content: "# Plan Draft: [Title]\n\n[full plan content]",
16
+ entry_type: "plan_draft",
17
+ tags: ["adversarial-planner", "plan-draft"],
18
+ issue_number: <GitHub issue if applicable>,
19
+ project_number: <project number if applicable>
20
+ })
21
+ ```
22
+
23
+ ### Phase 2 — Adversarial Review
24
+
25
+ ```
26
+ create_entry({
27
+ content: "# Adversarial Review: [Title]\n\nOverall Score: X/5.0\n\n[critique table and scores]",
28
+ entry_type: "adversarial_review",
29
+ tags: ["adversarial-planner", "review"],
30
+ issue_number: <same issue>
31
+ })
32
+ ```
33
+
34
+ ### Phase 3 — Plan Refinement
35
+
36
+ ```
37
+ create_entry({
38
+ content: "# Plan Refinement: [Title]\n\n[disposition table + updated sections]",
39
+ entry_type: "plan_refinement",
40
+ tags: ["adversarial-planner", "refinement"],
41
+ issue_number: <same issue>
42
+ })
43
+ ```
44
+
45
+ ### Phase 4 — Copilot Validation
46
+
47
+ ```
48
+ create_entry({
49
+ content: "# Copilot Validation: [Title]\n\n[copilot findings + final dispositions]",
50
+ entry_type: "copilot_validation",
51
+ tags: ["adversarial-planner", "copilot"],
52
+ issue_number: <same issue>
53
+ })
54
+ ```
55
+
56
+ ## Linking Entries
57
+
58
+ Connect planning entries to each other and to related work using relationships:
59
+
60
+ ```
61
+ link_entries({
62
+ from_entry_id: <review_entry_id>,
63
+ to_entry_id: <draft_entry_id>,
64
+ relationship_type: "references",
65
+ description: "Adversarial review of plan draft"
66
+ })
67
+
68
+ link_entries({
69
+ from_entry_id: <refinement_entry_id>,
70
+ to_entry_id: <review_entry_id>,
71
+ relationship_type: "evolves_from",
72
+ description: "Refined plan based on adversarial review findings"
73
+ })
74
+
75
+ link_entries({
76
+ from_entry_id: <implementation_entry_id>,
77
+ to_entry_id: <refinement_entry_id>,
78
+ relationship_type: "implements",
79
+ description: "Implementation of approved adversarial plan"
80
+ })
81
+ ```
82
+
83
+ ## Cross-Session Learning
84
+
85
+ Before starting a new plan, search for prior planning sessions to avoid
86
+ repeating past mistakes and to reuse successful patterns.
87
+
88
+ ### Find Prior Plans in the Same Domain
89
+
90
+ ```
91
+ search_entries({
92
+ query: "<feature area or component name>",
93
+ entry_type: "plan_draft",
94
+ tags: ["adversarial-planner"]
95
+ })
96
+ ```
97
+
98
+ ### Find Recurring Review Findings
99
+
100
+ If the same critique comes up repeatedly across plans, it signals a systemic
101
+ pattern worth addressing at the architecture level:
102
+
103
+ ```
104
+ search_entries({
105
+ query: "<recurring issue, e.g., 'missing auth check'>",
106
+ entry_type: "adversarial_review",
107
+ tags: ["adversarial-planner", "review"]
108
+ })
109
+ ```
110
+
111
+ ### Find Plans for a Specific Issue
112
+
113
+ ```
114
+ search_entries({
115
+ query: "plan",
116
+ issue_number: <issue_number>,
117
+ tags: ["adversarial-planner"]
118
+ })
119
+ ```
120
+
121
+ ## Session Retrospective
122
+
123
+ After completing a full planning cycle (all 4 phases), create a retrospective
124
+ entry summarizing key insights from both agents and Copilot. This is the
125
+ primary mechanism for building institutional knowledge about planning quality.
126
+
127
+ ### Retrospective Template
128
+
129
+ ```
130
+ create_entry({
131
+ content: "# Adversarial Planning Retrospective: [Title]\n\n## Key Insights\n- [What the planner missed that the reviewer caught]\n- [What Copilot caught that internal review missed]\n- [Patterns worth institutionalizing]\n\n## Metrics\n- Initial plan score: X/5.0\n- Final plan score: Y/5.0\n- Refinement passes: N\n- Critical findings addressed: M\n\n## Process Improvements\n- [Adjustments for future planning cycles]",
132
+ entry_type: "retrospective",
133
+ tags: ["adversarial-planner", "retrospective", "session-summary"],
134
+ project_number: <project number>
135
+ })
136
+ ```
137
+
138
+ ## Tag Convention
139
+
140
+ | Tag | Purpose |
141
+ | --------------------- | ---------------------------------------------- |
142
+ | `adversarial-planner` | All entries from this skill (primary filter) |
143
+ | `plan-draft` | Phase 1 output |
144
+ | `review` | Phase 2 output |
145
+ | `refinement` | Phase 3 output |
146
+ | `copilot` | Phase 4 output |
147
+ | `retrospective` | Post-cycle summary |
148
+ | `session-summary` | Enables retrieval via session summary searches |
@@ -0,0 +1,225 @@
1
+ # Multi-Pass Protocol
2
+
3
+ Detailed reference for the 4-phase adversarial planning workflow. Read this
4
+ when executing the protocol for the full review dimensions, scoring system, and
5
+ output templates.
6
+
7
+ ## Phase 1 — Initial Planning (Agent A: Planner)
8
+
9
+ ### Inputs
10
+
11
+ Before drafting, gather context from these sources:
12
+
13
+ 1. **User request** — the stated requirements, constraints, and preferences
14
+ 2. **Codebase context** — existing architecture, patterns, and conventions
15
+ 3. **Prior plans** — search the journal for related planning entries:
16
+ ```
17
+ search_entries({
18
+ query: "<feature area>",
19
+ entry_type: "plan_draft",
20
+ tags: ["adversarial-planner"]
21
+ })
22
+ ```
23
+ 4. **Linked issues/PRs** — any GitHub issues or PRs referenced in the request
24
+
25
+ ### Draft Structure
26
+
27
+ Produce a Markdown plan document with these sections:
28
+
29
+ ```markdown
30
+ # [Feature/Change Title]
31
+
32
+ ## Scope
33
+
34
+ What is included and explicitly excluded.
35
+
36
+ ## Context
37
+
38
+ Background, motivation, and dependencies on existing systems.
39
+
40
+ ## Proposed Changes
41
+
42
+ Group by component. For each file:
43
+
44
+ - What changes and why
45
+ - New dependencies introduced
46
+ - Breaking changes (if any)
47
+
48
+ ## Task Ordering
49
+
50
+ Numbered sequence with dependencies noted.
51
+ Which tasks can be parallelized.
52
+
53
+ ## Risk Assessment
54
+
55
+ | Risk | Likelihood | Impact | Mitigation |
56
+ | ---- | ---------- | ------ | ---------- |
57
+
58
+ ## Open Questions
59
+
60
+ Anything requiring user input before proceeding.
61
+ ```
62
+
63
+ ### Journal
64
+
65
+ ```
66
+ create_entry({
67
+ content: "<full plan draft>",
68
+ entry_type: "plan_draft",
69
+ tags: ["adversarial-planner", "plan-draft"],
70
+ issue_number: <if applicable>,
71
+ project_number: <if applicable>
72
+ })
73
+ ```
74
+
75
+ ## Phase 2 — Adversarial Review (Agent B: Reviewer)
76
+
77
+ Switch mental models. You are now a skeptical senior reviewer whose job is to
78
+ find every weakness in the plan. Do not defend the Planner's decisions — your
79
+ job is to break them.
80
+
81
+ ### Review Dimensions
82
+
83
+ Score each dimension on a 1–5 scale. Dimensions have different weights
84
+ reflecting their relative importance:
85
+
86
+ | Dimension | Weight | Focus Areas |
87
+ | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
88
+ | **Correctness** | 3 | Logic errors, edge cases, race conditions, error handling gaps, incorrect assumptions about existing APIs |
89
+ | **Security** | 3 | Injection vectors, auth/authz gaps, data boundary validation, secret handling, input sanitization |
90
+ | **Performance** | 2 | Algorithmic complexity, unnecessary allocations, N+1 queries, missing caching opportunities, hot-path impact |
91
+ | **Maintainability** | 2 | Coupling, cohesion, single-responsibility violations, naming clarity, testability, documentation debt |
92
+ | **Completeness** | 1 | Missing tests, missing docs, migration gaps, rollback strategy, monitoring/observability |
93
+
94
+ ### Depth Profiles
95
+
96
+ The `PLAN_REVIEW_DEPTH` configuration controls which dimensions receive full
97
+ scrutiny:
98
+
99
+ - **Light**: Correctness + Security only (weights 3+3)
100
+ - **Standard**: All 5 dimensions at stated weights
101
+ - **Deep**: All 5 dimensions + extended analysis:
102
+ - API surface backward compatibility
103
+ - Long-term migration path (will this need to be redone in 6 months?)
104
+ - Cross-project impact (does this affect other repos in the ecosystem?)
105
+
106
+ ### Critique Output Format
107
+
108
+ ```markdown
109
+ ## Adversarial Review — [Feature/Change Title]
110
+
111
+ **Overall Score:** [weighted average] / 5.0
112
+
113
+ ### Findings
114
+
115
+ | # | Dimension | Severity | Finding | Remediation |
116
+ | --- | ----------- | -------- | ----------------------------------- | ------------------------------------------------- |
117
+ | 1 | Security | Critical | API endpoint lacks auth middleware | Add scope check using existing hasScope() pattern |
118
+ | 2 | Correctness | Moderate | Race condition in concurrent writes | Use DB transaction wrapping |
119
+ | 3 | Performance | Low | Unnecessary full-table scan | Add index on lookup column |
120
+
121
+ ### Dimension Scores
122
+
123
+ | Dimension | Score | Weight | Weighted |
124
+ | --------------- | ----- | ------ | ---------------- |
125
+ | Correctness | 4 | 3 | 12 |
126
+ | Security | 2 | 3 | 6 |
127
+ | Performance | 4 | 2 | 8 |
128
+ | Maintainability | 3 | 2 | 6 |
129
+ | Completeness | 4 | 1 | 4 |
130
+ | **Total** | | **11** | **36/55 = 3.27** |
131
+
132
+ ### Blocking Issues
133
+
134
+ List any findings that MUST be addressed before the plan can proceed.
135
+ ```
136
+
137
+ ### Journal
138
+
139
+ ```
140
+ create_entry({
141
+ content: "<full critique>",
142
+ entry_type: "adversarial_review",
143
+ tags: ["adversarial-planner", "review"],
144
+ issue_number: <if applicable>
145
+ })
146
+ ```
147
+
148
+ ## Phase 3 — Plan Refinement (Agent A: Planner)
149
+
150
+ Switch back to the Planner role. Address every finding from the adversarial
151
+ review with an explicit disposition:
152
+
153
+ ### Disposition Table
154
+
155
+ For each finding, record one of:
156
+
157
+ | Disposition | Meaning |
158
+ | ----------- | ------------------------------------------------------------------- |
159
+ | **Accept** | Incorporate the suggestion into the refined plan |
160
+ | **Reject** | Explain why the finding does not apply or is not worth addressing |
161
+ | **Modify** | Accept the spirit of the finding but implement a different solution |
162
+
163
+ ### Refined Plan Output
164
+
165
+ Produce the refined plan as a delta against the original:
166
+
167
+ ```markdown
168
+ ## Plan Refinement — [Feature/Change Title]
169
+
170
+ ### Disposition Summary
171
+
172
+ | # | Finding | Disposition | Rationale |
173
+ | --- | --------------- | ----------- | ------------------------------------------------- |
174
+ | 1 | API lacks auth | Accept | Added scope check to proposed changes |
175
+ | 2 | Race condition | Modify | Using optimistic locking instead of transactions |
176
+ | 3 | Full-table scan | Reject | Table has <100 rows, index overhead not justified |
177
+
178
+ ### Updated Sections
179
+
180
+ [Only include sections that changed, with clear diff annotations]
181
+ ```
182
+
183
+ ### Iteration Control
184
+
185
+ After refinement, check: has `MAX_PLAN_PASSES` been reached?
186
+
187
+ - **No** → return to Phase 2 for another adversarial review of the refined plan
188
+ - **Yes** → proceed to Phase 4
189
+
190
+ The default of 2 passes means: 1 initial review + 1 review of the refinement.
191
+ For most plans this is sufficient. Increase for high-stakes architectural
192
+ decisions.
193
+
194
+ ### Journal
195
+
196
+ ```
197
+ create_entry({
198
+ content: "<refinement with dispositions>",
199
+ entry_type: "plan_refinement",
200
+ tags: ["adversarial-planner", "refinement"],
201
+ issue_number: <if applicable>
202
+ })
203
+ ```
204
+
205
+ ## Phase 4 — Copilot Validation (External)
206
+
207
+ If `COPILOT_VALIDATION` is enabled (default: `true`), invoke the Copilot CLI
208
+ for an independent review of the finalized plan.
209
+
210
+ See [copilot-integration.md](copilot-integration.md) for prompt templates and
211
+ parsing guidance.
212
+
213
+ After the Copilot pass, any new findings follow the same disposition process
214
+ from Phase 3. The final plan is then presented to the user for approval.
215
+
216
+ ### Journal
217
+
218
+ ```
219
+ create_entry({
220
+ content: "<copilot findings + final dispositions>",
221
+ entry_type: "copilot_validation",
222
+ tags: ["adversarial-planner", "copilot"],
223
+ issue_number: <if applicable>
224
+ })
225
+ ```
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neverinfamous-agent-skills",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Foundational AI agent metacognitive skills and workflows for the Adamic ecosystem.",
5
5
  "type": "module",
6
6
  "main": "README.md",
@@ -11,6 +11,7 @@
11
11
  "bin/",
12
12
  "README.md",
13
13
  "autonomous-dev/",
14
+ "adversarial-planner/",
14
15
  "bun/",
15
16
  "docker/",
16
17
  "github-actions/",
@@ -1 +0,0 @@
1
- export { callTool, getTools } from './chunk-SYTB5YNH.js';