feat(api): GET /api/workspaces/:id/stats endpoint

This commit is contained in:
2026-03-01 15:35:02 -06:00
commit fe87122179
41 changed files with 8471 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
---
name: memory-discipline
description: 'Enforce proper session memory recording. Use at: (1) session idle timeout, (2) task completion, (3) explicit /save command, (4) end of significant conversation milestones. Extracts decisions, key info, and action items from the session and writes them to memory storage (files or database).'
metadata:
{
"openclaw": { "emoji": "💾", "requires": {} },
}
---
# Memory Discipline Skill
This skill ensures that session knowledge is properly captured and stored, not lost. It is **mandatory** to run this before:
- Session idle timeout (no user input for X minutes)
- Task completion
- Explicit `/save` or `/memory` command
- Any significant milestone in the conversation
## Why This Exists
Too often agents don't record important information from sessions. This causes:
- Repeated questions about things the human already told you
- Lost context between sessions
- Frustration when "I told you that last time" happens
**This skill makes memory recording REQUIRED, not optional.**
## Workflow
### Step 1: Extract Key Information
Before writing, analyze the session and extract:
| Category | What to capture |
|----------|-----------------|
| **Decisions** | Any decision made by the human or jointly (e.g., "we'll use Postgres + pgvector") |
| **Important Info** | Facts the human provided that should be remembered (e.g., preferences, constraints) |
| **Action Items** | Things to do later, follow-ups, tasks not yet completed |
| **Context Changes** | Project state changes, new businesses, new channels |
| **Lessons** | What worked, what didn't, what to avoid |
### Step 2: Write to Storage
**File-based (current):**
- Update `memory/YYYY-MM-DD.md` with new entries
- Update `MEMORY.md` for long-term memory
- Update `USER.md` if human preferences changed
- Update project-specific files if applicable
**Database (future - when Postgres/pgvector available):**
- Write to `session_summaries` table
- Generate embeddings for RAG context
- Log to `event_log` table
### Step 3: Confirm in Chat
After saving, say EXACTLY:
```
💾 Saved to memory:
- X decisions
- X key info items
- X action items
[If action items exist:]
TODO: [list each action item]
```
This confirms to the human that their information was saved.
## Triggers
**Automatic triggers (run yourself):**
1. Session idle for 5+ minutes (check on heartbeat or cron)
2. Task marked as complete
3. Human explicitly asks to save
**Manual triggers (human invokes):**
- `/save` - Save current session state
- `/memory` - Show what has been saved this session
- `/remember <info>` - Manually add something to memory
## Quality Standards
**DO:**
- Write specific, actionable entries
- Include context (why this matters)
- Use bullet points for readability
- Include dates when relevant
- Add to appropriate memory file (daily vs long-term)
**DON'T:**
- Write vague entries like "discussed project"
- Skip this step "if nothing important happened"
- Save trivial things (greetings, small talk)
- Write excessively long entries
## Integration Points
When running this skill, also check:
1. **TODOs** - Any pending tasks that should be logged?
2. **Open Threads** - Any ongoing conversations that need continuation notes?
3. **Project State** - Did any project context change?
## Example Output
```
💾 Saved to memory:
- Decision: Use Valkey (not RabbitMQ) for message bus
- Decision: bge-m3 for embeddings, cogito:14b for local chat
- Key info: Postgres image already has pgvector built-in
- Action: Check deployed stack via Portainer at 10.1.1.45
TODO:
- [ ] Pull bge-m3 model to Ollama
- [ ] Verify pgvector in postgres image
- [ ] Draft instance configs for Main + 3 departments
```