debug-ledger-mcp 0.1.0 → 0.1.2

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.
@@ -0,0 +1,139 @@
1
+ ## Debug Ledger Guidelines
2
+
3
+ This ledger exists to preserve *debugging memory* that would otherwise be lost.
4
+ - It is not a log.
5
+ - It is not documentation.
6
+ - It is not a place to think out loud.
7
+
8
+ Only write here when forgetting this information would cause real damage.
9
+
10
+ ---
11
+
12
+ ## Write After Pain
13
+
14
+ Only write ledger entries *after something went wrong*.
15
+
16
+ Valid triggers include:
17
+ - A production incident
18
+ - A recurring bug that took time to understand
19
+ - A fix that looked correct but caused regressions
20
+ - A test that exists only because reality was worse than expected
21
+
22
+ Do *not* write speculative entries.
23
+ Do *not* write “just in case” notes.
24
+ Do *not* write during initial development.
25
+
26
+ If it didn’t cost time, trust, or effort, it does not belong here.
27
+
28
+ ---
29
+
30
+ ## Historical Truth, Not Ground Truth
31
+
32
+ The ledger does *not* define how the system _should_ work.
33
+ It records how the system *actually failed in the past*.
34
+
35
+ Entries may describe:
36
+ - Bad decisions that were necessary
37
+ - Ugly code that protects against worse outcomes
38
+ - Constraints imposed by legacy, scale, or external systems
39
+
40
+ An entry being present does *not* mean it is ideal.
41
+ It means it was *paid for*.
42
+
43
+ ---
44
+
45
+ ## Negative Knowledge Matters
46
+
47
+ The most valuable information is often:
48
+ - What did *not* work
49
+ - What made things worse
50
+ - What was rolled back
51
+ - What must not be repeated
52
+
53
+ This ledger explicitly values:
54
+ - Rejected fixes
55
+ - Failed refactors
56
+ - Removed “cleanups”
57
+ - Tests that seem redundant but prevent regressions
58
+
59
+ Remembering failure prevents repeating it.
60
+
61
+ ---
62
+
63
+ ## What Qualifies as a Valid Entry
64
+
65
+ A ledger entry must:
66
+ - Describe a real past problem
67
+ - Explain why it was hard or non-obvious
68
+ - Record what failed or must not be repeated
69
+ - Protect future maintainers from re-learning the same lesson
70
+
71
+ Each entry should answer at least one of:
72
+ - “Why does this code look wrong?”
73
+ - “Why can’t we simplify this?”
74
+ - “Why does this test exist?”
75
+ - “Why did this bug come back before?”
76
+
77
+ If an entry cannot prevent a future regression, it does not qualify.
78
+
79
+ ---
80
+
81
+ ## File Structure Rule
82
+
83
+ Each ledger entry must live in its own file.
84
+
85
+ Do not append multiple entries into a single file.
86
+
87
+ Use descriptive filenames in the format:
88
+
89
+ - constraints-`<topic>`.md
90
+ - incidents-`<area>`.md
91
+ - regressions-`<area>`.md
92
+ - rejected_fixes-`<topic>`.md
93
+
94
+ Examples:
95
+ - constraints-api.md
96
+ - regressions-cart.md
97
+ - rejected_fixes-timeout.md
98
+
99
+ One failure = one file.
100
+
101
+ ---
102
+
103
+ ## What Does NOT Belong in the Ledger
104
+
105
+ Do *not* add:
106
+ - Stack traces
107
+ - Logs
108
+ - Debug output
109
+ - Temporary investigation notes
110
+ - Speculative theories
111
+ - Design discussions
112
+ - Feature ideas
113
+ - TODOs
114
+
115
+ Do *not* duplicate:
116
+ - Issue trackers
117
+ - Test cases
118
+ - Documentation
119
+
120
+ ## Do Not Aggregate Entries
121
+
122
+ Do not create large files containing many unrelated issues.
123
+
124
+ The ledger is indexed by filename.
125
+
126
+ Future agents and developers rely on file names to decide what to read.
127
+
128
+ Keep entries isolated.
129
+
130
+ This ledger is *small by design*.
131
+
132
+ ---
133
+
134
+ ## Final Rule
135
+
136
+ If reading this entry would not change how a future fix is made,
137
+ *delete it*.
138
+
139
+ This ledger protects memory — not completeness.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -12,7 +12,7 @@ const LEDGER_DIR = path.resolve(process.cwd(), "debug_ledger");
12
12
  export function listLedgerFiles() {
13
13
  // check folder exists
14
14
  if (!fs.existsSync(LEDGER_DIR)) {
15
- throw new Error("debug_ledger folder not found");
15
+ return [];
16
16
  }
17
17
  const files = fs.readdirSync(LEDGER_DIR);
18
18
  // only markdown files
@@ -20,7 +20,6 @@ const server = new Server({
20
20
  },
21
21
  });
22
22
  import { listLedgerFiles } from "./ledgerIndexer.js";
23
- const files = listLedgerFiles();
24
23
  /**
25
24
  * Tool registry
26
25
  * These describe WHAT the server exposes, not HOW it works
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ const projectDir = process.cwd();
7
+ const ledgerDir = path.join(projectDir, "debug_ledger");
8
+ if (fs.existsSync(ledgerDir)) {
9
+ console.log("debug_ledger/ already exists — skipping setup");
10
+ process.exit(0);
11
+ }
12
+ const sourceDir = path.join(__dirname, "../../debug_ledger");
13
+ fs.mkdirSync(ledgerDir);
14
+ const files = fs.readdirSync(sourceDir);
15
+ files.forEach((file) => {
16
+ if (file.endsWith(".md")) {
17
+ fs.copyFileSync(path.join(sourceDir, file), path.join(ledgerDir, file));
18
+ }
19
+ });
20
+ console.log("debug_ledger/ created with example files");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "debug-ledger-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Read-only debug memory for AI — a repo-local ledger of past bugs, rejected fixes, and historical constraints so AI debugs with context, not amnesia.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,12 +10,14 @@
10
10
  "debug-ledger-mcp": "./dist/mcp/server.js"
11
11
  },
12
12
  "files": [
13
- "dist/"
13
+ "dist/",
14
+ "debug_ledger/"
14
15
  ],
15
16
  "scripts": {
16
17
  "build": "tsc",
17
18
  "start": "node dist/mcp/server.js",
18
- "prepublishOnly": "npm run build"
19
+ "prepublishOnly": "npm run build",
20
+ "postinstall": "node dist/mcp/setup.js"
19
21
  },
20
22
  "license": "MIT",
21
23
  "devDependencies": {