Skip to content

Department notebook: each department remembers what it learned - #248

Merged
TruongGiang2000 merged 7 commits into
mainfrom
feat/dept-notebook
Oct 9, 2026
Merged

TruongGiang2000 merged 7 commits into
mainfrom
feat/dept-notebook

Conversation

@TruongGiang2000

Copy link
Copy Markdown
Collaborator

Stacked on #247. Merge that first; this PR's base will then move to main.

What

Each department now remembers what it learned. company.decisions already was the company's notebook: remember_fact, approval extraction, room lock-in, and the Memory panel. It just didn't know which department a fact belonged to.

  • DecisionEntry.dept (nil means company-wide). Identity stays scope|topic, so there is one truth per topic: when Sales re-records the price, it replaces Finance's and takes the tag. The cap goes from 30 to 60 because eight departments now share it (~42 KB of the 1 MiB doc).
  • Stamped at the writers, Swift only, with no backend change:
    • chat remember_fact uses the turn's deptKey, the same one sent on the request;
    • approval extraction uses the deliverable's department, which was already resolved for the prompt and then dropped;
    • room lock-in stays company-wide.
  • The desk (from Ask a department, get that department: room role prompt + its own desk #247) lists <Dept> has noted:, which is up to 8 of the department's own decisions, newest first. It carries the same "never contradict" instruction as the decisions block, and those entries aren't repeated there. With memory off, neither block is composed.
  • Memory panel: each row reads runway · Finance · Codepet.

Spec: docs/superpowers/specs/2026-10-09-department-notebook-design.md · Plan: docs/superpowers/plans/2026-10-09-department-notebook.md

Verified

  • New tests, each watched red first:
    • DepartmentNotebookTests: the department is stamped, carried through normalize, and re-tagged when another department re-records; old docs without dept round-trip unchanged; the cap is 60.
    • The chat turn stamps its department, and an ordinary turn leaves it nil.
    • Approval stamps the deliverable's department.
    • The desk shows only its own notes, newest first and capped, never repeats them, and shows nothing with memory off.
  • Two fixes came out of a fresh whole-branch review, each with a test that failed first:
    • desk notes had lost the "never contradict" line;
    • excluding notes by identity could drop a second entry on the same topic from the prompt.
  • Suites passed: Decisions ×3, ChatContext ×7, CompanyStoreChatTests, CompanyStoreRunTaskTests, ApprovalParityTests, CompanyStoreChatRunTests, VirtualCompanyDecisionTests, MemoryToggleTests. The one host restart is the known 26.2 isolated-deinit crash.
  • Not yet checked in the running app. The machine was in use, so I didn't drive it. Steps:
    1. Type "Ask Finance: our runway is 8 months." Expect a Noted chip.
    2. Press + New, then "Ask Finance: how long is our runway?" Expect 8 months.
    3. Open Settings → Memory. The row should read runway · Finance.

Deferred

  • The cap of 60 doubles the decisions text sent on every chat and extraction call. This hasn't been measured.
  • Small test gaps:
    • the ordinary-turn test doesn't send a department turn first;
    • no test covers a nil re-record clearing the tag;
    • no desk-level test checks that Finance's desk empties once Sales re-records.

🤖 Generated with Claude Code

TruongGiang2000 and others added 7 commits October 9, 2026 10:40
…arned them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DecisionEntry.dept (nil = company-wide), stamped through normalize and
merge. Identity stays scope|topic: one truth per topic, so a department
re-recording another's topic replaces it and takes the tag. Cap 30 -> 60
now that eight departments share the store (~42 KB of 1 MiB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
remember_fact stamps the turn's deptKey (the one the request was sent
with, threaded through handleDoneAction, never re-derived); approval
extraction stamps the deliverable's department, which it already resolved
for the prompt and then dropped. Room lock-in stays company-wide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to 8 decisions tagged with the department, newest first, under
'<Dept> has noted:'. They leave the general decisions block so none is
said twice; older ones stay there rather than vanish. Memory off composes
neither. The desk reads only the applicable decisions compose is handed,
so another project's note cannot reach it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…entity

Review findings on the notebook branch:
- Moving a department's own notes to its desk took them out from under the
  decisions block's 'never contradict' line, so the one fact Finance was
  not told to stand by was Finance's own. The desk now carries it.
- Excluding desk notes by identity also hid a second entry with the same
  identity (assignDecision can create one) from the prompt entirely. The
  exclusion now matches the entries themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TruongGiang2000

Copy link
Copy Markdown
Collaborator Author

Checked in the running app at fe781d8 on a real account:

  1. "Ask Finance: for the record, our runway is 8 months at current burn." → Crash · Finance replied, and the Noted chip read runway — Runway is 8 months at current burn (as of 2026-10-09).
  2. + New → "Ask Finance: how long is our runway?" → "Eight months, as of today — that's the one figure Finance has on record." It still said cash and burn are not on record.
  3. Settings → Memory: the row reads runway · Finance · codepet. I deleted the test fact afterwards.

Side observation, not from this PR: the reply put the 8-month deadline at "June 2026", which should be ~June 2027. The model seems not to know today's date in Ask.

@TruongGiang2000
TruongGiang2000 changed the base branch from feat/dept-ask-expertise to main October 9, 2026 04:06
@TruongGiang2000
TruongGiang2000 merged commit ebc9212 into main Oct 9, 2026
2 checks passed
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