Skip to content

feat(slack-app phase 4): write tools (create, update, share, soft-delete, child)#29

Merged
TS00 merged 1 commit intodevfrom
feat/slack-writes-phase4
Apr 28, 2026
Merged

feat(slack-app phase 4): write tools (create, update, share, soft-delete, child)#29
TS00 merged 1 commit intodevfrom
feat/slack-writes-phase4

Conversation

@TS00
Copy link
Copy Markdown
Collaborator

@TS00 TS00 commented Apr 28, 2026

Summary

Phase 4 — adds 5 write tools to the Slack agent. The bot can now create, update, share/unshare, reply on, and (carefully) soft-delete memories.

Full design: `docs/eng-plan-slack-app-v1.md`. Parent memory `d959bc61`.

New tools (`src/slack-agent-tools.ts`)

Tool What it does Notes
`write_memory` Create personal memory; `share_with_team=true` flips to shared after creation `origin='slack'` for traceability
`write_child_memory` Reply on an existing parent Inherits team sharing; works on teammates' parents (post-multi-author threading)
`update_memory` Wholesale title/content/tags REPLACE Owner only; refuses cleanly + points at write_child_memory for teammate threads
`share_memory` `share=true | false` toggle "Not on a team" error path; preserves personal copy on unshare
`delete_memory` TWO-CALL CONFIRMATION `confirm=false` (default) returns preview; `confirm=true` soft-deletes (Trash, restorable)

Safety: the destructive-action dance

System prompt explicitly enforces:

  1. First call always with `confirm=false` → returns `{ preview: {title, tags, content_preview}, instruction: "show this + ask 'yes'" }`
  2. Bot shows the preview to the user in Slack and asks for an explicit "yes"
  3. Only after the user types yes (or equivalent affirmative) does the bot call again with `confirm=true`
  4. Soft-delete only — restorable from the Trash view in the dashboard

System prompt updates

New `Writing guidelines` + `Destructive actions` sections in `src/slack-agent.ts`. Calls out: default to personal, use write_child_memory for follow-ups, update_memory is wholesale, match existing tagging conventions (call `get_memory_briefing` if unsure), never delete without confirmation.

Tests (+8, 375/375 total)

  • write_memory creates personal-by-default; rejects empty title/content.
  • write_child_memory creates under a parent.
  • update_memory replaces wholesale; refuses non-owned memories with a clear "not found / use write_child_memory" message.
  • share_memory returns "not on a team" for solo users.
  • delete_memory(confirm=false) returns preview but doesn't delete; delete_memory(confirm=true) soft-deletes (`deleted_at` populated).

Test plan

  • CI green
  • Dev deploy succeeds
  • DM the bot: "make a personal note that says hello world tagged test" → expect a memory in your dashboard, NOT shared with team
  • DM the bot: "write a team note that we shipped Phase 4" → expect a shared memory
  • DM the bot: "what was the last memory I wrote? change its content to say 'updated by slack'" → expect search → update → confirmation
  • DM the bot: "delete the note about hello world" → expect a preview reply asking for "yes" → reply yes → expect actual deletion + restorable from Trash

Made with Cursor

…ete, child)

Adds 5 write tools to the Slack agent. Bot can now actually create,
update, share/unshare, reply on, and (carefully) delete memories.

New tools in src/slack-agent-tools.ts:
- write_memory: create personal memory by default; share_with_team=true
  flips it to shared after creation. origin='slack' for traceability.
- write_child_memory: reply on an existing parent. Inherits team
  sharing. Wraps createChildMemory which (post earlier session work)
  allows replies on team-visible parents authored by anyone.
- update_memory: wholesale title/content/tags REPLACE on the user's
  own memory only. Refuses cleanly when caller doesn't own the row,
  pointing them at write_child_memory for teammate threads.
- share_memory: share=true | share=false; "not on a team" error path
  for solo users; preserves the personal copy on unshare.
- delete_memory: TWO-CALL CONFIRMATION pattern — confirm=false (default)
  returns a preview {id, title, tags, content_preview} + an instruction
  to show the user and ask 'reply yes'; only confirm=true actually
  soft-deletes (moved to Trash, restorable from the dashboard). The
  system prompt explicitly enforces this dance.

System prompt (src/slack-agent.ts) extended with a Writing Guidelines
section + a Destructive Actions section. Calls out:
- Default to personal memories; share with team only when explicitly
  asked.
- Use write_child_memory for follow-ups; never update_memory on a
  teammate's memory.
- update_memory is wholesale — pass complete new values, not a diff.
- Match user's existing tagging conventions (call get_memory_briefing
  if unsure).
- Never delete without showing the preview and getting an explicit
  'yes' in chat first.

Tests (+8, 367 -> 375 total):
- write_memory creates personal-by-default; rejects empty title/content.
- write_child_memory creates under a parent.
- update_memory replaces wholesale; refuses non-owned memories with a
  clear 'not found / use write_child_memory' message.
- share_memory returns the 'not on a team' note for solo users.
- delete_memory(confirm=false) returns the preview but doesn't delete;
  delete_memory(confirm=true) soft-deletes (deleted_at populated).

Refs: parent memory d959bc61.
Made-with: Cursor
@TS00 TS00 merged commit b60b43e into dev Apr 28, 2026
4 checks passed
@TS00 TS00 deleted the feat/slack-writes-phase4 branch April 28, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant