Add automatic context loading system with triggers

This commit is contained in:
2026-04-14 20:47:43 -07:00
parent d0dbfed5ec
commit 72105233a2
2 changed files with 432 additions and 0 deletions

View File

@@ -34,6 +34,91 @@ User request -> Main Claude (coordinator) -> Launches agent(s) -> Agent returns
---
## Automatic Context Loading (CRITICAL)
**BEFORE responding to user's first message or when switching projects, AUTOMATICALLY load context:**
### Trigger 1: Project Keywords Detected
If user mentions **GuruRMM**, **Dataforth**, **tunnel**, **VASLOG**, **AD2**, **testdatadb**, etc:
1. **Immediately read** the matching project CONTEXT.md:
- GuruRMM keywords → `projects/msp-tools/guru-rmm/CONTEXT.md`
- Dataforth keywords → `projects/dataforth-dos/CONTEXT.md`
- General → `CONTEXT.md` (root)
2. Read ENTIRE file (infrastructure, current state, anti-patterns)
3. Note recent session logs mentioned in CONTEXT.md
4. THEN respond with full context
### Trigger 2: Continuation/Resume Words
If user says "continue", "let's work on", "back to", "resume", "finish":
1. Detect project from message
2. Read project CONTEXT.md if found
3. Check "Current State" and "Recent Session Logs" sections
4. Proceed without asking for context
### Trigger 3: Infrastructure/Deployment Questions
If user asks about **servers**, **databases**, **credentials**, **deploy**, **IP**, **password**:
1. Check current directory for CONTEXT.md
2. If not found, check projects/*/CONTEXT.md
3. Answer from CONTEXT.md (never ask user for info that's in CONTEXT.md)
### Trigger 4: Uncertainty >5%
If you're <95% certain about infrastructure, recent work, or next steps:
1. Search for CONTEXT.md in working directory
2. Search for CONTEXT.md in projects/*/
3. Read before asking user
### ANTI-PATTERN Examples (NEVER DO THIS):
**Wrong:**
```
User: "Look at the Dataforth DFWDS folders"
You: "I don't recall what we've done with Dataforth. Let me search session logs..."
```
**Correct:**
```
User: "Look at the Dataforth DFWDS folders"
You: [Detects "Dataforth" → reads projects/dataforth-dos/CONTEXT.md in <3 seconds]
"I see from CONTEXT.md that DFWDS is at C:\Shares\testdatadb\ on AD2 (192.168.0.6).
Recent work (2026-04-12) extended SCMVAS/SCMHVAS pipeline. Service is testdatadb on port 3000.
What would you like me to check?"
```
**Wrong:**
```
User: "Continue working on GuruRMM tunnel"
You: "What phase are we on? Which server is this deployed to?"
```
**Correct:**
```
User: "Continue working on GuruRMM tunnel"
You: [Reads projects/msp-tools/guru-rmm/CONTEXT.md]
"Tunnel Phase 1 is complete (v0.6.0, deployed to 172.16.3.30:3001).
Phase 2 is channel implementation (Terminal, File, Registry, Service).
2/6 agents online. Ready to proceed."
```
### Session Start Protocol
At session start:
1. Check for CONTEXT.md in current working directory
2. If found, read it silently (don't announce to user)
3. Be ready to answer questions about any project listed
4. When user specifies project, load that project's CONTEXT.md automatically
### Benefits
- ✅ Never ask "What's the server IP?" (it's in CONTEXT.md)
- ✅ Never ask "What did we do last time?" (recent logs in CONTEXT.md)
- ✅ Never ask "Where's the database?" (infrastructure table in CONTEXT.md)
- ✅ Start work immediately with full context
- ✅ Follow anti-patterns automatically (CONTEXT.md lists common mistakes)
**See:** `.claude/AUTO_CONTEXT_SYSTEM.md` for full implementation details
---
## Projects
**ClaudeTools** -- MSP Work Tracking System (Production-Ready)