@techwavedev/agi-agent-kit 1.1.7 → 1.2.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.

Potentially problematic release.


This version of @techwavedev/agi-agent-kit might be problematic. Click here for more details.

Files changed (111) hide show
  1. package/CHANGELOG.md +82 -1
  2. package/README.md +190 -12
  3. package/bin/init.js +30 -2
  4. package/package.json +6 -3
  5. package/templates/base/AGENTS.md +54 -23
  6. package/templates/base/README.md +325 -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/skill-creator/SKILL_skillcreator.md +23 -36
  12. package/templates/base/skill-creator/scripts/init_skill.py +18 -135
  13. package/templates/skills/ec/README.md +31 -0
  14. package/templates/skills/ec/aws/SKILL.md +1020 -0
  15. package/templates/skills/ec/aws/defaults.yaml +13 -0
  16. package/templates/skills/ec/aws/references/common_patterns.md +80 -0
  17. package/templates/skills/ec/aws/references/mcp_servers.md +98 -0
  18. package/templates/skills/ec/aws-terraform/SKILL.md +349 -0
  19. package/templates/skills/ec/aws-terraform/references/best_practices.md +394 -0
  20. package/templates/skills/ec/aws-terraform/references/checkov_reference.md +337 -0
  21. package/templates/skills/ec/aws-terraform/scripts/configure_mcp.py +150 -0
  22. package/templates/skills/ec/confluent-kafka/SKILL.md +655 -0
  23. package/templates/skills/ec/confluent-kafka/references/ansible_playbooks.md +792 -0
  24. package/templates/skills/ec/confluent-kafka/references/ec_deployment.md +579 -0
  25. package/templates/skills/ec/confluent-kafka/references/kraft_migration.md +490 -0
  26. package/templates/skills/ec/confluent-kafka/references/troubleshooting.md +778 -0
  27. package/templates/skills/ec/confluent-kafka/references/upgrade_7x_to_8x.md +488 -0
  28. package/templates/skills/ec/confluent-kafka/scripts/kafka_health_check.py +435 -0
  29. package/templates/skills/ec/confluent-kafka/scripts/upgrade_preflight.py +568 -0
  30. package/templates/skills/ec/confluent-kafka/scripts/validate_config.py +455 -0
  31. package/templates/skills/ec/consul/SKILL.md +427 -0
  32. package/templates/skills/ec/consul/references/acl_setup.md +168 -0
  33. package/templates/skills/ec/consul/references/ha_config.md +196 -0
  34. package/templates/skills/ec/consul/references/troubleshooting.md +267 -0
  35. package/templates/skills/ec/consul/references/upgrades.md +213 -0
  36. package/templates/skills/ec/consul/scripts/consul_health_report.py +530 -0
  37. package/templates/skills/ec/consul/scripts/consul_status.py +264 -0
  38. package/templates/skills/ec/consul/scripts/generate_values.py +170 -0
  39. package/templates/skills/ec/documentation/SKILL.md +351 -0
  40. package/templates/skills/ec/documentation/references/best_practices.md +201 -0
  41. package/templates/skills/ec/documentation/scripts/analyze_code.py +307 -0
  42. package/templates/skills/ec/documentation/scripts/detect_changes.py +460 -0
  43. package/templates/skills/ec/documentation/scripts/generate_changelog.py +312 -0
  44. package/templates/skills/ec/documentation/scripts/sync_docs.py +272 -0
  45. package/templates/skills/ec/documentation/scripts/update_skill_docs.py +366 -0
  46. package/templates/skills/ec/gitlab/SKILL.md +529 -0
  47. package/templates/skills/ec/gitlab/references/agent_installation.md +416 -0
  48. package/templates/skills/ec/gitlab/references/api_reference.md +508 -0
  49. package/templates/skills/ec/gitlab/references/gitops_flux.md +465 -0
  50. package/templates/skills/ec/gitlab/references/troubleshooting.md +518 -0
  51. package/templates/skills/ec/gitlab/scripts/generate_agent_values.py +329 -0
  52. package/templates/skills/ec/gitlab/scripts/gitlab_agent_status.py +414 -0
  53. package/templates/skills/ec/jira/SKILL.md +484 -0
  54. package/templates/skills/ec/jira/references/jql_reference.md +148 -0
  55. package/templates/skills/ec/jira/scripts/add_comment.py +91 -0
  56. package/templates/skills/ec/jira/scripts/bulk_log_work.py +124 -0
  57. package/templates/skills/ec/jira/scripts/create_ticket.py +162 -0
  58. package/templates/skills/ec/jira/scripts/get_ticket.py +191 -0
  59. package/templates/skills/ec/jira/scripts/jira_client.py +383 -0
  60. package/templates/skills/ec/jira/scripts/log_work.py +154 -0
  61. package/templates/skills/ec/jira/scripts/search_tickets.py +104 -0
  62. package/templates/skills/ec/jira/scripts/update_comment.py +67 -0
  63. package/templates/skills/ec/jira/scripts/update_ticket.py +161 -0
  64. package/templates/skills/ec/karpenter/SKILL.md +301 -0
  65. package/templates/skills/ec/karpenter/references/ec2nodeclasses.md +421 -0
  66. package/templates/skills/ec/karpenter/references/migration.md +396 -0
  67. package/templates/skills/ec/karpenter/references/nodepools.md +400 -0
  68. package/templates/skills/ec/karpenter/references/troubleshooting.md +359 -0
  69. package/templates/skills/ec/karpenter/scripts/generate_ec2nodeclass.py +187 -0
  70. package/templates/skills/ec/karpenter/scripts/generate_nodepool.py +245 -0
  71. package/templates/skills/ec/karpenter/scripts/karpenter_status.py +359 -0
  72. package/templates/skills/ec/opensearch/SKILL.md +720 -0
  73. package/templates/skills/ec/opensearch/references/ml_neural_search.md +576 -0
  74. package/templates/skills/ec/opensearch/references/operator.md +532 -0
  75. package/templates/skills/ec/opensearch/references/query_dsl.md +532 -0
  76. package/templates/skills/ec/opensearch/scripts/configure_mcp.py +148 -0
  77. package/templates/skills/ec/victoriametrics/SKILL.md +598 -0
  78. package/templates/skills/ec/victoriametrics/references/kubernetes.md +531 -0
  79. package/templates/skills/ec/victoriametrics/references/prometheus_migration.md +333 -0
  80. package/templates/skills/ec/victoriametrics/references/troubleshooting.md +442 -0
  81. package/templates/skills/knowledge/SKILLS_CATALOG.md +274 -4
  82. package/templates/skills/knowledge/intelligent-routing/SKILL.md +237 -164
  83. package/templates/skills/knowledge/parallel-agents/SKILL.md +345 -73
  84. package/templates/skills/knowledge/plugin-discovery/SKILL.md +582 -0
  85. package/templates/skills/knowledge/plugin-discovery/scripts/platform_setup.py +1083 -0
  86. package/templates/skills/knowledge/design-md/README.md +0 -34
  87. package/templates/skills/knowledge/design-md/SKILL.md +0 -193
  88. package/templates/skills/knowledge/design-md/examples/DESIGN.md +0 -154
  89. package/templates/skills/knowledge/notebooklm-mcp/SKILL.md +0 -71
  90. package/templates/skills/knowledge/notebooklm-mcp/assets/example_asset.txt +0 -24
  91. package/templates/skills/knowledge/notebooklm-mcp/references/api_reference.md +0 -34
  92. package/templates/skills/knowledge/notebooklm-mcp/scripts/example.py +0 -19
  93. package/templates/skills/knowledge/react-components/README.md +0 -36
  94. package/templates/skills/knowledge/react-components/SKILL.md +0 -53
  95. package/templates/skills/knowledge/react-components/examples/gold-standard-card.tsx +0 -80
  96. package/templates/skills/knowledge/react-components/package-lock.json +0 -231
  97. package/templates/skills/knowledge/react-components/package.json +0 -16
  98. package/templates/skills/knowledge/react-components/resources/architecture-checklist.md +0 -15
  99. package/templates/skills/knowledge/react-components/resources/component-template.tsx +0 -37
  100. package/templates/skills/knowledge/react-components/resources/stitch-api-reference.md +0 -14
  101. package/templates/skills/knowledge/react-components/resources/style-guide.json +0 -27
  102. package/templates/skills/knowledge/react-components/scripts/fetch-stitch.sh +0 -30
  103. package/templates/skills/knowledge/react-components/scripts/validate.js +0 -68
  104. package/templates/skills/knowledge/self-update/SKILL.md +0 -60
  105. package/templates/skills/knowledge/self-update/scripts/update_kit.py +0 -103
  106. package/templates/skills/knowledge/stitch-loop/README.md +0 -54
  107. package/templates/skills/knowledge/stitch-loop/SKILL.md +0 -235
  108. package/templates/skills/knowledge/stitch-loop/examples/SITE.md +0 -73
  109. package/templates/skills/knowledge/stitch-loop/examples/next-prompt.md +0 -25
  110. package/templates/skills/knowledge/stitch-loop/resources/baton-schema.md +0 -61
  111. package/templates/skills/knowledge/stitch-loop/resources/site-template.md +0 -104
@@ -0,0 +1,325 @@
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.1** — 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
+ | **Self-Healing Workflows** | Agents read error logs, patch scripts, and update directives automatically |
56
+ | **One-Shot Setup** | Platform detection + project stack scan + auto-configuration in one command |
57
+
58
+ ---
59
+
60
+ ## 🌐 Platform Support
61
+
62
+ The framework automatically detects your AI coding environment and activates the best available features:
63
+
64
+ | Platform | Orchestration Strategy | Key Features |
65
+ | --------------- | ----------------------------------- | -------------------------------------------- |
66
+ | **Claude Code** | Agent Teams (parallel) or Subagents | Plugins, marketplace, LSP, hooks |
67
+ | **Kiro IDE** | Powers + Autonomous Agent (async) | Dynamic MCP loading, hooks, cross-repo tasks |
68
+ | **Gemini** | Sequential personas via `@agent` | Skills, MCP servers, execution scripts |
69
+ | **Opencode** | Sequential personas via `@agent` | Skills, MCP servers, providers |
70
+
71
+ Run `/setup` to auto-detect and configure your platform, or use the setup script directly:
72
+
73
+ ```bash
74
+ # Interactive (one Y/n question)
75
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir .
76
+
77
+ # Auto-apply everything
78
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir . --auto
79
+
80
+ # Preview without changes
81
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir . --dry-run
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 📦 What You Get
87
+
88
+ ```
89
+ your-project/
90
+ ├── AGENTS.md # Master instruction file (symlinked to GEMINI.md, CLAUDE.md)
91
+ ├── skills/ # 56 pre-built tools
92
+ │ ├── webcrawler/ # Documentation harvesting
93
+ │ ├── pdf-reader/ # PDF text extraction
94
+ │ ├── qdrant-memory/ # Semantic caching & memory
95
+ │ ├── documentation/ # Auto-documentation maintenance
96
+ │ ├── plugin-discovery/ # Platform detection & setup wizard
97
+ │ ├── parallel-agents/ # Multi-agent orchestration
98
+ │ ├── intelligent-routing/ # Smart agent selection & routing
99
+ │ ├── self-update/ # Framework self-update capability
100
+ │ └── ... # 48 more specialized skills
101
+ ├── directives/ # SOPs in Markdown
102
+ │ └── memory_integration.md # Memory protocol reference
103
+ ├── execution/ # Deterministic Python scripts
104
+ │ ├── session_boot.py # Session startup (Qdrant + Ollama check)
105
+ │ ├── session_init.py # Collection initializer
106
+ │ └── memory_manager.py # Store/retrieve/cache operations
107
+ ├── skill-creator/ # Tools to create new skills
108
+ └── .agent/ # (full pack) Agents, workflows, rules
109
+ └── workflows/ # /setup, /deploy, /test, /debug, etc.
110
+ ```
111
+
112
+ ---
113
+
114
+ ## 📖 Architecture
115
+
116
+ The system operates on three layers:
117
+
118
+ ```
119
+ ┌─────────────────────────────────────────────────────────┐
120
+ │ Layer 1: DIRECTIVES (Intent) │
121
+ │ └─ SOPs written in Markdown (directives/) │
122
+ ├─────────────────────────────────────────────────────────┤
123
+ │ Layer 2: ORCHESTRATION (Agent) │
124
+ │ └─ LLM reads directive, decides which tool to call │
125
+ │ └─ Platform-adaptive: Teams, Subagents, or Personas │
126
+ ├─────────────────────────────────────────────────────────┤
127
+ │ Layer 3: EXECUTION (Code) │
128
+ │ └─ Pure Python scripts (execution/) do the actual work │
129
+ └─────────────────────────────────────────────────────────┘
130
+ ```
131
+
132
+ **Why?** LLMs are probabilistic. 90% accuracy per step = 59% success over 5 steps. By pushing complexity into deterministic scripts, we achieve reliable execution.
133
+
134
+ ---
135
+
136
+ ## 🧠 Semantic Memory
137
+
138
+ Built-in Qdrant-powered memory with automatic token savings:
139
+
140
+ | Scenario | Without Memory | With Memory | Savings |
141
+ | --------------------- | -------------- | ----------- | -------- |
142
+ | Repeated question | ~2000 tokens | 0 tokens | **100%** |
143
+ | Similar architecture | ~5000 tokens | ~500 tokens | **90%** |
144
+ | Past error resolution | ~3000 tokens | ~300 tokens | **90%** |
145
+
146
+ **Setup** (requires [Qdrant](https://qdrant.tech/) + [Ollama](https://ollama.com/)):
147
+
148
+ ```bash
149
+ # Start Qdrant
150
+ docker run -d -p 6333:6333 -v qdrant_storage:/qdrant/storage qdrant/qdrant
151
+
152
+ # Start Ollama + pull embedding model
153
+ ollama serve &
154
+ ollama pull nomic-embed-text
155
+
156
+ # Boot memory system (auto-creates collections)
157
+ python3 execution/session_boot.py --auto-fix
158
+ ```
159
+
160
+ Agents automatically run `session_boot.py` at session start (first instruction in `AGENTS.md`). Memory operations:
161
+
162
+ ```bash
163
+ # Auto-query (check cache + retrieve context)
164
+ python3 execution/memory_manager.py auto --query "your task summary"
165
+
166
+ # Store a decision
167
+ python3 execution/memory_manager.py store --content "what was decided" --type decision
168
+
169
+ # Health check
170
+ python3 execution/memory_manager.py health
171
+ ```
172
+
173
+ ---
174
+
175
+ ## ⚡ Prerequisites
176
+
177
+ ```bash
178
+ pip install requests beautifulsoup4 html2text lxml qdrant-client
179
+ ```
180
+
181
+ Optional (for semantic memory with local embeddings):
182
+
183
+ ```bash
184
+ pip install ollama sentence-transformers
185
+ ```
186
+
187
+ ---
188
+
189
+ ## 🔧 Commands
190
+
191
+ ### Initialize a new project
192
+
193
+ ```bash
194
+ npx @techwavedev/agi-agent-kit init --pack=full
195
+ ```
196
+
197
+ ### Auto-detect platform and configure environment
198
+
199
+ ```bash
200
+ python3 skills/plugin-discovery/scripts/platform_setup.py --project-dir .
201
+ ```
202
+
203
+ ### Update to latest version
204
+
205
+ ```bash
206
+ npx @techwavedev/agi-agent-kit@latest init --pack=full
207
+ # or use the built-in skill:
208
+ python3 skills/self-update/scripts/update_kit.py
209
+ ```
210
+
211
+ ### Boot memory system
212
+
213
+ ```bash
214
+ python3 execution/session_boot.py --auto-fix
215
+ ```
216
+
217
+ ### System health check
218
+
219
+ ```bash
220
+ python3 execution/system_checkup.py --verbose
221
+ ```
222
+
223
+ ### Create a new skill
224
+
225
+ ```bash
226
+ python3 skill-creator/scripts/init_skill.py my-skill --path skills/
227
+ ```
228
+
229
+ ### Update skills catalog
230
+
231
+ ```bash
232
+ python3 skill-creator/scripts/update_catalog.py --skills-dir skills/
233
+ ```
234
+
235
+ ---
236
+
237
+ ## 🎯 Activation Reference
238
+
239
+ Use these keywords, commands, and phrases to trigger specific capabilities:
240
+
241
+ ### Slash Commands (Workflows)
242
+
243
+ | Command | What It Does |
244
+ | --------------- | ------------------------------------------------ |
245
+ | `/setup` | Auto-detect platform and configure environment |
246
+ | `/setup-memory` | Initialize Qdrant + Ollama memory system |
247
+ | `/create` | Start interactive app builder dialogue |
248
+ | `/plan` | Create a structured project plan (no code) |
249
+ | `/enhance` | Add or update features in existing app |
250
+ | `/debug` | Activate systematic debugging mode |
251
+ | `/test` | Generate and run tests |
252
+ | `/deploy` | Pre-flight checks + deployment |
253
+ | `/orchestrate` | Multi-agent coordination for complex tasks |
254
+ | `/brainstorm` | Structured brainstorming with multiple options |
255
+ | `/preview` | Start/stop local dev server |
256
+ | `/status` | Show project progress and status board |
257
+ | `/update` | Update AGI Agent Kit to latest version |
258
+ | `/checkup` | Verify agents, workflows, skills, and core files |
259
+
260
+ ### Agent Mentions (`@agent`)
261
+
262
+ | Mention | Specialist | When To Use |
263
+ | ---------------------- | ----------------------- | ----------------------------------------- |
264
+ | `@orchestrator` | Multi-agent coordinator | Complex multi-domain tasks |
265
+ | `@project-planner` | Planning specialist | Roadmaps, task breakdowns, phase planning |
266
+ | `@frontend-specialist` | UI/UX architect | Web interfaces, React, Next.js |
267
+ | `@mobile-developer` | Mobile specialist | iOS, Android, React Native, Flutter |
268
+ | `@backend-specialist` | API/DB engineer | Server-side, databases, APIs |
269
+ | `@security-auditor` | Security expert | Vulnerability scanning, audits, hardening |
270
+ | `@debugger` | Debug specialist | Complex bug investigation |
271
+ | `@game-developer` | Game dev specialist | 2D/3D games, multiplayer, VR/AR |
272
+
273
+ ### Skill Trigger Keywords (Natural Language)
274
+
275
+ | Category | Trigger Words / Phrases | Skill Activated |
276
+ | ------------------ | ---------------------------------------------------------------------- | ----------------------------------- |
277
+ | **Memory** | "don't use cache", "no cache", "skip memory", "fresh" | Memory opt-out |
278
+ | **Research** | "research my docs", "check my notebooks", "deep search", "@notebooklm" | `notebooklm-rag` |
279
+ | **Documentation** | "update docs", "regenerate catalog", "sync documentation" | `documentation` |
280
+ | **Quality** | "lint", "format", "check", "validate", "static analysis" | `lint-and-validate` |
281
+ | **Testing** | "write tests", "run tests", "TDD", "test coverage" | `testing-patterns` / `tdd-workflow` |
282
+ | **Architecture** | "design system", "architecture decision", "ADR", "trade-off" | `architecture` |
283
+ | **Security** | "security scan", "vulnerability", "audit", "OWASP" | `red-team-tactics` |
284
+ | **Performance** | "lighthouse", "bundle size", "core web vitals", "profiling" | `performance-profiling` |
285
+ | **Design** | "design UI", "color scheme", "typography", "layout" | `frontend-design` |
286
+ | **Deployment** | "deploy", "rollback", "release", "CI/CD" | `deployment-procedures` |
287
+ | **API** | "REST API", "GraphQL", "tRPC", "API design" | `api-patterns` |
288
+ | **Database** | "schema design", "migration", "query optimization" | `database-design` |
289
+ | **Planning** | "plan this", "break down", "task list", "requirements" | `plan-writing` |
290
+ | **Brainstorming** | "explore options", "what are the approaches", "pros and cons" | `brainstorming` |
291
+ | **Code Review** | "review this", "code quality", "best practices" | `code-review-checklist` |
292
+ | **i18n** | "translate", "localization", "RTL", "locale" | `i18n-localization` |
293
+ | **AWS** | "terraform", "EKS", "Lambda", "S3", "CloudFront" | `aws` / `aws-terraform` |
294
+ | **Infrastructure** | "Consul", "service mesh", "OpenSearch" | `consul` / `opensearch` |
295
+
296
+ ### Memory System Commands
297
+
298
+ | What You Want | Command / Phrase |
299
+ | ---------------------------- | -------------------------------------------------------------------------------- |
300
+ | **Boot memory** | `python3 execution/session_boot.py --auto-fix` |
301
+ | **Check before a task** | `python3 execution/memory_manager.py auto --query "..."` |
302
+ | **Store a decision** | `python3 execution/memory_manager.py store --content "..." --type decision` |
303
+ | **Cache a response** | `python3 execution/memory_manager.py cache-store --query "..." --response "..."` |
304
+ | **Health check** | `python3 execution/memory_manager.py health` |
305
+ | **Skip cache for this task** | Say "fresh", "no cache", or "skip memory" in your prompt |
306
+
307
+ ---
308
+
309
+ ## 📚 Documentation
310
+
311
+ - **[AGENTS.md](./AGENTS.md)** - Complete architecture and operating principles
312
+ - **[skills/SKILLS_CATALOG.md](./skills/SKILLS_CATALOG.md)** - All 56 available skills
313
+ - **[CHANGELOG.md](./CHANGELOG.md)** - Version history
314
+
315
+ ---
316
+
317
+ ## 🛡️ Security
318
+
319
+ This package includes a pre-flight security scanner that checks for private terms before publishing. All templates are sanitized for public use.
320
+
321
+ ---
322
+
323
+ ## 📄 License
324
+
325
+ 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`)