Add session, maintenance, and backup commands

New commands:
- /summarize: Save session decisions/preferences to memory
- /maintain: Configuration maintenance (validate, backup, restore, etc.)

New automation scripts:
- backup.sh: Create timestamped config backup (excludes secrets)
- restore.sh: Restore config from backup (with validation)

Updates:
- component-registry.json: Added new commands
- commands/README.md: Updated with new entries
- automation/README.md: Documented utility scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2026-01-01 12:11:52 -08:00
parent cbed85edf5
commit f682d781a0
7 changed files with 432 additions and 0 deletions

View File

@@ -11,6 +11,8 @@ Slash commands for quick actions. User-invoked (type `/command` to trigger).
| `/pa` | `/assistant`, `/ask` | Personal assistant entrypoint |
| `/help` | `/commands`, `/skills` | Show available commands and skills |
| `/status` | `/overview`, `/dashboard` | Quick status across all domains |
| `/summarize` | `/save-session` | Summarize and save session to memory |
| `/maintain` | `/maintenance`, `/admin` | Configuration maintenance |
| `/programmer` | | Code development tasks |
| `/gcal` | `/calendar`, `/cal` | Google Calendar access |
| `/usage` | `/stats` | View usage statistics |

84
commands/maintain.md Normal file
View File

@@ -0,0 +1,84 @@
---
name: maintain
description: Configuration maintenance operations (backup, validate, etc.)
aliases: [maintenance, admin]
---
# /maintain Command
Configuration maintenance operations.
## Subcommands
| Subcommand | Description |
|------------|-------------|
| `validate` | Validate configuration setup |
| `backup` | Create configuration backup |
| `restore` | Restore from backup |
| `registry` | Regenerate component registry |
| `clean` | Clean up temporary files |
## Usage
```
/maintain validate # Run validation checks
/maintain backup # Create timestamped backup
/maintain restore # List and restore from backups
/maintain registry # Regenerate component-registry.json
/maintain clean # Remove temp files, old logs
```
## Implementation
### validate
```bash
~/.claude/automation/validate-setup.sh
```
### backup
```bash
~/.claude/automation/backup.sh
```
### restore
```bash
# List backups
~/.claude/automation/restore.sh
# Restore specific backup
~/.claude/automation/restore.sh ~/.claude/backups/claude-config-TIMESTAMP.tar.gz
```
### registry
```bash
python3 ~/.claude/automation/generate-registry.py
```
### clean
Remove:
- `~/.claude/logs/workflows/*.log` older than 30 days
- `~/.claude/backups/*.tar.gz` beyond last 10
- `~/.claude/todos/*.json` (managed by Claude Code)
## Output Format
```
🔧 Maintenance: validate
Running validation...
[validation output]
✓ Validation complete
```
## When to Use
- After making configuration changes
- Before/after major updates
- Periodically for housekeeping
- When troubleshooting issues

101
commands/summarize.md Normal file
View File

@@ -0,0 +1,101 @@
---
name: summarize
description: Summarize and save the current session context
aliases: [save-session, session-summary]
---
# /summarize Command
Summarize the current session and save key information to memory.
## When Invoked
Extract and save important information from the current conversation:
1. **Decisions made**`memory/decisions.json`
2. **Preferences learned**`memory/preferences.json`
3. **Project context**`memory/projects.json`
4. **Facts discovered**`memory/facts.json`
## Process
### Step 1: Analyze Session
Review the conversation for:
- Explicit decisions ("let's use X", "we decided Y")
- Implicit preferences ("I prefer", "always do X")
- Project-related context (paths, configs, conventions)
- Facts about the environment or user
### Step 2: Categorize Items
For each item, determine:
- **Category**: decision, preference, project, fact
- **Content**: Brief description
- **Context**: Why it matters (optional)
### Step 3: Save to Memory
Append to the appropriate memory file:
```json
{
"id": "uuid",
"date": "YYYY-MM-DD",
"content": "Description of item",
"context": "Additional context",
"session": "session-id"
}
```
### Step 4: Update History Index
Mark session as summarized in `history/index.json`:
```json
{
"sessions": [
{
"id": "session-id",
"started": "timestamp",
"summarized": true
}
]
}
```
## Output Format
```
📝 Session Summary
Saved to memory:
• Decision: Use plugin structure for .claude config
• Preference: Prefer scripts over inline code in skills
• Fact: Gmail venv at ~/.claude/mcp/gmail/venv
Session marked as summarized.
```
## Memory File Locations
| File | Content |
|------|---------|
| `~/.claude/state/personal-assistant/memory/decisions.json` | Choices made |
| `~/.claude/state/personal-assistant/memory/preferences.json` | User preferences |
| `~/.claude/state/personal-assistant/memory/projects.json` | Project context |
| `~/.claude/state/personal-assistant/memory/facts.json` | Environment facts |
## When to Use
- End of a productive session
- After making important decisions
- When asked to "remember this"
- Before long breaks
## Policy
- Only save genuinely useful information
- Avoid redundancy with existing memory
- Keep descriptions concise
- Include context when helpful