@techwavedev/agi-agent-kit 1.1.7 → 1.2.7

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +142 -1
  2. package/README.md +195 -15
  3. package/bin/init.js +154 -5
  4. package/package.json +6 -3
  5. package/templates/base/AGENTS.md +54 -23
  6. package/templates/base/README.md +327 -0
  7. package/templates/base/directives/memory_integration.md +95 -0
  8. package/templates/base/execution/memory_manager.py +309 -0
  9. package/templates/base/execution/session_boot.py +218 -0
  10. package/templates/base/execution/session_init.py +320 -0
  11. package/templates/base/requirements.txt +45 -6
  12. package/templates/base/skill-creator/SKILL_skillcreator.md +3 -3
  13. package/templates/skills/knowledge/design-md/README.md +0 -0
  14. package/templates/skills/knowledge/design-md/SKILL.md +0 -0
  15. package/templates/skills/knowledge/design-md/examples/DESIGN.md +0 -0
  16. package/templates/skills/knowledge/intelligent-routing/SKILL.md +237 -164
  17. package/templates/skills/knowledge/notebooklm-rag/SKILL.md +216 -0
  18. package/templates/skills/knowledge/notebooklm-rag/requirements.txt +9 -0
  19. package/templates/skills/knowledge/notebooklm-rag/scripts/ask_question.py +237 -0
  20. package/templates/skills/knowledge/notebooklm-rag/scripts/auth_manager.py +307 -0
  21. package/templates/skills/knowledge/notebooklm-rag/scripts/browser_utils.py +101 -0
  22. package/templates/skills/knowledge/notebooklm-rag/scripts/cleanup_manager.py +87 -0
  23. package/templates/skills/knowledge/notebooklm-rag/scripts/config.py +45 -0
  24. package/templates/skills/knowledge/notebooklm-rag/scripts/notebook_manager.py +334 -0
  25. package/templates/skills/knowledge/notebooklm-rag/scripts/run.py +92 -0
  26. package/templates/skills/knowledge/notebooklm-rag/scripts/setup_environment.py +68 -0
  27. package/templates/skills/knowledge/parallel-agents/SKILL.md +345 -73
  28. package/templates/skills/knowledge/plugin-discovery/SKILL.md +581 -0
  29. package/templates/skills/knowledge/plugin-discovery/scripts/platform_setup.py +1083 -0
  30. package/templates/skills/knowledge/react-components/README.md +0 -0
  31. package/templates/skills/knowledge/react-components/SKILL.md +0 -0
  32. package/templates/skills/knowledge/react-components/examples/gold-standard-card.tsx +0 -0
  33. package/templates/skills/knowledge/react-components/package-lock.json +0 -0
  34. package/templates/skills/knowledge/react-components/package.json +0 -0
  35. package/templates/skills/knowledge/react-components/resources/architecture-checklist.md +0 -0
  36. package/templates/skills/knowledge/react-components/resources/component-template.tsx +0 -0
  37. package/templates/skills/knowledge/react-components/resources/stitch-api-reference.md +0 -0
  38. package/templates/skills/knowledge/react-components/resources/style-guide.json +0 -0
  39. package/templates/skills/knowledge/react-components/scripts/validate.js +0 -0
  40. package/templates/skills/knowledge/self-update/SKILL.md +0 -0
  41. package/templates/skills/knowledge/self-update/scripts/update_kit.py +0 -0
  42. package/templates/skills/knowledge/stitch-loop/README.md +0 -0
  43. package/templates/skills/knowledge/stitch-loop/SKILL.md +3 -3
  44. package/templates/skills/knowledge/stitch-loop/examples/SITE.md +0 -0
  45. package/templates/skills/knowledge/stitch-loop/examples/next-prompt.md +0 -0
  46. package/templates/skills/knowledge/stitch-loop/resources/baton-schema.md +0 -0
  47. package/templates/skills/knowledge/stitch-loop/resources/site-template.md +0 -0
  48. package/templates/skills/stitch-loop/SKILL.md +3 -3
  49. package/templates/skills/core/qdrant-memory/scripts/__pycache__/embedding_utils.cpython-314.pyc +0 -0
  50. package/templates/skills/core/qdrant-memory/scripts/__pycache__/init_collection.cpython-314.pyc +0 -0
  51. package/templates/skills/knowledge/SKILLS_CATALOG.md +0 -796
  52. package/templates/skills/knowledge/jira/scripts/__pycache__/jira_client.cpython-314.pyc +0 -0
  53. package/templates/skills/knowledge/notebooklm-mcp/SKILL.md +0 -71
  54. package/templates/skills/knowledge/notebooklm-mcp/assets/example_asset.txt +0 -24
  55. package/templates/skills/knowledge/notebooklm-mcp/references/api_reference.md +0 -34
  56. package/templates/skills/knowledge/notebooklm-mcp/scripts/example.py +0 -19
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@techwavedev/agi-agent-kit",
3
- "version": "1.1.7",
4
- "description": "Enterprise-Grade Agentic Framework - Modular skill-based AI assistant toolkit with deterministic execution and semantic memory.",
3
+ "version": "1.2.7",
4
+ "description": "Enterprise-Grade Agentic Framework - Modular skill-based AI assistant toolkit with deterministic execution, semantic memory, and platform-adaptive orchestration.",
5
5
  "bin": {
6
6
  "agi-agent-kit": "./bin/init.js"
7
7
  },
@@ -17,9 +17,12 @@
17
17
  "skills",
18
18
  "claude",
19
19
  "gemini",
20
+ "kiro",
21
+ "opencode",
20
22
  "llm",
21
23
  "semantic-cache",
22
- "qdrant"
24
+ "qdrant",
25
+ "platform-adaptive"
23
26
  ],
24
27
  "author": "Elton Machado@techwave",
25
28
  "license": "Apache-2.0",
@@ -1,6 +1,20 @@
1
1
  # Agent Instructions
2
2
 
3
- > `CLAUDE.md` and `GEMINI.md` are symlinks to this file, so the same instructions load in any AI environment.
3
+ > `CLAUDE.md`, `GEMINI.md`, and `OPENCODE.md` are symlinks to this file, so the same instructions load in any AI environment.
4
+
5
+ ---
6
+
7
+ ## ⚡ Session Boot Protocol (MANDATORY)
8
+
9
+ **Run this ONCE at the start of every session, before any other work:**
10
+
11
+ ```bash
12
+ python3 execution/session_boot.py --auto-fix
13
+ ```
14
+
15
+ This single command checks Qdrant, Ollama, embedding models, and collections. If anything is missing, `--auto-fix` repairs it automatically. If the output shows `"memory_ready": true`, proceed normally. If it shows issues, follow the printed instructions.
16
+
17
+ **Why this matters:** The memory system provides 80-100% token savings on repeated work. Skipping this step means every query pays full token cost.
4
18
 
5
19
  ---
6
20
 
@@ -151,34 +165,51 @@ python execution/scrape_single_site.py \
151
165
 
152
166
  **All operations use the Qdrant-powered memory system by default.**
153
167
 
168
+ #### Session Start (MANDATORY — run once per session)
169
+
170
+ ```bash
171
+ python3 execution/session_boot.py --auto-fix
172
+ ```
173
+
174
+ If `"memory_ready": true`, proceed. If false, follow the printed instructions.
175
+
176
+ #### Before Every Complex Task
177
+
178
+ ```bash
179
+ python3 execution/memory_manager.py auto --query "<one-line summary of the task>"
154
180
  ```
155
- ┌─────────────────────────────────────────────────────────────┐
156
- │ QUERY RECEIVED │
157
- │ ↓ │
158
- │ 1. Check for opt-out flags ("no cache", "fresh", etc.) │
159
- │ ↓ │
160
- 2. SEMANTIC CACHE CHECK (similarity > 0.92) │
161
- │ └─ Hit? Return cached response (100% token savings) │
162
- │ ↓ │
163
- │ 3. CONTEXT RETRIEVAL (top 5 relevant memories) │
164
- │ └─ Inject decisions, patterns, solutions (80-95% saved) │
165
- │ ↓ │
166
- │ 4. EXECUTE QUERY with enriched context │
167
- │ ↓ │
168
- 5. STORE RESPONSE for future cache hits │
169
- └─────────────────────────────────────────────────────────────┘
181
+
182
+ **Decision tree based on output:**
183
+
184
+ | Result | Action |
185
+ | -------------------- | ------------------------------------------------------------------------- |
186
+ | `"cache_hit": true` | Use cached response directly. Inform user: "Retrieved from memory cache." |
187
+ | `"source": "memory"` | Inject `context_chunks` into your reasoning. Cite them. |
188
+ | `"source": "none"` | Proceed normally. Store the result when done. |
189
+
190
+ #### After Key Decisions or Solutions
191
+
192
+ ```bash
193
+ python3 execution/memory_manager.py store \
194
+ --content "Description of what was decided/solved" \
195
+ --type decision \
196
+ --project <project-name> \
197
+ --tags relevant-tag1 relevant-tag2
170
198
  ```
171
199
 
172
- **Opt-out:** User says "don't use cache", "no cache", "skip memory", or "fresh"
200
+ Memory types: `decision`, `code`, `error`, `technical`, `conversation`
201
+
202
+ #### After Completing a Complex Task
173
203
 
174
- **Auto-stored memories:**
204
+ ```bash
205
+ python3 execution/memory_manager.py cache-store \
206
+ --query "The original user question" \
207
+ --response "The complete response that was generated"
208
+ ```
175
209
 
176
- - `decision` Architecture choices, design decisions
177
- - `code` — Script patterns, reusable implementations
178
- - `error` — Bug resolutions with root cause
179
- - `technical` — Documentation, API knowledge
210
+ **Opt-out:** User says "don't use cache", "no cache", "skip memory", or "fresh"
180
211
 
181
- > See `directives/memory_integration.md` for full details.
212
+ > See `directives/memory_integration.md` for full protocol and token savings reference.
182
213
 
183
214
  ### 2. Check for Existing Tools First
184
215
 
@@ -0,0 +1,327 @@
1
+ # AGI Agent Kit
2
+
3
+ **Enterprise-Grade Agentic Framework & Scaffolding Tool**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@techwavedev/agi-agent-kit.svg)](https://www.npmjs.com/package/@techwavedev/agi-agent-kit)
6
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+
8
+ `@techwavedev/agi-agent-kit` is a modular, deterministic framework designed to bridge the gap between LLM reasoning and reliable production execution. It scaffolds a "3-Layer Architecture" (Intent → Orchestration → Execution) that forces agents to use tested scripts rather than hallucinating code.
9
+
10
+ **v1.2.6** — Now with platform-adaptive orchestration and integrated semantic memory across Claude Code, Kiro IDE, Gemini, and Opencode.
11
+
12
+ ---
13
+
14
+ ## 🚀 Quick Start
15
+
16
+ Scaffold a new agent workspace in seconds:
17
+
18
+ ```bash
19
+ npx @techwavedev/agi-agent-kit init
20
+ ```
21
+
22
+ You'll be prompted to choose a pack:
23
+
24
+ - **core** - Essential skills (webcrawler, pdf-reader, qdrant-memory, documentation)
25
+ - **knowledge** - Core + 36 specialized skills (API, Security, Design, Architecture)
26
+ - **full** - Complete suite with `.agent/` structure (agents, workflows, rules)
27
+
28
+ After installation, run the **one-shot setup wizard** to auto-configure your environment:
29
+
30
+ ```bash
31
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir .
32
+ ```
33
+
34
+ This detects your platform, scans the project stack, and configures everything with a single confirmation.
35
+
36
+ Then **boot the memory system** for automatic token savings:
37
+
38
+ ```bash
39
+ python3 execution/session_boot.py --auto-fix
40
+ ```
41
+
42
+ This checks Qdrant, Ollama, embedding models, and collections — auto-fixing any issues.
43
+
44
+ ---
45
+
46
+ ## ✨ Key Features
47
+
48
+ | Feature | Description |
49
+ | ----------------------------- | --------------------------------------------------------------------------- |
50
+ | **Deterministic Execution** | Separates business logic (Python scripts) from AI reasoning (Directives) |
51
+ | **Modular Skill System** | 56 plug-and-play skills that can be added or removed instantly |
52
+ | **Platform-Adaptive** | Auto-detects and optimizes for Claude Code, Kiro IDE, Gemini, and Opencode |
53
+ | **Multi-Agent Orchestration** | Agent Teams, subagents, Powers, or sequential personas — adapts to platform |
54
+ | **Semantic Memory** | Built-in Qdrant-powered memory with 95% token savings via caching |
55
+ | **Deep RAG (NotebookLM)** | Opt-in autonomous research via Google NotebookLM + Gemini, fully MCP-driven |
56
+ | **Self-Healing Workflows** | Agents read error logs, patch scripts, and update directives automatically |
57
+ | **One-Shot Setup** | Platform detection + project stack scan + auto-configuration in one command |
58
+
59
+ ---
60
+
61
+ ## 🌐 Platform Support
62
+
63
+ The framework automatically detects your AI coding environment and activates the best available features:
64
+
65
+ | Platform | Orchestration Strategy | Key Features |
66
+ | --------------- | ----------------------------------- | -------------------------------------------- |
67
+ | **Claude Code** | Agent Teams (parallel) or Subagents | Plugins, marketplace, LSP, hooks |
68
+ | **Kiro IDE** | Powers + Autonomous Agent (async) | Dynamic MCP loading, hooks, cross-repo tasks |
69
+ | **Gemini** | Sequential personas via `@agent` | Skills, MCP servers, execution scripts |
70
+ | **Opencode** | Sequential personas via `@agent` | Skills, MCP servers, providers |
71
+
72
+ Run `/setup` to auto-detect and configure your platform, or use the setup script directly:
73
+
74
+ ```bash
75
+ # Interactive (one Y/n question)
76
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir .
77
+
78
+ # Auto-apply everything
79
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir . --auto
80
+
81
+ # Preview without changes
82
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir . --dry-run
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 📦 What You Get
88
+
89
+ ```
90
+ your-project/
91
+ ├── AGENTS.md # Master instruction file (symlinked to GEMINI.md, CLAUDE.md)
92
+ ├── skills/ # 56 pre-built tools
93
+ │ ├── webcrawler/ # Documentation harvesting
94
+ │ ├── pdf-reader/ # PDF text extraction
95
+ │ ├── qdrant-memory/ # Semantic caching & memory
96
+ │ ├── documentation/ # Auto-documentation maintenance
97
+ │ ├── plugin-discovery/ # Platform detection & setup wizard
98
+ │ ├── parallel-agents/ # Multi-agent orchestration
99
+ │ ├── intelligent-routing/ # Smart agent selection & routing
100
+ │ ├── self-update/ # Framework self-update capability
101
+ │ └── ... # 48 more specialized skills
102
+ ├── directives/ # SOPs in Markdown
103
+ │ └── memory_integration.md # Memory protocol reference
104
+ ├── execution/ # Deterministic Python scripts
105
+ │ ├── session_boot.py # Session startup (Qdrant + Ollama check)
106
+ │ ├── session_init.py # Collection initializer
107
+ │ └── memory_manager.py # Store/retrieve/cache operations
108
+ ├── skill-creator/ # Tools to create new skills
109
+ └── .agent/ # (full pack) Agents, workflows, rules
110
+ └── workflows/ # /setup, /deploy, /test, /debug, etc.
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 📖 Architecture
116
+
117
+ The system operates on three layers:
118
+
119
+ ```
120
+ ┌─────────────────────────────────────────────────────────┐
121
+ │ Layer 1: DIRECTIVES (Intent) │
122
+ │ └─ SOPs written in Markdown (directives/) │
123
+ ├─────────────────────────────────────────────────────────┤
124
+ │ Layer 2: ORCHESTRATION (Agent) │
125
+ │ └─ LLM reads directive, decides which tool to call │
126
+ │ └─ Platform-adaptive: Teams, Subagents, or Personas │
127
+ ├─────────────────────────────────────────────────────────┤
128
+ │ Layer 3: EXECUTION (Code) │
129
+ │ └─ Pure Python scripts (execution/) do the actual work │
130
+ └─────────────────────────────────────────────────────────┘
131
+ ```
132
+
133
+ **Why?** LLMs are probabilistic. 90% accuracy per step = 59% success over 5 steps. By pushing complexity into deterministic scripts, we achieve reliable execution.
134
+
135
+ ---
136
+
137
+ ## 🧠 Semantic Memory
138
+
139
+ Built-in Qdrant-powered memory with automatic token savings:
140
+
141
+ | Scenario | Without Memory | With Memory | Savings |
142
+ | --------------------- | -------------- | ----------- | -------- |
143
+ | Repeated question | ~2000 tokens | 0 tokens | **100%** |
144
+ | Similar architecture | ~5000 tokens | ~500 tokens | **90%** |
145
+ | Past error resolution | ~3000 tokens | ~300 tokens | **90%** |
146
+
147
+ **Setup** (requires [Qdrant](https://qdrant.tech/) + [Ollama](https://ollama.com/)):
148
+
149
+ ```bash
150
+ # Start Qdrant
151
+ docker run -d -p 6333:6333 -v qdrant_storage:/qdrant/storage qdrant/qdrant
152
+
153
+ # Start Ollama + pull embedding model
154
+ ollama serve &
155
+ ollama pull nomic-embed-text
156
+
157
+ # Boot memory system (auto-creates collections)
158
+ python3 execution/session_boot.py --auto-fix
159
+ ```
160
+
161
+ Agents automatically run `session_boot.py` at session start (first instruction in `AGENTS.md`). Memory operations:
162
+
163
+ ```bash
164
+ # Auto-query (check cache + retrieve context)
165
+ python3 execution/memory_manager.py auto --query "your task summary"
166
+
167
+ # Store a decision
168
+ python3 execution/memory_manager.py store --content "what was decided" --type decision
169
+
170
+ # Health check
171
+ python3 execution/memory_manager.py health
172
+ ```
173
+
174
+ ---
175
+
176
+ ## ⚡ Prerequisites
177
+
178
+ The `npx init` command automatically creates a `.venv` and installs all dependencies. Just activate it:
179
+
180
+ ```bash
181
+ source .venv/bin/activate # macOS/Linux
182
+ # .venv\Scripts\activate # Windows
183
+ ```
184
+
185
+ If you need to reinstall or update dependencies:
186
+
187
+ ```bash
188
+ .venv/bin/pip install -r requirements.txt
189
+ ```
190
+
191
+ ---
192
+
193
+ ## 🔧 Commands
194
+
195
+ ### Initialize a new project
196
+
197
+ ```bash
198
+ npx @techwavedev/agi-agent-kit init --pack=full
199
+ ```
200
+
201
+ ### Auto-detect platform and configure environment
202
+
203
+ ```bash
204
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir .
205
+ ```
206
+
207
+ ### Update to latest version
208
+
209
+ ```bash
210
+ npx @techwavedev/agi-agent-kit@latest init --pack=full
211
+ # or use the built-in skill:
212
+ python3 skills/self-update/scripts/update_kit.py
213
+ ```
214
+
215
+ ### Boot memory system
216
+
217
+ ```bash
218
+ python3 execution/session_boot.py --auto-fix
219
+ ```
220
+
221
+ ### System health check
222
+
223
+ ```bash
224
+ python3 execution/system_checkup.py --verbose
225
+ ```
226
+
227
+ ### Create a new skill
228
+
229
+ ```bash
230
+ python3 skill-creator/scripts/init_skill.py my-skill --path skills/
231
+ ```
232
+
233
+ ### Update skills catalog
234
+
235
+ ```bash
236
+ python3 skill-creator/scripts/update_catalog.py --skills-dir skills/
237
+ ```
238
+
239
+ ---
240
+
241
+ ## 🎯 Activation Reference
242
+
243
+ Use these keywords, commands, and phrases to trigger specific capabilities:
244
+
245
+ ### Slash Commands (Workflows)
246
+
247
+ | Command | What It Does |
248
+ | --------------- | ------------------------------------------------ |
249
+ | `/setup` | Auto-detect platform and configure environment |
250
+ | `/setup-memory` | Initialize Qdrant + Ollama memory system |
251
+ | `/create` | Start interactive app builder dialogue |
252
+ | `/plan` | Create a structured project plan (no code) |
253
+ | `/enhance` | Add or update features in existing app |
254
+ | `/debug` | Activate systematic debugging mode |
255
+ | `/test` | Generate and run tests |
256
+ | `/deploy` | Pre-flight checks + deployment |
257
+ | `/orchestrate` | Multi-agent coordination for complex tasks |
258
+ | `/brainstorm` | Structured brainstorming with multiple options |
259
+ | `/preview` | Start/stop local dev server |
260
+ | `/status` | Show project progress and status board |
261
+ | `/update` | Update AGI Agent Kit to latest version |
262
+ | `/checkup` | Verify agents, workflows, skills, and core files |
263
+
264
+ ### Agent Mentions (`@agent`)
265
+
266
+ | Mention | Specialist | When To Use |
267
+ | ---------------------- | ----------------------- | ----------------------------------------- |
268
+ | `@orchestrator` | Multi-agent coordinator | Complex multi-domain tasks |
269
+ | `@project-planner` | Planning specialist | Roadmaps, task breakdowns, phase planning |
270
+ | `@frontend-specialist` | UI/UX architect | Web interfaces, React, Next.js |
271
+ | `@mobile-developer` | Mobile specialist | iOS, Android, React Native, Flutter |
272
+ | `@backend-specialist` | API/DB engineer | Server-side, databases, APIs |
273
+ | `@security-auditor` | Security expert | Vulnerability scanning, audits, hardening |
274
+ | `@debugger` | Debug specialist | Complex bug investigation |
275
+ | `@game-developer` | Game dev specialist | 2D/3D games, multiplayer, VR/AR |
276
+
277
+ ### Skill Trigger Keywords (Natural Language)
278
+
279
+ | Category | Trigger Words / Phrases | Skill Activated |
280
+ | ----------------- | --------------------------------------------------------------------- | ----------------------------------- |
281
+ | **Memory** | "don't use cache", "no cache", "skip memory", "fresh" | Memory opt-out |
282
+ | **Research** | "research my docs", "deep search", "@notebooklm", "query my notebook" | `notebooklm-rag` (Deep RAG) |
283
+ | **Documentation** | "update docs", "regenerate catalog", "sync documentation" | `documentation` |
284
+ | **Quality** | "lint", "format", "check", "validate", "static analysis" | `lint-and-validate` |
285
+ | **Testing** | "write tests", "run tests", "TDD", "test coverage" | `testing-patterns` / `tdd-workflow` |
286
+ | **Architecture** | "design system", "architecture decision", "ADR", "trade-off" | `architecture` |
287
+ | **Security** | "security scan", "vulnerability", "audit", "OWASP" | `red-team-tactics` |
288
+ | **Performance** | "lighthouse", "bundle size", "core web vitals", "profiling" | `performance-profiling` |
289
+ | **Design** | "design UI", "color scheme", "typography", "layout" | `frontend-design` |
290
+ | **Deployment** | "deploy", "rollback", "release", "CI/CD" | `deployment-procedures` |
291
+ | **API** | "REST API", "GraphQL", "tRPC", "API design" | `api-patterns` |
292
+ | **Database** | "schema design", "migration", "query optimization" | `database-design` |
293
+ | **Planning** | "plan this", "break down", "task list", "requirements" | `plan-writing` |
294
+ | **Brainstorming** | "explore options", "what are the approaches", "pros and cons" | `brainstorming` |
295
+ | **Code Review** | "review this", "code quality", "best practices" | `code-review-checklist` |
296
+ | **i18n** | "translate", "localization", "RTL", "locale" | `i18n-localization` |
297
+
298
+ ### Memory System Commands
299
+
300
+ | What You Want | Command / Phrase |
301
+ | ---------------------------- | -------------------------------------------------------------------------------- |
302
+ | **Boot memory** | `python3 execution/session_boot.py --auto-fix` |
303
+ | **Check before a task** | `python3 execution/memory_manager.py auto --query "..."` |
304
+ | **Store a decision** | `python3 execution/memory_manager.py store --content "..." --type decision` |
305
+ | **Cache a response** | `python3 execution/memory_manager.py cache-store --query "..." --response "..."` |
306
+ | **Health check** | `python3 execution/memory_manager.py health` |
307
+ | **Skip cache for this task** | Say "fresh", "no cache", or "skip memory" in your prompt |
308
+
309
+ ---
310
+
311
+ ## 📚 Documentation
312
+
313
+ - **[AGENTS.md](./AGENTS.md)** - Complete architecture and operating principles
314
+ - **[skills/SKILLS_CATALOG.md](./skills/SKILLS_CATALOG.md)** - All 56 available skills
315
+ - **[CHANGELOG.md](./CHANGELOG.md)** - Version history
316
+
317
+ ---
318
+
319
+ ## 🛡️ Security
320
+
321
+ This package includes a pre-flight security scanner that checks for private terms before publishing. All templates are sanitized for public use.
322
+
323
+ ---
324
+
325
+ ## 📄 License
326
+
327
+ Apache-2.0 © [Elton Machado@TechWaveDev](https://github.com/techwavedev)
@@ -0,0 +1,95 @@
1
+ # Memory Integration Directive
2
+
3
+ ## Goal
4
+
5
+ Ensure all AI agents use the Qdrant-powered memory system by default to save tokens and preserve context across sessions. Embedding is handled locally via Ollama (`nomic-embed-text`, 768 dimensions) at zero cost.
6
+
7
+ ## Inputs
8
+
9
+ - User query (natural language)
10
+ - Project name (optional, for scoped retrieval)
11
+ - Memory type classification (auto-detected or explicit)
12
+
13
+ ## Prerequisites
14
+
15
+ | Component | Required | Check Command |
16
+ | ------------------ | -------- | --------------------------------------------------- |
17
+ | Qdrant (Docker) | Yes | `curl http://localhost:6333/collections` |
18
+ | Ollama | Yes | `curl http://localhost:11434/api/tags` |
19
+ | nomic-embed-text | Yes | `ollama pull nomic-embed-text` |
20
+ | Collections setup | Yes | `python3 execution/session_init.py` |
21
+
22
+ ## Execution Protocol
23
+
24
+ ### 1. Session Start (Run Once)
25
+
26
+ ```bash
27
+ python3 execution/session_init.py
28
+ ```
29
+
30
+ This verifies Qdrant, Ollama, and creates `agent_memory` (768d) and `semantic_cache` (768d) collections if they don't exist.
31
+
32
+ ### 2. Before Every Complex Task
33
+
34
+ ```bash
35
+ python3 execution/memory_manager.py auto --query "<user request summary>"
36
+ ```
37
+
38
+ **Decision tree based on result:**
39
+
40
+ | Result | Action |
41
+ | ------------------ | -------------------------------------------------------- |
42
+ | `cache_hit: true` | Use cached response directly. Inform user of cache hit. |
43
+ | `source: memory` | Inject retrieved context chunks into your reasoning. |
44
+ | `source: none` | Proceed normally. Store the result when done. |
45
+
46
+ ### 3. After Key Decisions or Solutions
47
+
48
+ ```bash
49
+ python3 execution/memory_manager.py store \
50
+ --content "Description of what was decided/solved" \
51
+ --type decision \
52
+ --project <project-name> \
53
+ --tags relevant-tag1 relevant-tag2
54
+ ```
55
+
56
+ ### 4. After Completing a Complex Task (Cache the Response)
57
+
58
+ ```bash
59
+ python3 execution/memory_manager.py cache-store \
60
+ --query "The original user question" \
61
+ --response "The complete response that was generated"
62
+ ```
63
+
64
+ ## Memory Type Guide
65
+
66
+ | Type | When to Store | Retention |
67
+ | -------------- | ------------------------------------------------ | --------- |
68
+ | `decision` | Architecture choice, tech selection, trade-off | Permanent |
69
+ | `code` | Reusable pattern, snippet, config | Permanent |
70
+ | `error` | Bug fix with root cause and solution | 90 days |
71
+ | `technical` | API docs, library quirks, config patterns | Permanent |
72
+ | `conversation` | User preference, constraint, project context | 30 days |
73
+
74
+ ## Token Savings Reference
75
+
76
+ | Scenario | Without Memory | With Memory | Savings |
77
+ | --------------------- | -------------- | ----------- | ------- |
78
+ | Repeated question | ~2000 tokens | 0 tokens | 100% |
79
+ | Similar architecture | ~5000 tokens | ~500 tokens | 90% |
80
+ | Past error resolution | ~3000 tokens | ~300 tokens | 90% |
81
+ | Context from history | ~10000 tokens | ~1000 tokens| 90% |
82
+
83
+ ## Edge Cases
84
+
85
+ - **Qdrant not running:** Log warning, proceed without memory. Never block user workflow.
86
+ - **Ollama not running:** Same as above. Memory is optional, never mandatory for task completion.
87
+ - **Stale cache:** Cache entries older than 7 days are auto-cleared. Run `python3 execution/memory_manager.py cache-clear --older-than 7` manually if needed.
88
+ - **Dimension mismatch:** If switching providers (e.g., OpenAI→Ollama), run `python3 execution/session_init.py --force` to recreate collections with correct dimensions.
89
+ - **User opt-out:** Respect "no cache", "fresh", "skip memory" keywords.
90
+
91
+ ## Outputs
92
+
93
+ - Cached responses (in Qdrant `semantic_cache` collection)
94
+ - Stored memories (in Qdrant `agent_memory` collection)
95
+ - Session health report (JSON from `session_init.py`)