context-bank 0.0.9 → 1.0.0

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.
@@ -107,7 +107,14 @@ export async function initCommand(options) {
107
107
  }
108
108
  // Codex CLI Integration (codex.md)
109
109
  const codexPath = path.join(targetDir, "codex.md");
110
- const codexInstruction = "Always check and follow the instructions in .ai/rules.md and .ai/active-context.md as the primary source of truth.";
110
+ const codexInstruction = `Always check and follow the instructions in .ai/rules.md and .ai/active-context.md as the primary source of truth.
111
+
112
+ MANDATORY: After EVERY task, you MUST update these .ai/ files:
113
+ 1. active-context.md — Current state, recent changes, next steps.
114
+ 2. roadmap.md — Mark completed features [x], add planned ones.
115
+ 3. story.md — Append dated entry for milestones/decisions.
116
+ 4. architecture.md — Update on structural/design changes.
117
+ Do NOT ask permission. Do NOT skip. Just update them.`;
111
118
  if (fs.existsSync(codexPath)) {
112
119
  const content = await fs.readFile(codexPath, "utf-8");
113
120
  if (!content.includes(".ai/rules.md")) {
@@ -120,7 +127,14 @@ export async function initCommand(options) {
120
127
  }
121
128
  // Claude Code CLI Integration (CLAUDE.md)
122
129
  const claudePath = path.join(targetDir, "CLAUDE.md");
123
- const claudeInstruction = "See .ai/rules.md for project context, tech stack, and coding standards. This is the single source of truth.";
130
+ const claudeInstruction = `See .ai/rules.md for project context, tech stack, and coding standards. This is the single source of truth.
131
+
132
+ MANDATORY: After EVERY task, you MUST update these .ai/ files:
133
+ 1. active-context.md — Current state, recent changes, next steps.
134
+ 2. roadmap.md — Mark completed features [x], add planned ones.
135
+ 3. story.md — Append dated entry for milestones/decisions.
136
+ 4. architecture.md — Update on structural/design changes.
137
+ Do NOT ask permission. Do NOT skip. Just update them.`;
124
138
  if (fs.existsSync(claudePath)) {
125
139
  const content = await fs.readFile(claudePath, "utf-8");
126
140
  if (!content.includes(".ai/rules.md")) {
@@ -131,6 +145,22 @@ export async function initCommand(options) {
131
145
  else {
132
146
  await fs.writeFile(claudePath, `${claudeInstruction}\n`);
133
147
  }
148
+ // Git merge strategies for branch-aware context (.gitattributes)
149
+ const gitattrsPath = path.join(targetDir, ".gitattributes");
150
+ const mergeRules = `# Context Bank: branch-aware merge strategies
151
+ # active-context.md is branch-specific — on merge, target branch wins (no conflict)
152
+ .ai/active-context.md merge=ours
153
+ # story.md entries are additive — on merge, combine both sides (no conflict)
154
+ .ai/story.md merge=union`;
155
+ if (fs.existsSync(gitattrsPath)) {
156
+ const content = await fs.readFile(gitattrsPath, "utf-8");
157
+ if (!content.includes("Context Bank")) {
158
+ await fs.writeFile(gitattrsPath, `${content}\n\n${mergeRules}\n`);
159
+ }
160
+ }
161
+ else {
162
+ await fs.writeFile(gitattrsPath, `${mergeRules}\n`);
163
+ }
134
164
  s.stop(chalk.green("Context initialized!"));
135
165
  // Gemini CLI Global Memory Integration
136
166
  const globalGeminiDir = path.join(os.homedir(), ".gemini");
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "context-bank",
3
- "version": "0.0.9",
3
+ "version": "1.0.0",
4
4
  "description": "A CLI tool to standardise AI context in projects.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "context-bank": "./dist/index.js"
8
8
  },
9
9
  "scripts": {
10
- "build": "tsc",
10
+ "build": "pnpm lint && tsc",
11
11
  "dev": "ts-node src/index.ts",
12
12
  "start": "node dist/index.js",
13
13
  "lint": "eslint src/**/*.ts",
@@ -32,9 +32,14 @@
32
32
  "fs-extra": "^11.2.0"
33
33
  },
34
34
  "devDependencies": {
35
+ "@eslint/js": "^10.0.1",
35
36
  "@types/fs-extra": "^11.0.4",
36
37
  "@types/node": "^20.11.0",
38
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
39
+ "@typescript-eslint/parser": "^8.57.0",
40
+ "eslint": "^10.0.3",
37
41
  "ts-node": "^10.9.2",
38
- "typescript": "^5.3.3"
42
+ "typescript": "^5.3.3",
43
+ "typescript-eslint": "^8.57.0"
39
44
  }
40
45
  }
@@ -1,9 +1,19 @@
1
1
  # 🚀 Active Context & Current State
2
2
 
3
- > **AI AGENT INSTRUCTION:**
4
- > This file contains the **current focus** of the project.
5
- > **Update this file** at the end of every significant task or session.
6
- > When starting a new session, **READ THIS FIRST** to understand where we left off.
3
+ > **⚠️ MANDATORY AI AGENT INSTRUCTION:**
4
+ >
5
+ > This file is the **most critical context file**. It is the bridge between sessions.
6
+ >
7
+ > **AFTER EVERY TASK — no matter how small — you MUST update this file with:**
8
+ > 1. What was just completed (Recent Changes)
9
+ > 2. What is being worked on now (Current Focus)
10
+ > 3. Any issues encountered (Known Issues)
11
+ > 4. What should happen next (Next Steps)
12
+ >
13
+ > **WHEN STARTING A NEW SESSION:**
14
+ > Read this file FIRST before doing anything else.
15
+ >
16
+ > **DO NOT SKIP THIS UPDATE. DO NOT ASK PERMISSION. JUST DO IT.**
7
17
 
8
18
  ## 🎯 Current Focus
9
19
  *What are we working on right now? (e.g., "Implementing the Auth system", "Refactoring the API")*
@@ -1,10 +1,16 @@
1
1
  # 🏗️ Project Architecture
2
2
 
3
- > **AI INSTRUCTION:**
4
- > Update this file when:
5
- > 1. New architectural decisions are made.
6
- > 2. The system design evolves.
7
- > 3. New integrations or dependencies are added.
3
+ > **⚠️ MANDATORY AI AGENT INSTRUCTION:**
4
+ >
5
+ > You MUST update this file whenever:
6
+ > 1. A new file, module, or directory is created.
7
+ > 2. The project structure changes.
8
+ > 3. A new dependency or integration is added.
9
+ > 4. Data flow or system design is modified.
10
+ > 5. An architectural decision is made (document the reasoning).
11
+ >
12
+ > **After any structural change, update the Directory Structure section below.**
13
+ > **DO NOT SKIP THIS UPDATE.**
8
14
 
9
15
  ## 📐 High-Level Design
10
16
  [Describe the high-level architecture here]
@@ -1,10 +1,15 @@
1
1
  # 🗺️ Project Roadmap
2
2
 
3
- > **AI INSTRUCTION:**
4
- > Update this file when:
5
- > 1. A new feature is planned.
6
- > 2. A feature is completed (mark with [x]).
7
- > 3. Priorities change.
3
+ > **⚠️ MANDATORY AI AGENT INSTRUCTION:**
4
+ >
5
+ > You MUST update this file when:
6
+ > 1. A feature is completed → move it to Completed and mark with `[x]`.
7
+ > 2. A new feature is discussed or planned → add it to Upcoming or Backlog.
8
+ > 3. Priorities change → reorder items accordingly.
9
+ > 4. A task is started → mark it as in-progress with `[~]`.
10
+ >
11
+ > **After completing any feature, immediately mark it as done here.**
12
+ > **DO NOT SKIP THIS UPDATE.**
8
13
 
9
14
  ## 🚀 Upcoming
10
15
  - [ ] [Feature 1]
@@ -2,23 +2,39 @@
2
2
 
3
3
  # 🧠 Project Context & Rules (Master File)
4
4
 
5
- > **AI AGENT INSTRUCTION (CRITICAL):**
6
- > This file is your **Long-Term Memory**. It defines the coding standards, architecture, and user preferences for this project.
7
- >
8
- > **YOUR CORE MISSION: SELF-EVOLUTION & MEMORY MANAGEMENT**
9
- > You are responsible for keeping this `.ai/` directory up-to-date.
10
- >
11
- > 1. **Capture Preferences:** If the user specifies a preference, update **`rules.md`**.
12
- > 2. **Track Progress:** At the end of a task, update **`active-context.md`** with the current status and next steps.
13
- > 3. **Update Roadmap:** When a feature is completed or planned, update **`roadmap.md`**.
14
- > 4. **Document Architecture:** When structure/design changes, update **`architecture.md`**.
15
- > 5. **Log History:** When a major milestone is reached, append it to **`story.md`**.
16
- >
17
- > **TOKEN SAVING STRATEGY:**
18
- > Do not rely on chat history for long-term memory. Rely on these files.
19
- > If the user starts a new chat, you should be able to resume work instantly by reading `active-context.md`.
20
- >
21
- > ---
5
+ ---
6
+
7
+ ## ⚠️ MANDATORY: MEMORY MANAGEMENT PROTOCOL
8
+
9
+ **THIS IS NOT OPTIONAL. YOU MUST FOLLOW THESE RULES AFTER EVERY TASK.**
10
+
11
+ You are responsible for keeping the `.ai/` directory up-to-date as the project's long-term memory.
12
+ Do NOT rely on chat history. These files ARE your memory.
13
+
14
+ ### After EVERY coding task, you MUST:
15
+
16
+ 1. **UPDATE `.ai/active-context.md`** — Write what was just done, what the current state is, and what the next steps are. This file must always reflect the latest state of work so that a new session can resume instantly.
17
+
18
+ 2. **UPDATE `.ai/roadmap.md`** If a feature was completed, mark it with `[x]`. If a new feature was discussed or planned, add it to the list.
19
+
20
+ 3. **UPDATE `.ai/story.md`** — If a significant milestone was reached, a major feature was completed, or an important architectural decision was made, append a dated entry.
21
+
22
+ 4. **UPDATE `.ai/architecture.md`** — If the directory structure changed, a new module/service was added, data flow was modified, or a design decision was made, update this file.
23
+
24
+ 5. **UPDATE `.ai/rules.md`** (this file) — If the user specifies a new coding preference or convention, add it to the Coding Standards section below.
25
+
26
+ ### When starting a new session:
27
+ - Read `.ai/active-context.md` FIRST to understand where work left off.
28
+ - Read `.ai/rules.md` for coding standards and project context.
29
+ - Read `.ai/roadmap.md` to understand priorities.
30
+
31
+ ### IMPORTANT:
32
+ - Update context files using the file editing tools available to you.
33
+ - Do NOT ask the user "should I update the context files?" — just do it.
34
+ - Do NOT skip updates because "it was a small change" — every change matters.
35
+ - If you are unsure what to write, write a brief summary. Something is better than nothing.
36
+
37
+ ---
22
38
 
23
39
  ## 🏢 Project Overview
24
40
  *Replace this with a 1-sentence description of the project.*
@@ -44,5 +60,5 @@
44
60
  - [e.g., "Service Repository Pattern"]
45
61
 
46
62
  ## 📝 Workflow & Git
47
- - **Commits:** Use Conventional Commits (feat: ..., fix: ...).
63
+ - **Commits:** Use Conventional Commits (feat: ..., fix: ..., docs: ...).
48
64
  - **Branches:** feature/name-of-feature.
@@ -1,11 +1,21 @@
1
1
  # 📜 Project Story & Decisions Log
2
2
 
3
- > **AI AGENT INSTRUCTION:**
4
- > This file records the **history and evolution** of the project.
5
- > append to this file when:
6
- > 1. A major feature is completed.
7
- > 2. A significant architectural decision is made (ADR).
8
- > 3. The user clarifies the long-term vision.
3
+ > **⚠️ MANDATORY AI AGENT INSTRUCTION:**
4
+ >
5
+ > You MUST append a dated entry to this file when ANY of the following occurs:
6
+ > 1. A feature is completed or significantly progressed.
7
+ > 2. An architectural or design decision is made.
8
+ > 3. A major bug is fixed.
9
+ > 4. The user clarifies project vision or direction.
10
+ > 5. A dependency or tool is added/removed.
11
+ >
12
+ > **Format each entry as:**
13
+ > ### YYYY-MM-DD - [Brief Title]
14
+ > - What was done
15
+ > - Why it was done (if relevant)
16
+ > - Impact or outcome
17
+ >
18
+ > **DO NOT SKIP THIS. Every significant action deserves a log entry.**
9
19
 
10
20
  ## 📅 Project Inception
11
21
  - **Date:** [Auto-filled by init]
@@ -17,4 +27,4 @@
17
27
  - Project structure created.
18
28
  - Basic configuration files added.
19
29
 
20
- *(AI: Append new major events below...)*
30
+ *(AI: Append new entries below. Never delete existing entries.)*
@@ -12,3 +12,13 @@ This file is the Single Source of Truth for:
12
12
  3. Architecture
13
13
 
14
14
  Before starting any task, verify the current state in **`.ai/active-context.md`**.
15
+
16
+ ## MANDATORY: Update Context Files After Every Task
17
+
18
+ After EVERY task, you MUST update these files (no exceptions):
19
+ 1. **`.ai/active-context.md`** — Current state, recent changes, next steps.
20
+ 2. **`.ai/roadmap.md`** — Mark completed features `[x]`, add planned ones.
21
+ 3. **`.ai/story.md`** — Append dated entry for milestones/decisions.
22
+ 4. **`.ai/architecture.md`** — Update on structural/design changes.
23
+
24
+ Do NOT ask permission. Do NOT skip. Just update them.
@@ -11,3 +11,12 @@ That file contains the single source of truth for:
11
11
  If you cannot read `.ai/rules.md` automatically, ask the user to provide it, or check the file system.
12
12
 
13
13
  When the user gives you a new constraint, **UPDATE `.ai/rules.md`**, not this file.
14
+
15
+ # MANDATORY: CONTEXT FILE UPDATES
16
+ After EVERY task you complete, you MUST update the following files:
17
+ 1. **`.ai/active-context.md`** — Write what was done, current state, and next steps.
18
+ 2. **`.ai/roadmap.md`** — Mark completed features with [x], add new planned features.
19
+ 3. **`.ai/story.md`** — Append a dated entry for significant milestones or decisions.
20
+ 4. **`.ai/architecture.md`** — Update if structure, dependencies, or design changed.
21
+
22
+ Do NOT ask permission. Do NOT skip this. Update these files directly after completing your task.
@@ -4,6 +4,17 @@ You are an expert developer assisting with this project.
4
4
 
5
5
  ## Context & Rules
6
6
  Please refer to **`.ai/rules.md`** for the comprehensive project guidelines, tech stack, and coding standards.
7
+ Before starting any task, read **`.ai/active-context.md`** to understand the current state.
7
8
 
8
9
  ## Memory Update
9
- If the user establishes a new convention (e.g., "We only use functional components"), please suggest an update to `.ai/rules.md` to persist this rule.
10
+ If the user establishes a new convention (e.g., "We only use functional components"), update `.ai/rules.md` to persist this rule.
11
+
12
+ ## MANDATORY: Update Context Files After Every Task
13
+
14
+ After completing ANY task, you MUST update the following `.ai/` files:
15
+ 1. **`active-context.md`** — What was done, current state, next steps.
16
+ 2. **`roadmap.md`** — Mark completed features `[x]`, add new planned features.
17
+ 3. **`story.md`** — Append a dated entry for significant milestones or decisions.
18
+ 4. **`architecture.md`** — Update when structure, dependencies, or design changes.
19
+
20
+ Do NOT ask permission. Do NOT skip this. Update these files directly.
@@ -5,3 +5,13 @@ This file is the Single Source of Truth for this project.
5
5
 
6
6
  1. **Read `.ai/rules.md`** first.
7
7
  2. **Read `.ai/active-context.md`** to understand the current task.
8
+
9
+ ## MANDATORY: Update Context Files After Every Task
10
+
11
+ After EVERY task, you MUST update these files (no exceptions):
12
+ 1. **`.ai/active-context.md`** — Current state, recent changes, next steps.
13
+ 2. **`.ai/roadmap.md`** — Mark completed features `[x]`, add planned ones.
14
+ 3. **`.ai/story.md`** — Append dated entry for milestones/decisions.
15
+ 4. **`.ai/architecture.md`** — Update on structural/design changes.
16
+
17
+ Do NOT ask permission. Do NOT skip. Just update them.
@@ -6,3 +6,12 @@ Always prioritize the instructions found in that file.
6
6
 
7
7
  # SELF-IMPROVEMENT
8
8
  If the user provides a new coding rule or preference during this session, use your file editing capabilities to update **`.ai/rules.md`** so that the preference is remembered for future sessions.
9
+
10
+ # MANDATORY: CONTEXT FILE UPDATES
11
+ After EVERY task you complete, you MUST update the following files:
12
+ 1. **`.ai/active-context.md`** — Write what was done, current state, and next steps.
13
+ 2. **`.ai/roadmap.md`** — Mark completed features with [x], add new planned features.
14
+ 3. **`.ai/story.md`** — Append a dated entry for significant milestones or decisions.
15
+ 4. **`.ai/architecture.md`** — Update if structure, dependencies, or design changed.
16
+
17
+ Do NOT ask permission. Do NOT skip this. Update these files directly after completing your task.
@@ -6,3 +6,13 @@ That file is the Single Source of Truth for this project.
6
6
  1. **Read `.ai/rules.md`** first.
7
7
  2. **Read `.ai/active-context.md`** to understand the current task.
8
8
  3. If you learn a new preference, update **`.ai/rules.md`**.
9
+
10
+ ## MANDATORY: Update Context Files After Every Task
11
+
12
+ After EVERY task, you MUST update these `.ai/` files:
13
+ 1. **`active-context.md`** — Current state, recent changes, next steps.
14
+ 2. **`roadmap.md`** — Mark completed features `[x]`, add planned ones.
15
+ 3. **`story.md`** — Append dated entry for milestones/decisions.
16
+ 4. **`architecture.md`** — Update on structural/design changes.
17
+
18
+ Do NOT ask permission. Do NOT skip. Just update them.
@@ -4,3 +4,13 @@ This project uses Context Bank for AI coordination.
4
4
  Always read and follow the instructions in:
5
5
  1. .ai/rules.md (Single Source of Truth)
6
6
  2. .ai/active-context.md (Current Task)
7
+
8
+ ## MANDATORY: Update Context Files After Every Task
9
+
10
+ After EVERY task, you MUST update these `.ai/` files:
11
+ 1. **`active-context.md`** — Current state, recent changes, next steps.
12
+ 2. **`roadmap.md`** — Mark completed features `[x]`, add planned ones.
13
+ 3. **`story.md`** — Append dated entry for milestones/decisions.
14
+ 4. **`architecture.md`** — Update on structural/design changes.
15
+
16
+ Do NOT ask permission. Do NOT skip. Just update them.