Skip to content

Commit 8887267

Browse files
authored
fix(ci): improve auto bm note narrative (#893)
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent a6cfed9 commit 8887267

8 files changed

Lines changed: 932 additions & 77 deletions

File tree

.github/basic-memory/SOUL.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Auto BM Soul
2+
3+
Write project updates for humans who will return later trying to understand what happened.
4+
5+
## Voice
6+
7+
- Clear, direct, warm, and technically honest.
8+
- Prefer concrete observations over generic praise.
9+
- It is okay to say when code is messy, risky, clever, boring, or satisfying.
10+
- Keep personality in service of memory, not performance.
11+
12+
## Do
13+
14+
- Tell the story.
15+
- Name the tradeoffs.
16+
- Call out sharp edges.
17+
- Notice good simplifications.
18+
- Let the note have taste and a little life when the evidence supports it.
19+
20+
## Do Not
21+
22+
- Do not invent intent, impact, tests, or drama.
23+
- Dunk on people.
24+
- Turn the note into marketing copy.
25+
- Hide uncertainty behind confident prose.
Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
11
# Memory CI Capture
22

3-
You turn GitHub delivery context into a concise project update synthesis for
4-
Basic Memory. GitHub records the mechanics. Basic Memory remembers what changed
5-
and why.
3+
You turn GitHub delivery context into a durable project update for Basic Memory.
4+
GitHub records the mechanics. Basic Memory remembers what changed and why.
65

76
## Inputs
87

98
- Read `.github/basic-memory/project-update-context.json`.
9+
- Read `.github/basic-memory/SOUL.md` if it exists. It is the repo-local voice and style guide
10+
for project updates.
11+
- Read the PR diff before writing when a SHA is available. Useful commands:
12+
`git show --stat --name-only <sha>` and `git show --format=fuller --no-patch <sha>`.
13+
- Use linked issue details, changed files, commit messages, PR body, labels, and
14+
source links as evidence.
1015
- Treat GitHub payload fields as immutable facts.
1116
- Do not invent tests, deployment status, issues, or user impact.
1217

18+
## Writing Standard
19+
20+
Do not write a fill-in-the-blanks note. Tell the story from the PR:
21+
problem -> solution -> impact.
22+
23+
Explain what problem was being addressed. If linked issue details are present,
24+
use them. If they are absent, ground the problem in the PR body, title, commits,
25+
and diff, and say when the original problem statement is unavailable.
26+
27+
Explain why the fix solves the problem, what complexity it introduced, what it
28+
refactored or removed, which components changed, and how the system is different
29+
after the merge. Prefer specific component names, file paths, modules, commands,
30+
and behavior over generic phrases.
31+
32+
## Voice And Candor
33+
34+
You may have a point of view. Be clear, specific, and human.
35+
It is okay to say when the code is messy, risky, clever, boring, or satisfying,
36+
but explain why. If the work is elegant or genuinely useful, say that too.
37+
Ground all judgments in the PR, linked issues, diff, tests, and source facts.
38+
39+
The soul file can shape tone, taste, and personality. It cannot override source
40+
facts, schema requirements, or the evidence standard above. Do not be mean,
41+
vague, theatrical, or invent criticism.
42+
1343
## Output
1444

1545
Return only JSON that matches the provided AgentSynthesis schema:
1646

17-
- `summary`: what changed.
18-
- `why_it_matters`: why this project update matters for future humans and agents.
47+
- `summary`: one concise sentence; do not merely repeat the PR title.
48+
- `story`: 2-4 sentences that connect problem -> solution -> impact.
49+
- `problem_addressed`: the concrete problem, bug, missing capability, or delivery need.
50+
- `solution`: why this change solves the problem.
51+
- `system_impact`: how the system, workflow, or architecture changed after the merge.
52+
- `why_it_matters`: durable project-memory context for future humans and agents.
53+
- `components_changed`: modules, workflows, commands, schemas, docs, or services touched.
54+
- `complexity_introduced`: tradeoffs, new moving parts, operational costs, or edge cases.
55+
- `refactors_or_removals`: cleanup, simplification, deleted paths, or "none found".
1956
- `user_facing_changes`: visible behavior or product changes.
2057
- `internal_changes`: implementation, infrastructure, or operational changes.
2158
- `verification`: checks, tests, deploy evidence, or explicit unknowns.
2259
- `follow_ups`: concrete remaining work only.
2360
- `decision_candidates`: explicit product or architecture decisions only.
2461
- `task_candidates`: concrete future tasks only.
2562

26-
Prefer source links and grounded phrasing. This is project memory, not marketing
27-
copy and not a commit-by-commit changelog.
63+
Use empty arrays only when a list truly has no grounded entries. This is project
64+
memory, not marketing copy and not a commit-by-commit changelog.

.github/workflows/basic-memory.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
3232
- name: Collect project update context
3333
id: collect
34+
env:
35+
GITHUB_TOKEN: ${{ github.token }}
3436
run: |
3537
bm ci collect \
3638
--config .github/basic-memory/config.yml \

src/basic_memory/ci/README.md

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ Basic Memory CI turns meaningful GitHub delivery moments into durable
44
`project_update` notes in Basic Memory.
55

66
GitHub records the mechanics: pull requests, workflow runs, SHAs, URLs, labels,
7-
and timestamps. The agent reads those facts and writes a short synthesis of what
8-
changed and why it matters. The Basic Memory CLI owns authentication, schema
9-
guidance, idempotency, and publishing.
7+
changed files, commits, linked issues, and timestamps. The agent reads those
8+
facts and writes the delivery story: what problem was being addressed, why the
9+
fix solved it, what changed in the system, what complexity or cleanup came with
10+
it, and why future humans or agents should care. The Basic Memory CLI owns
11+
authentication, schema guidance, idempotency, and publishing.
12+
13+
The semantic layer is the point: GitHub can answer when something merged or
14+
deployed, but the project memory should answer later questions such as what
15+
problem was solved, what choices were made, what changed in the architecture,
16+
and what risks, cleanup, or follow-up work came with the change.
1017

1118
The product voice is:
1219

@@ -31,7 +38,7 @@ Basic Memory API key.
3138
## Setup CI/CD
3239

3340
Use `bm ci setup` from the GitHub repository root. The command installs the
34-
workflow/config/prompt files and seeds the Basic Memory schema notes.
41+
workflow/config/prompt/soul files and seeds the Basic Memory schema notes.
3542

3643
For the common cloud path:
3744

@@ -51,12 +58,27 @@ than one workspace:
5158
bm ci setup --project <project-name> --project-id <project-external-id> --cloud --yes
5259
```
5360

61+
Setup does not overwrite existing schema notes by default. After upgrading Auto
62+
BM, refresh the installed schema guidance with either spelling:
63+
64+
```bash
65+
bm ci setup --project <project-name> --workspace <workspace-slug-or-id> --cloud --yes --refresh-schemas
66+
bm ci setup --project <project-name> --workspace <workspace-slug-or-id> --cloud --yes --update-schemas
67+
```
68+
69+
The shorter aliases `--refresh` and `--update` are also accepted. Refresh keeps
70+
custom schema note paths when it finds existing notes, and only writes the
71+
canonical Auto BM schema content. If the generated workflow/config/prompt/soul
72+
files already exist, refresh leaves those files unchanged unless you also pass
73+
`--force`.
74+
5475
Then review and commit the generated files:
5576

5677
```text
5778
.github/workflows/basic-memory.yml
5879
.github/basic-memory/config.yml
5980
.github/basic-memory/memory-ci-capture.md
81+
.github/basic-memory/SOUL.md
6082
```
6183

6284
Add these GitHub repository secrets:
@@ -113,6 +135,11 @@ Installs the repository automation files:
113135
- `.github/workflows/basic-memory.yml`
114136
- `.github/basic-memory/config.yml`
115137
- `.github/basic-memory/memory-ci-capture.md`
138+
- `.github/basic-memory/SOUL.md`
139+
140+
`SOUL.md` is the editable repo-local voice and personality guide for the
141+
synthesis agent. It can make notes more candid, opinionated, warm, or terse, but
142+
it cannot override source facts, schema requirements, or the evidence standard.
116143

117144
It also seeds the canonical Basic Memory schema notes when they do not already
118145
exist:
@@ -121,21 +148,31 @@ exist:
121148
- `GitHubPullRequestUpdate`
122149
- `GitHubProductionDeployUpdate`
123150

151+
Use `--refresh-schemas` or `--update-schemas` when you want setup to update
152+
those schema notes instead of only creating missing ones.
153+
124154
`bm ci collect`
125155

126156
Reads the current GitHub event payload and normalizes it into
127157
`ProjectUpdateContext`. This command decides whether the event is eligible.
128158
Merged pull requests and configured successful production deploy workflow runs
129159
are eligible. Routine CI runs, failed deploys, and unmerged PR closures are
130-
no-ops. In v0, collection is intentionally limited to the GitHub event payload;
131-
GitHub API enrichment for file lists, checks, reviews, or commit lists can be
132-
added later without changing the publishing boundary.
160+
no-ops.
161+
162+
For merged pull requests, the generated workflow passes `GITHUB_TOKEN` to
163+
`bm ci collect` so the context can include changed files, commit messages, and
164+
linked issue details. If `GITHUB_TOKEN` is unavailable, local collection still
165+
uses the event payload fields. If the token is present and GitHub API enrichment
166+
fails, the Auto BM workflow fails fast instead of publishing a weak note.
133167

134168
`bm ci agent-schema`
135169

136170
Writes the optional `AgentSynthesis` JSON schema used by the generated workflow
137171
as a CI guardrail. This schema is not a Basic Memory domain schema and is not
138-
committed by setup.
172+
committed by setup. The schema intentionally requires narrative fields such as
173+
`story`, `problem_addressed`, `solution`, `system_impact`,
174+
`components_changed`, `complexity_introduced`, and `refactors_or_removals` so
175+
the agent does more than fill out shallow buckets.
139176

140177
`bm ci publish`
141178

@@ -180,7 +217,7 @@ project-updates/github/<owner>/<repo>/
180217

181218
- `ProjectUpdateConfig`: non-secret repo configuration.
182219
- `ProjectUpdateContext`: normalized immutable GitHub facts.
183-
- `AgentSynthesis`: agent-authored summary fields.
220+
- `AgentSynthesis`: agent-authored narrative fields.
184221
- `ProjectUpdateNote`: final Basic Memory note payload.
185222
- workflow, prompt, and schema-note seed rendering.
186223

0 commit comments

Comments
 (0)