shraga 0.0.3 → 0.1.2
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.
- package/README.md +82 -27
- package/defaults/agents/summarizer.md +16 -0
- package/defaults/agents/trace-extractor.md +84 -0
- package/defaults/bin/claude +45 -0
- package/defaults/bin/claude-revive +17 -0
- package/defaults/extensions/README.md +70 -0
- package/defaults/extensions/selftest.ext.ts +43 -0
- package/defaults/extensions/stripe-webhook.ext.ts +58 -0
- package/defaults/gmail-triage-prompt.md +42 -0
- package/defaults/scripts/README +4 -0
- package/defaults/scripts/agent-once.ts +67 -0
- package/defaults/scripts/backfill-slack-usernames.ts +82 -0
- package/defaults/scripts/notifier-throttle.ts +44 -0
- package/defaults/scripts/summarize-conversations.ts +5 -0
- package/defaults/shraga.config.ts +29 -0
- package/defaults/skills/add-skill.md +14 -0
- package/defaults/skills/artifacts.md +116 -0
- package/defaults/skills/code-review.md +26 -0
- package/defaults/skills/communications.md +54 -0
- package/defaults/skills/context-audit.md +87 -0
- package/defaults/skills/debug.md +10 -0
- package/defaults/skills/garden.md +179 -0
- package/defaults/skills/github-contributor.md +35 -0
- package/defaults/skills/identity.md +30 -0
- package/defaults/skills/mcp-server.md +62 -0
- package/defaults/skills/mcps-sync.md +105 -0
- package/defaults/skills/plan.md +9 -0
- package/defaults/skills/platform.md +177 -0
- package/defaults/skills/reconcile.md +239 -0
- package/defaults/skills/scheduler.md +192 -0
- package/defaults/skills/self-aware.md +136 -0
- package/defaults/skills/shraga-know.md +333 -0
- package/defaults/skills/stripe.md +55 -0
- package/defaults/skills/write-tests.md +10 -0
- package/defaults/skills-defaults.json +1 -0
- package/defaults/system-prompt.md +46 -0
- package/defaults/workspace/context.md +28 -0
- package/defaults/workspace.md +50 -0
- package/defaults/zdotdir/.gitignore +8 -0
- package/defaults/zdotdir/.zlogin +3 -0
- package/defaults/zdotdir/.zprofile +1 -0
- package/defaults/zdotdir/.zshenv +4 -0
- package/defaults/zdotdir/.zshrc +3 -0
- package/dist/client/assets/index-BoHttkMt.js +1940 -0
- package/dist/client/assets/index-DdibEb2O.css +10 -0
- package/dist/client/index.html +22 -0
- package/package.json +59 -14
- package/src/cli.ts +71 -46
- package/src/client/App.tsx +510 -0
- package/src/client/components/ArtifactCard.tsx +26 -0
- package/src/client/components/ArtifactPanel.tsx +138 -0
- package/src/client/components/AuthedImage.tsx +85 -0
- package/src/client/components/AutocompleteTextarea.tsx +149 -0
- package/src/client/components/ChatView.tsx +866 -0
- package/src/client/components/CliAuthConsent.tsx +98 -0
- package/src/client/components/ConfigPanel.tsx +328 -0
- package/src/client/components/ConversationHeader.tsx +156 -0
- package/src/client/components/ConversationPane.tsx +277 -0
- package/src/client/components/LoginPage.tsx +81 -0
- package/src/client/components/MachineStats.tsx +77 -0
- package/src/client/components/McpManager.tsx +209 -0
- package/src/client/components/MessageInput.tsx +263 -0
- package/src/client/components/OAuthConsent.tsx +103 -0
- package/src/client/components/SchedulesManager.tsx +99 -0
- package/src/client/components/Sidebar.tsx +235 -0
- package/src/client/components/SkillsManager.tsx +280 -0
- package/src/client/components/SmartChart.tsx +167 -0
- package/src/client/components/Toast.tsx +54 -0
- package/src/client/components/WorkspaceTree.tsx +313 -0
- package/src/client/components/ZoomableImage.tsx +123 -0
- package/src/client/components/artifact-presets.ts +10 -0
- package/src/client/components/schedules/ScheduleEditor.tsx +264 -0
- package/src/client/components/schedules/ScheduleList.tsx +271 -0
- package/src/client/components/ui/accordion.tsx +50 -0
- package/src/client/components/ui/button.tsx +43 -0
- package/src/client/components/ui/dialog.tsx +82 -0
- package/src/client/components/ui/input.tsx +19 -0
- package/src/client/components/ui/scroll-area.tsx +39 -0
- package/src/client/components/ui/textarea.tsx +18 -0
- package/src/client/globals.css +51 -0
- package/src/client/hooks/useAgentSocket.ts +79 -0
- package/src/client/hooks/useArtifacts.ts +89 -0
- package/src/client/hooks/useAuth.ts +127 -0
- package/src/client/hooks/useConversation.ts +412 -0
- package/src/client/hooks/useDarkMode.ts +57 -0
- package/src/client/hooks/useIsMobile.ts +23 -0
- package/src/client/hooks/usePush.ts +127 -0
- package/src/client/hooks/useSchedules.ts +73 -0
- package/src/client/hooks/useUnread.ts +238 -0
- package/src/client/lib/desktopAttention.ts +75 -0
- package/src/client/lib/firebase.ts +32 -0
- package/src/client/lib/googleAuthNative.ts +94 -0
- package/src/client/lib/native.ts +43 -0
- package/src/client/lib/schedule-types.ts +34 -0
- package/src/client/lib/sessionApi.ts +58 -0
- package/src/client/lib/slots.tsx +79 -0
- package/src/client/lib/storage.ts +39 -0
- package/src/client/lib/utils.ts +26 -0
- package/src/client/lib/workspaceContext.tsx +54 -0
- package/src/client/lib/ws.ts +203 -0
- package/src/client/main.tsx +14 -0
- package/src/mcp-stdio-bridge.ts +70 -0
- package/src/scripts/summarize-conversations.ts +5 -0
- package/src/scripts/typecheck.ts +43 -0
- package/src/server/agents.ts +54 -0
- package/src/server/api-keys.ts +63 -0
- package/src/server/artifacts/artifacts.export.ts +85 -0
- package/src/server/artifacts/artifacts.handler.ts +93 -0
- package/src/server/artifacts/artifacts.routes.ts +43 -0
- package/src/server/artifacts/artifacts.service.ts +100 -0
- package/src/server/artifacts/artifacts.types.ts +31 -0
- package/src/server/auth.ts +262 -0
- package/src/server/claude.ts +394 -0
- package/src/server/commands.ts +21 -0
- package/src/server/contacts.ts +177 -0
- package/src/server/conversation-summarizer.ts +204 -0
- package/src/server/data-sync.ts +664 -0
- package/src/server/directives.ts +91 -0
- package/src/server/engine/claude-code.ts +514 -0
- package/src/server/engine/index.ts +41 -0
- package/src/server/engine/registry.ts +21 -0
- package/src/server/engine/shared.ts +47 -0
- package/src/server/engine/types.ts +48 -0
- package/src/server/env-resolve.ts +71 -0
- package/src/server/env-sanitize.ts +9 -0
- package/src/server/events/bus.ts +29 -0
- package/src/server/events/dispatcher.ts +48 -0
- package/src/server/events/routes.ts +19 -0
- package/src/server/events/types.ts +9 -0
- package/src/server/extensions.ts +101 -0
- package/src/server/features.ts +109 -0
- package/src/server/file-inject.ts +45 -0
- package/src/server/hooks.ts +142 -0
- package/src/server/idempotency.ts +25 -0
- package/src/server/index.ts +1715 -0
- package/src/server/integrity-audit.ts +132 -0
- package/src/server/mcp-catalog.ts +70 -0
- package/src/server/mcp-oauth.ts +198 -0
- package/src/server/mcp-progress.ts +45 -0
- package/src/server/mcp-server.ts +456 -0
- package/src/server/mcp-sidecar.ts +87 -0
- package/src/server/mcp.ts +291 -0
- package/src/server/model-aliases.ts +76 -0
- package/src/server/paths.ts +24 -0
- package/src/server/polls.ts +175 -0
- package/src/server/push/apns.ts +113 -0
- package/src/server/push/fcm.ts +108 -0
- package/src/server/push/push.ts +66 -0
- package/src/server/push/store.ts +84 -0
- package/src/server/push/triggers.ts +99 -0
- package/src/server/scheduler/builtins.ts +157 -0
- package/src/server/scheduler/engine.ts +432 -0
- package/src/server/scheduler/index.ts +4 -0
- package/src/server/scheduler/runner.ts +334 -0
- package/src/server/scheduler/storage.ts +98 -0
- package/src/server/scheduler/timing.ts +70 -0
- package/src/server/scheduler/types.ts +62 -0
- package/src/server/sdk-utils.ts +45 -0
- package/src/server/seed.ts +174 -0
- package/src/server/session-bus.ts +18 -0
- package/src/server/sessions.ts +559 -0
- package/src/server/shraga-config.ts +167 -0
- package/src/server/skills.ts +372 -0
- package/src/server/slack/api.ts +37 -0
- package/src/server/slack/bot.ts +391 -0
- package/src/server/slack/context-cache.ts +42 -0
- package/src/server/slack/feature.ts +59 -0
- package/src/server/slack/mention-rewrite.ts +59 -0
- package/src/server/slack/oauth.ts +102 -0
- package/src/server/slack/questions.ts +112 -0
- package/src/server/slack/sessions.ts +139 -0
- package/src/server/stats.ts +106 -0
- package/src/server/summarize.ts +11 -0
- package/src/server/turn-context.ts +61 -0
- package/src/server/unclaw-config.ts +19 -0
- package/src/server/unread.ts +79 -0
- package/src/server/user-context.ts +33 -0
- package/src/server/vendor-sync.ts +52 -0
- package/src/server/voice-provider.ts +74 -0
- package/src/server/workspace.ts +249 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# GitHub Contributor
|
|
2
|
+
|
|
3
|
+
You can act as an autonomous contributor on GitHub repos. Issues and PRs arrive as conversation turns (via the GitHub webhook); your final reply text is posted back as a comment on the thread.
|
|
4
|
+
|
|
5
|
+
## Trust tiers (resolved from GitHub, shown in the prompt)
|
|
6
|
+
|
|
7
|
+
- **autonomous** — author is a repo collaborator (write+). You may implement, verify, merge, and self-apply.
|
|
8
|
+
- **gated** — author has a previously merged PR but isn't a collaborator. Implement, verify, open the PR — then STOP and request owner approval (Slack) before any merge.
|
|
9
|
+
- **default** — unknown author. The platform queues these for human triage; you won't see them until a human engages.
|
|
10
|
+
|
|
11
|
+
Hard rules regardless of tier:
|
|
12
|
+
- Foreign PRs (code you didn't write) are never merged below collaborator trust.
|
|
13
|
+
- Changes touching auth, deploy tooling, secrets handling, or trust logic always require owner approval, even from trusted authors.
|
|
14
|
+
|
|
15
|
+
## Workflow for an issue
|
|
16
|
+
|
|
17
|
+
1. Investigate in a clone/worktree of the repo — never in the live app dir.
|
|
18
|
+
2. Implement on a branch; push; open a PR with `gh` (your `GITHUB_TOKEN` identity). Commit only with your configured git identity (inherited from global gitconfig) — if a clone has none, copy it from the global config; NEVER invent a name/email (unregistered emails break commit attribution and CI/deploy author checks).
|
|
19
|
+
3. Verify before proposing a merge: `bun run tools/shadow-verify.ts --pr <N>` — builds, typechecks, tests, and boots the branch as an isolated passive instance (throwaway data dir, no secrets). Include the YAML verdict in your PR/issue comment.
|
|
20
|
+
4. Keep the issue thread updated; be concise and factual in comments.
|
|
21
|
+
|
|
22
|
+
## Self-apply (autonomous tier only)
|
|
23
|
+
|
|
24
|
+
After merging, apply to the running instance with zero downtime:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
bun run tools/flip-restart.ts --restart-cmd "<service restart command>"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This holds traffic on a passive old-code twin during the restart and auto-falls-back to old code if the new code is unhealthy (exit 3 — report it and leave traffic as-is; recovery steps are in the script output).
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- `tools/shadow-verify.ts <branch>` also works for branches; `--keep` leaves the instance up for inspection; `--env <file>` injects an env file (never for foreign code).
|
|
35
|
+
- One session per issue/PR thread — comments on the same thread continue your session.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## Contact Registry
|
|
2
|
+
|
|
3
|
+
A built-in contact registry at `data/contacts.json` automatically tracks everyone you interact with across all channels.
|
|
4
|
+
|
|
5
|
+
### How it works
|
|
6
|
+
|
|
7
|
+
- **Operators** (whitelisted team members) are seeded at startup from `data/whitelist.json` with `isOperator: true`
|
|
8
|
+
- **Owners** are a subset of operators flagged with `isOwner: true` — the primary authority over the knowledge base (e.g. garden approvals route to owners only)
|
|
9
|
+
- **External contacts** are auto-created on first encounter (Slack message, inbound email, etc.)
|
|
10
|
+
- **Cross-channel merge**: when a Slack user's profile email matches an existing email-only contact, they merge into one record
|
|
11
|
+
- The `<current_user>` block in every prompt identifies who is speaking
|
|
12
|
+
- The `<known_contacts>` block lists all known people — operators and contacts — so you can recognize anyone mentioned in conversations
|
|
13
|
+
- Slack @mentions are resolved to `@Name (operator)` or `@Name` — the role tag tells you who is internal
|
|
14
|
+
|
|
15
|
+
### Contact record
|
|
16
|
+
|
|
17
|
+
Each contact has: `emails[]`, `slackIds[]`, `name`, `isOperator`, `isOwner` (optional), `firstSeen`, `lastSeen`.
|
|
18
|
+
|
|
19
|
+
### Identity awareness
|
|
20
|
+
|
|
21
|
+
When you encounter a person mentioned in a message or thread:
|
|
22
|
+
- Check `<known_contacts>` first — if they're listed, you already know them and their role
|
|
23
|
+
- Read `data/contacts.json` for full details (email, Slack IDs, history) when you need to take action involving them
|
|
24
|
+
- Use workspace files (e.g. `data/context.md`) for deeper context like responsibilities, communication preferences, or team dynamics
|
|
25
|
+
|
|
26
|
+
### What NOT to do
|
|
27
|
+
|
|
28
|
+
- Do NOT create manual identity files — `data/contacts.json` is the sole source of truth
|
|
29
|
+
- Do NOT scan the Slack workspace to build a user list — contacts are created on-demand
|
|
30
|
+
- Do NOT use MCP tools to look up team member emails — they're already in the registry
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# MCP Server & API Keys
|
|
2
|
+
|
|
3
|
+
Shraga exposes an embedded MCP endpoint at `POST /mcp` so external Claude clients (Claude Desktop, Claude Cloud, other MCP consumers) can access workspace, skills, sessions, schedules, and run prompts remotely.
|
|
4
|
+
|
|
5
|
+
## API Keys
|
|
6
|
+
|
|
7
|
+
Keys use the `uck_` prefix and are stored in `data/api-keys.json`.
|
|
8
|
+
|
|
9
|
+
**REST endpoints** (require Firebase auth or internal token):
|
|
10
|
+
- `POST /api/api-keys` — create a key. Body: `{ "label": "my-key" }`. Returns full key (only shown once).
|
|
11
|
+
- `GET /api/api-keys` — list keys (key values masked).
|
|
12
|
+
- `DELETE /api/api-keys/:id` — delete a key (owner or server owner only).
|
|
13
|
+
|
|
14
|
+
**Generating a key via curl** (from an agent session):
|
|
15
|
+
```bash
|
|
16
|
+
curl -X POST "$SHRAGA_BASE_URL/api/api-keys" \
|
|
17
|
+
-H "Content-Type: application/json" \
|
|
18
|
+
-H "x-internal-token: $INTERNAL_API_TOKEN" \
|
|
19
|
+
-d '{"label":"claude-desktop"}'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Connecting Claude Desktop
|
|
23
|
+
|
|
24
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (uses stdio bridge — Claude Desktop doesn't support HTTP URL transport):
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"shraga": {
|
|
29
|
+
"command": "bun",
|
|
30
|
+
"args": ["run", "/path/to/shraga/src/mcp-stdio-bridge.ts"],
|
|
31
|
+
"env": {
|
|
32
|
+
"MCP_URL": "https://your-host",
|
|
33
|
+
"MCP_API_KEY": "uck_..."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Available MCP Tools
|
|
41
|
+
|
|
42
|
+
| Tool | Description |
|
|
43
|
+
|------|-------------|
|
|
44
|
+
| `get_sessions` | List conversations with pagination |
|
|
45
|
+
| `get_sessions_messages` | Read conversation history |
|
|
46
|
+
| `get_workspace` | List workspace file tree |
|
|
47
|
+
| `get_workspace_file` | Read a workspace file |
|
|
48
|
+
| `put_workspace_file` | Write/update a workspace file |
|
|
49
|
+
| `get_workspace_search` | Search file contents for text (case-insensitive) |
|
|
50
|
+
| `get_skills` | List agent skills with metadata |
|
|
51
|
+
| `get_skills_read` | Read full skill content |
|
|
52
|
+
| `put_skills_write` | Create/update a skill |
|
|
53
|
+
| `get_schedules` | List scheduled jobs |
|
|
54
|
+
| `post_schedules_run` | Trigger a schedule run |
|
|
55
|
+
| `post_chat` | Talk to the agent — conversational, multi-turn via sessionId |
|
|
56
|
+
| `get_config` | Read agent configuration |
|
|
57
|
+
|
|
58
|
+
## Source
|
|
59
|
+
|
|
60
|
+
- `src/server/mcp-server.ts` — tool definitions + Express bridge
|
|
61
|
+
- `src/server/api-keys.ts` — API key CRUD
|
|
62
|
+
- `.claude/skills/mcp-shraga/SKILL.md` — MCP skill resource
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Sync MCP server repos — clone new, push+pull existing, register in config, report missing env vars. Run periodically to keep MCP servers up to date.
|
|
3
|
+
triggers:
|
|
4
|
+
- sync mcps
|
|
5
|
+
- mcps sync
|
|
6
|
+
- setup mcps
|
|
7
|
+
- provision mcps
|
|
8
|
+
- install mcp servers
|
|
9
|
+
- update mcp repos
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# MCP Sync
|
|
13
|
+
|
|
14
|
+
Sync all `mcp-*` repos from GitHub, register in shraga config, report missing env vars.
|
|
15
|
+
Run this periodically to keep MCP servers up to date.
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Discover repos from GitHub
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
gh repo list <your-org-or-user> --limit 100 --json name,sshUrl -q '.[] | select(.name | startswith("mcp-"))'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Include all `mcp-*` repos — the `mcp-` prefix is the convention this skill keys on. If your MCP
|
|
26
|
+
servers live elsewhere (a different org, or one repo per server under a monorepo), adjust the query
|
|
27
|
+
to match; everything downstream only needs a name and a clone URL.
|
|
28
|
+
|
|
29
|
+
### 2. For each repo: clone, push, or pull
|
|
30
|
+
|
|
31
|
+
Target directory: wherever you keep the checkouts (e.g. `~/Projects/`). Keep it consistent — the
|
|
32
|
+
config paths registered in step 3 point at it.
|
|
33
|
+
|
|
34
|
+
**If not cloned yet:**
|
|
35
|
+
```bash
|
|
36
|
+
git clone <sshUrl> <target>/<name>
|
|
37
|
+
bun install --cwd <target>/<name>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**If already cloned:**
|
|
41
|
+
```bash
|
|
42
|
+
# Push any committed local changes first
|
|
43
|
+
git -C <target>/<name> push 2>/dev/null || true
|
|
44
|
+
# Then pull latest
|
|
45
|
+
git -C <target>/<name> pull --ff-only
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If pull fails due to divergence, report it and skip (don't force).
|
|
49
|
+
|
|
50
|
+
### 3. Symlink into vendor/
|
|
51
|
+
|
|
52
|
+
For each repo, ensure `vendor/<name>` symlinks to the cloned repo:
|
|
53
|
+
```bash
|
|
54
|
+
# Check if symlink exists and points correctly
|
|
55
|
+
readlink vendor/<name>
|
|
56
|
+
# Create/update if needed
|
|
57
|
+
ln -sf <target>/<name> vendor/<name>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 4. Register new MCPs in shraga.config.ts
|
|
61
|
+
|
|
62
|
+
Read `data/shraga.config.ts`. For each repo not already in the `mcps` block:
|
|
63
|
+
|
|
64
|
+
1. Detect required env vars from `.env.example`:
|
|
65
|
+
```bash
|
|
66
|
+
grep -E '^[A-Z_]+=.' <repo>/.env.example | cut -d= -f1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. Detect CLI entry point (most use `src/mcp/cli.ts`, `mcp-firebase` uses `src/cli.ts`)
|
|
70
|
+
|
|
71
|
+
3. Add shorthand entry:
|
|
72
|
+
```typescript
|
|
73
|
+
'mcp-name': {
|
|
74
|
+
env: ['VAR1', 'VAR2'],
|
|
75
|
+
},
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Never overwrite existing entries.** Only add new ones.
|
|
79
|
+
|
|
80
|
+
### 5. Report status
|
|
81
|
+
|
|
82
|
+
Print a summary table:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
MCP Sync Results:
|
|
86
|
+
mcp-slack up to date
|
|
87
|
+
mcp-firebase pulled 3 commits
|
|
88
|
+
mcp-pdf cloned (NEW)
|
|
89
|
+
mcp-cursor pushed 1, pulled 2
|
|
90
|
+
|
|
91
|
+
Missing env vars (add to .env):
|
|
92
|
+
mcp-stripe STRIPE_SECRET_KEY
|
|
93
|
+
mcp-gmail GOOGLE_SERVICE_ACCOUNT, GMAIL_USER_EMAIL
|
|
94
|
+
|
|
95
|
+
All configured: mcp-slack, mcp-firebase, mcp-google-drive
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Rules
|
|
99
|
+
|
|
100
|
+
- Never write secrets or API key values — only report env var **names**
|
|
101
|
+
- Use SSH URLs for cloning (check remote format: `github.com-personal` or `github.com`)
|
|
102
|
+
- Don't modify existing entries in shraga.config.ts
|
|
103
|
+
- Don't force-push or force-pull — report conflicts
|
|
104
|
+
- After adding new MCPs, remind user to restart shraga
|
|
105
|
+
- Check `.env` in the shraga project root for existing env var values
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Before writing any code, produce a concise implementation plan:
|
|
2
|
+
|
|
3
|
+
1. **Goal**: One sentence summary of what we're building
|
|
4
|
+
2. **Approach**: The chosen strategy and why (mention alternatives considered)
|
|
5
|
+
3. **Steps**: Numbered list of concrete implementation steps
|
|
6
|
+
4. **Files affected**: Which files will be created or modified
|
|
7
|
+
5. **Risks / open questions**: Anything that could go wrong or needs clarification
|
|
8
|
+
|
|
9
|
+
Keep the plan short — it should fit on one screen. Once the plan is agreed upon, proceed with implementation.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Shraga platform features — directives, config, thinking/reasoning, sessions, internal API, MCP
|
|
3
|
+
triggers:
|
|
4
|
+
- directive
|
|
5
|
+
- how do i switch model
|
|
6
|
+
- how do i enable thinking
|
|
7
|
+
- reasoning
|
|
8
|
+
- effort
|
|
9
|
+
- config panel
|
|
10
|
+
- platform feature
|
|
11
|
+
- internal api
|
|
12
|
+
- mcp tools
|
|
13
|
+
- deferred tools
|
|
14
|
+
- ToolSearch
|
|
15
|
+
- new conversation
|
|
16
|
+
- spawn conversation
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Shraga Platform Features
|
|
20
|
+
|
|
21
|
+
Reference for user-facing capabilities. Use this when users ask "how do I…" about the platform itself.
|
|
22
|
+
|
|
23
|
+
## Directives
|
|
24
|
+
|
|
25
|
+
Users can prefix any message with `[directives]` to override settings. Parsed server-side before the prompt reaches you. Directives stick to the session: once set, they apply to all later turns of that conversation (a new directive overrides the stored one).
|
|
26
|
+
|
|
27
|
+
**Syntax:** `[directive1, directive2, ...] rest of the message`
|
|
28
|
+
|
|
29
|
+
### Positional directives
|
|
30
|
+
|
|
31
|
+
| Position | What | Examples |
|
|
32
|
+
|----------|------|----------|
|
|
33
|
+
| 1st | Model alias | `fable`, `opus`, `sonnet`, `haiku`, `fable-5`, `opus-4-8`, `opus-4-7` |
|
|
34
|
+
| 2nd | Max turns (integer) | `5`, `20`, `100` |
|
|
35
|
+
|
|
36
|
+
### Named directives
|
|
37
|
+
|
|
38
|
+
| Directive | Values | Effect |
|
|
39
|
+
|-----------|--------|--------|
|
|
40
|
+
| `think` / `adaptive` | — | Enable adaptive thinking for this message |
|
|
41
|
+
| `nothink` | — | Disable thinking for this message |
|
|
42
|
+
| `thinking:VALUE` | `adaptive`, `enabled`, `disabled` | Set thinking mode explicitly |
|
|
43
|
+
| `effort:VALUE` | `low`, `medium`, `high`, `max` | Set reasoning effort level |
|
|
44
|
+
| `model:VALUE` | Any alias | Override model |
|
|
45
|
+
| `turns:VALUE` | Integer | Override max turns |
|
|
46
|
+
|
|
47
|
+
### Examples
|
|
48
|
+
|
|
49
|
+
- `[opus] review this PR` — use Opus for this message
|
|
50
|
+
- `[opus, 5] quick answer` — Opus, max 5 turns
|
|
51
|
+
- `[think] explain the tradeoffs` — enable thinking
|
|
52
|
+
- `[opus, think, effort:max] deep analysis` — Opus + thinking + max effort
|
|
53
|
+
- `[nothink] just do it` — disable thinking
|
|
54
|
+
- `[haiku, 3] one-liner summary` — Haiku, 3 turns
|
|
55
|
+
|
|
56
|
+
## Config Panel (sliders icon)
|
|
57
|
+
|
|
58
|
+
Persistent settings that apply to all messages until changed:
|
|
59
|
+
|
|
60
|
+
| Setting | Options | Default |
|
|
61
|
+
|---------|---------|---------|
|
|
62
|
+
| Model | Fable 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 4.6, Haiku 4.5 | Sonnet 4.6 |
|
|
63
|
+
| Permission Mode | Accept Edits, Plan, Bypass All | Accept Edits |
|
|
64
|
+
| Max Turns | 1–200 | 50 |
|
|
65
|
+
| Thinking | Adaptive, Enabled, Disabled | Off |
|
|
66
|
+
| Effort | Low, Medium, High, Max | Default |
|
|
67
|
+
| Allowed Tools | Comma-separated list | All |
|
|
68
|
+
| Skill Discovery | On/Off | On |
|
|
69
|
+
| System Prompt | Free text appended to system prompt | Empty |
|
|
70
|
+
|
|
71
|
+
Directives override config and persist for the session. On a session's first turn, the resolved engine/model/turns/thinking are pinned to the session — reopening it from history resumes the exact same shape even if config defaults change later.
|
|
72
|
+
|
|
73
|
+
## Thinking / Reasoning
|
|
74
|
+
|
|
75
|
+
When enabled (via config or `[think]` directive), the model produces extended reasoning before responding. Thinking blocks appear as collapsible violet panels in the chat UI, hidden by default behind the details toggle (eye icon).
|
|
76
|
+
|
|
77
|
+
- **Adaptive** — model decides when to think (recommended)
|
|
78
|
+
- **Enabled** — always produce thinking
|
|
79
|
+
- **Disabled** — never produce thinking
|
|
80
|
+
|
|
81
|
+
**Effort** controls reasoning depth: `low` (fast) → `max` (thorough). Can be set independently of thinking.
|
|
82
|
+
|
|
83
|
+
## Artifacts
|
|
84
|
+
|
|
85
|
+
HTML files with an `<!-- artifact: {...} -->` comment are rendered in a side panel. See the `artifacts` skill for details.
|
|
86
|
+
|
|
87
|
+
## Machine Stats
|
|
88
|
+
|
|
89
|
+
The sidebar footer (next to the version) shows a live CPU/memory sparkline of the **host machine** — a 10-minute trend so issues (swap thrash, runaway builds) are visible at a glance. A single server-side sampler (`src/server/stats.ts`) samples the host every 5s and broadcasts each point over WS; clients seed from `GET /api/stats` (cached ring buffer) and never poll the box themselves. Colors: green <75%, amber ≥75%, red ≥90%.
|
|
90
|
+
|
|
91
|
+
## Sessions
|
|
92
|
+
|
|
93
|
+
- Each conversation is a session with a unique ID
|
|
94
|
+
- Sessions persist as JSONL in `data/conversations/`
|
|
95
|
+
- Share via URL: `?session=SESSION_ID`
|
|
96
|
+
|
|
97
|
+
### Starting a New Conversation
|
|
98
|
+
|
|
99
|
+
You can spawn a new independent conversation from within a running session:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
curl -X POST http://localhost:$PORT/api/chat \
|
|
103
|
+
-H "x-internal-token: $INTERNAL_API_TOKEN" \
|
|
104
|
+
-H "Content-Type: application/json" \
|
|
105
|
+
-d '{"prompt": "your task here"}'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Omit `sessionId` to create a fresh conversation. The new session runs with full agent capabilities (tools, MCP, skills).
|
|
109
|
+
|
|
110
|
+
**Default (async)**: returns `{ sessionId, status: "accepted" }` immediately; the agent runs in the background. Add `"callbackUrl": "..."` to get POSTed the result when done.
|
|
111
|
+
|
|
112
|
+
**Sync mode**: add `"sync": true` to wait for the full response: `{ sessionId, text, blocks }`.
|
|
113
|
+
|
|
114
|
+
## Internal API Auth
|
|
115
|
+
|
|
116
|
+
A random `INTERNAL_API_TOKEN` is generated on startup and set in your environment. Use it to call any authenticated endpoint from within a session:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
curl -H "x-internal-token: $INTERNAL_API_TOKEN" http://localhost:$PORT/api/...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The request authenticates as the current session user automatically.
|
|
123
|
+
|
|
124
|
+
## MCP Tools
|
|
125
|
+
|
|
126
|
+
MCP servers are configured per-deployment in `data/mcps/*.json`. All MCP tools are available to you, but most are **deferred** — you must call **ToolSearch** to load their schemas before invoking them. ToolSearch is always available.
|
|
127
|
+
|
|
128
|
+
Startup logs show `[claude] MCP: name:status` for each server. If a tool call fails with `InputValidationError`, you likely forgot to ToolSearch it first.
|
|
129
|
+
|
|
130
|
+
## Contextual Triggers
|
|
131
|
+
|
|
132
|
+
Skills can trigger based on conversation context, not just message keywords. The platform injects context tags before matching:
|
|
133
|
+
|
|
134
|
+
| Tag | Source | Example |
|
|
135
|
+
|-----|--------|---------|
|
|
136
|
+
| `source:slack` | All Slack messages | |
|
|
137
|
+
| `source:web` | Web UI messages | |
|
|
138
|
+
| `source:api` | API endpoint messages | |
|
|
139
|
+
| `channel:#name` | Slack channel name | `channel:#support` |
|
|
140
|
+
| `dm:true` | Slack DMs | |
|
|
141
|
+
| `thread:ts` | Slack thread timestamp | `thread:1780293395.005369` |
|
|
142
|
+
| `user:email` | User's email | `user:alice@co.com` |
|
|
143
|
+
|
|
144
|
+
Triggers use simple substring matching — any trigger string that appears in the context+message input will activate the skill.
|
|
145
|
+
|
|
146
|
+
Example skill with contextual trigger:
|
|
147
|
+
```yaml
|
|
148
|
+
---
|
|
149
|
+
description: Support channel guidelines
|
|
150
|
+
triggers:
|
|
151
|
+
- "channel:#support"
|
|
152
|
+
---
|
|
153
|
+
Be empathetic. Acknowledge the issue before troubleshooting...
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
You can combine contextual and keyword triggers in the same skill. You can also create contextual skills on behalf of users — write a skill file in `data/skills/` with the appropriate trigger.
|
|
157
|
+
|
|
158
|
+
## Ephemeral Skills (TTL)
|
|
159
|
+
|
|
160
|
+
Skills can have an expiration time via the `expires` frontmatter field (ISO 8601). After expiry, the skill stops triggering, is hidden from the skill index, and is purged on server restart.
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
---
|
|
164
|
+
description: Temporary pricing empathy for #sales
|
|
165
|
+
triggers:
|
|
166
|
+
- "channel:#sales"
|
|
167
|
+
expires: 2026-06-02T18:00:00Z
|
|
168
|
+
---
|
|
169
|
+
When discussing pricing, be empathetic about budget constraints...
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Use cases:
|
|
173
|
+
- Temporary tone/behavior for a specific channel or thread topic
|
|
174
|
+
- Time-limited campaign responses
|
|
175
|
+
- Short-lived instructions that shouldn't persist
|
|
176
|
+
|
|
177
|
+
To create an ephemeral skill: write a skill file with `expires` set to the desired ISO 8601 datetime. Compute from natural language (e.g. "for the next 2 hours" → now + 2h).
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Knowledge Reconciliation
|
|
2
|
+
|
|
3
|
+
You are performing a workspace knowledge reconciliation — auditing what the team knows, learning from recent conversations, and keeping the knowledge base clean and current. Think of this like how the human mind works during sleep: rearranging information, strengthening important connections, discarding noise.
|
|
4
|
+
|
|
5
|
+
**Budget: stay under 40 tool calls total.** Prioritize breadth over depth — skim, don't deep-read.
|
|
6
|
+
|
|
7
|
+
**Run garden BEFORE reconcile.** If both are scheduled, garden cleans the structure first, then reconcile adds new content into a clean workspace.
|
|
8
|
+
|
|
9
|
+
## Phase 1: Scan Conversation Summaries
|
|
10
|
+
|
|
11
|
+
The summarizer job writes `.summary.md` files next to each conversation JSONL. Start there — they're short, dense, and optimized for recall.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ls -lt data/conversations/*.summary.md 2>/dev/null | head -20
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Read the most recent summaries (up to 10). These are your primary source for what happened recently. If a summary mentions something interesting that needs more context, peek at user and assistant text only (filter out tool calls):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
tail -200 data/conversations/{sessionId}.jsonl | jq -s '.[] | select(.role == "user" or .role == "assistant") | .blocks[]? | select(.type == "text") | .text' | head -20
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
But prefer summaries — only dive into full JSONL when the summary isn't enough. Skip tool_use and tool_result blocks entirely.
|
|
24
|
+
|
|
25
|
+
## Phase 2: Extract User Learnings
|
|
26
|
+
|
|
27
|
+
For each conversation summary, extract learnings about **every person involved** — not just the `user:` in the header. A conversation between Alice and the agent might teach you about Bob's communication style, Carol's debugging approach, or Dave's priorities. Learnings about a person can come from:
|
|
28
|
+
- **Direct conversations** — the person is the `user:` (e.g. Bob DMing the agent on Slack)
|
|
29
|
+
- **Indirect mentions** — someone else discusses them, their work, their style, or corrects the agent's behavior toward them
|
|
30
|
+
- **Observed interactions** — Slack threads, escalations, cross-team exchanges referenced in the conversation
|
|
31
|
+
|
|
32
|
+
Think like a colleague building a mental model of everyone on the team, not just whoever you're currently talking to.
|
|
33
|
+
|
|
34
|
+
### What to look for
|
|
35
|
+
|
|
36
|
+
**Corrections & steering (highest priority):**
|
|
37
|
+
Scan for moments where the user redirected the agent: "no, do X instead", "don't do that", "that's wrong", "use Y not Z". These become hard rules in the user's Corrections section. Be specific — "use YAML not JSON for reports" not "prefers structured formats."
|
|
38
|
+
|
|
39
|
+
**Decision patterns:**
|
|
40
|
+
How did they approach problems? What did they investigate first? What did they prioritize? What tools/data sources did they reach for? Example: "Alice pulled metrics from Google Sheets, not the analytics dashboard" → learns information diet + source of truth.
|
|
41
|
+
|
|
42
|
+
**Expertise signals:**
|
|
43
|
+
What domain knowledge did they demonstrate? What did they teach the agent? What level of detail did they operate at?
|
|
44
|
+
|
|
45
|
+
**Taste & style:**
|
|
46
|
+
How much detail do they want in responses? What quality bar do they hold? How do they communicate — terse or detailed? Did they push for polish or accept "good enough"?
|
|
47
|
+
|
|
48
|
+
**Current focus:**
|
|
49
|
+
What are they actively working on? What keeps coming up across conversations?
|
|
50
|
+
|
|
51
|
+
### Map ALL mentioned people to directories
|
|
52
|
+
|
|
53
|
+
Use `data/contacts.json` to map names/emails to contact IDs. The contact `id` is the user directory name under `data/workspace/users/{id}/`.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cat data/contacts.json | jq -r '.[] | "\(.emails[0] // "no-email") → \(.id) (\(.name))"'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Build a list of **every team member** mentioned across all summaries — not just session owners. Then read each relevant user's current `user-context.md` to avoid duplicating what's already captured. Propose updates for every person you learned something new about.
|
|
60
|
+
|
|
61
|
+
### Categorize into sections
|
|
62
|
+
|
|
63
|
+
Organize proposed updates into the user-context categories: Who they are, How they operate, Corrections, Their taste, What they're working on. Not every conversation yields every category — only propose what you actually observed.
|
|
64
|
+
|
|
65
|
+
**Important:** User-learning extraction is always fresh — even if a previous reconcile report exists for today with team-scope proposals. Do NOT skip user extraction just because prior proposals exist. Prior reports may not have done user extraction at all. Always scan summaries for learnings about every mentioned person and propose user-scope updates regardless of prior passes.
|
|
66
|
+
|
|
67
|
+
## Phase 2.5: Skill Reflection (from traces)
|
|
68
|
+
|
|
69
|
+
The summarizer writes `.trace.yaml` files with structured session data (tools used, corrections, edge cases, novel patterns). Use these for skill-level analysis.
|
|
70
|
+
|
|
71
|
+
**Budget: max 8 tool calls for this phase.**
|
|
72
|
+
|
|
73
|
+
List recent traces:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
find data/conversations -name "*.trace.yaml" -mtime -1 -exec ls -lt {} + 2>/dev/null | head -10
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Read up to 5 recent traces. For each, cross-reference against existing skills in `data/skills/`:
|
|
80
|
+
|
|
81
|
+
**Check 1 — Novel workflow:** Does `novel_patterns` describe a multi-step workflow (5+ steps) not covered by any existing skill? Compare against skill filenames and their triggers. If novel, propose a new skill.
|
|
82
|
+
|
|
83
|
+
**Check 2 — Correction → skill gap:** Does any `corrections[]` entry reveal a missing rule in an existing skill? Match correction topics against skill names. Propose a Pitfall addition.
|
|
84
|
+
|
|
85
|
+
**Check 3 — Edge case → Pitfall:** Does any `edge_cases[]` entry belong in an existing skill's Pitfalls section? Match by tool name or domain.
|
|
86
|
+
|
|
87
|
+
**Check 4 — Tool misuse pattern:** Does `tool_failures[]` with `recovered: true` indicate a learnable pattern? Propose a rule in the relevant skill.
|
|
88
|
+
|
|
89
|
+
**Check 5 — Script candidate:** Does `script_candidates[]` describe a repeatable multi-tool sequence (3+ calls to the same MCP)? Cross-reference against existing scripts in `data/scripts/` and `src/scripts/` — skip if already extracted. Propose as a `/mcp-to-script` extraction task.
|
|
90
|
+
|
|
91
|
+
**Output:** Skill proposals under "Skill-Scope Changes", script candidates under "Script Candidates" in the report. For new skill proposals, use this template:
|
|
92
|
+
- Frontmatter: `origin: auto`, `generated: {date}`, `from_traces: [session-ids]`, `confidence: low|medium`, `reviewed: false`
|
|
93
|
+
- Sections: When to Use / Procedure / Pitfalls / Verification
|
|
94
|
+
|
|
95
|
+
If no traces exist or none yield findings, skip this phase silently.
|
|
96
|
+
|
|
97
|
+
## Phase 3: Audit Team-Scope Files
|
|
98
|
+
|
|
99
|
+
Read the key workspace files (context.md, tasks.md, open-questions.md) and skim knowledge/*.md filenames. Don't read every file — focus on the ones most likely stale.
|
|
100
|
+
|
|
101
|
+
A single conversation can yield both user-scope and team-scope learnings. The user-specific angle goes to user-scope, the team fact goes to team-scope.
|
|
102
|
+
|
|
103
|
+
For each file you audit, note:
|
|
104
|
+
- **Staleness**: dates older than 2 weeks, metrics that may have changed
|
|
105
|
+
- **Completeness**: tasks marked done but still listed, resolved questions still open
|
|
106
|
+
- **Duplication**: same fact appearing in multiple files
|
|
107
|
+
- **Contradictions**: conflicting info between files
|
|
108
|
+
|
|
109
|
+
## Phase 4: Classify & Report
|
|
110
|
+
|
|
111
|
+
**CRITICAL: This is your FINAL phase. Do NOT proceed to Phase 5 (Apply) unless the user explicitly replies with approval numbers.** Write the report, send the DM, and STOP. The reconcile job ends here — application happens in a separate conversation when the user responds.
|
|
112
|
+
|
|
113
|
+
Compile findings into a timestamped reconciliation report. Create the reports folder if needed:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
mkdir -p data/workspace/reconcile-reports
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Write the report to `data/workspace/reconcile-reports/{YYYY-MM-DD}.md`:
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
# Reconciliation Report — {date}
|
|
123
|
+
|
|
124
|
+
## Findings
|
|
125
|
+
- {number} stale items, {number} new learnings, {number} issues
|
|
126
|
+
|
|
127
|
+
## Skill-Scope Changes
|
|
128
|
+
1. **New skill**: `{name}` — {description}
|
|
129
|
+
- **Source traces**: {session IDs}
|
|
130
|
+
- **Proposed sections**: {brief outline}
|
|
131
|
+
|
|
132
|
+
2. **Patch**: `{skill}.md` — add Pitfall: {description}
|
|
133
|
+
- **Source**: {session title}: {what happened}
|
|
134
|
+
|
|
135
|
+
## Script Candidates
|
|
136
|
+
1. **{description}** — `{mcp}`, {N} tool calls/run
|
|
137
|
+
- **Source**: {session title}
|
|
138
|
+
- **Sequence**: {tool1} → {tool2} → {tool3}
|
|
139
|
+
- **Action**: Run `/mcp-to-script {description}` to extract
|
|
140
|
+
|
|
141
|
+
## Team-Scope Changes
|
|
142
|
+
1. **File**: {path} | **Action**: {update/add/remove/deduplicate}
|
|
143
|
+
- **Current**: {brief quote}
|
|
144
|
+
- **Proposed**: {what it should say}
|
|
145
|
+
- **Source**: {session title or audit finding}
|
|
146
|
+
|
|
147
|
+
## User-Scope Changes
|
|
148
|
+
{group by user name}
|
|
149
|
+
|
|
150
|
+
### {User Name} (`users/{id}/`)
|
|
151
|
+
|
|
152
|
+
**Corrections:**
|
|
153
|
+
1. {concrete rule extracted from a steering/correction moment} — Source: {session}
|
|
154
|
+
|
|
155
|
+
**Patterns:**
|
|
156
|
+
1. **{Category}**: {observation} — Source: {session}
|
|
157
|
+
|
|
158
|
+
## Suggestions
|
|
159
|
+
- {structural improvements, missing knowledge files, etc.}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Then send a Slack DM summary using `post_slack_message`:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
🔄 Nightly Reconciliation — {date}
|
|
166
|
+
|
|
167
|
+
{number} findings, {number} proposed changes.
|
|
168
|
+
Full report: data/workspace/reconcile-reports/{date}.md
|
|
169
|
+
|
|
170
|
+
Skill-scope:
|
|
171
|
+
1. {1-liner — new skill or patch}
|
|
172
|
+
...
|
|
173
|
+
|
|
174
|
+
Script candidates:
|
|
175
|
+
1. {description} — `{mcp}`, {N} calls/run → `/mcp-to-script`
|
|
176
|
+
...
|
|
177
|
+
|
|
178
|
+
Team-scope:
|
|
179
|
+
1. {1-liner}
|
|
180
|
+
...
|
|
181
|
+
|
|
182
|
+
User-scope:
|
|
183
|
+
{N}. {User Name} (`users/{id}/`)
|
|
184
|
+
Corrections:
|
|
185
|
+
• {concrete rule}
|
|
186
|
+
• {concrete rule}
|
|
187
|
+
Patterns:
|
|
188
|
+
• {category}: {observation}
|
|
189
|
+
• {category}: {observation}
|
|
190
|
+
|
|
191
|
+
Reply with numbers to approve (e.g. "1,3,5") or "all" to apply everything.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**User-scope proposals must show the actual content inline with context** — for each correction or pattern, show what you'd write AND the story behind it (which session, what happened, why you think it's a durable learning). The user needs to judge: "yes, that's how I always work" vs "that was a one-off, don't generalize." Format:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
{N}. {User Name} (`users/{id}/`)
|
|
198
|
+
Corrections:
|
|
199
|
+
• {concrete rule}
|
|
200
|
+
→ {session}: {what happened that taught you this}
|
|
201
|
+
Patterns:
|
|
202
|
+
• {category}: {observation}
|
|
203
|
+
→ {session(s)}: {evidence — what you saw them do}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
A 1-liner like "Populate user context" is useless — show what you'd write and why.
|
|
207
|
+
|
|
208
|
+
**Use numbered lists for all proposed changes** — both in the Slack message and the report file — so the user can reply with numbers to approve specific items.
|
|
209
|
+
|
|
210
|
+
## Phase 5: Apply Approved Changes (only when asked)
|
|
211
|
+
|
|
212
|
+
When the user replies with approvals (e.g. "1,3,5" or "all"), load the specific report file from `data/workspace/reconcile-reports/` and process only the approved items.
|
|
213
|
+
|
|
214
|
+
**Mode check:** Read `selfImprovement` from `data/agent-config.json`. Map proposal types to areas: new skills → `skillCreation`, skill patches → `skillPatching`, user context → `userContext`, knowledge/context → `teamKnowledge`. If the area is `"auto"`, apply without waiting for approval and notify via Slack. If `"approval"` (default), wait for explicit approval numbers.
|
|
215
|
+
|
|
216
|
+
Create a git checkpoint first:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
cd data && git add -A && git commit -m "reconcile: pre-checkpoint $(date +%Y-%m-%d)" --allow-empty
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Apply the approved edits, then commit:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
cd data && git add -A && git commit -m "reconcile: $(date +%Y-%m-%d) — <brief summary>"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
If the user provides feedback or corrections alongside approvals, treat those as learnings — update the relevant workspace files to reflect the correction.
|
|
229
|
+
|
|
230
|
+
## Guidelines
|
|
231
|
+
|
|
232
|
+
- **Report, don't act** — never edit workspace files without explicit approval
|
|
233
|
+
- **Stay lean** — under 30 tool calls; skim don't deep-read
|
|
234
|
+
- **Summaries first** — always check `.summary.md` before touching raw JSONL
|
|
235
|
+
- **Be conservative** — when unsure, flag as "verify?" rather than proposing deletion
|
|
236
|
+
- **Preserve voice** — match the existing tone of workspace files
|
|
237
|
+
- **Don't fabricate** — only propose facts from conversations or existing files
|
|
238
|
+
- **Cite sources** — every proposed change references the session or file it came from
|
|
239
|
+
- **Knowledge hierarchy**: `context.md` is a discovery index (IDs, pointers, 1-liners). `knowledge/*.md` files hold detail. When deduplicating, keep detail in knowledge/ and replace the context.md copy with a pointer (`See knowledge/foo.md`).
|