Commit Graph
71 Commits
Author SHA1 Message Date
LouisandClaude a7f2b34b75 Fix the Mac build (Mochi sheet), and PR Triage sorts by lots of 40 (#1298)
- Mac: the Mochi sheet's body grew past what the compiler type-checks in time ("unable to
  type-check this expression"): the success rate and the "what it got done" row are now their
  own pieces.
- PR Triage: 80 PRs in one call took Claude past its 6 minutes (spawnSync ETIMEDOUT). It now
  sorts by lots of 40 (10 minutes each at most); Claude gives a box, a score and a line for each
  PR, and the report is written from all the lots: the best first (weekly: the best and the
  weakest), then needs work, duplicates and against the rules, can wait, worth noting. A lot that
  fails comes back next run. brain 0.15.6.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 21:48:19 +00:00
LouisandClaude 62bde92a94 Botan's conversations on the iPhone, and what each Mochi got done (#1297)
- iPhone: a Conversations button in Botan's chat lists Botan, each team (as its lead) and each
  Mochi on its own, like a messaging app: the start of what it last did, when, a red mark if it
  failed, and a badge for what waits for a tap (a lead counts its team's). A tap opens the thread.
- Mac: a Mochi's sheet shows what it got done over 30 days: PRs opened and merged since (checked
  once with gh, then kept), reviews and replies posted, PRs closed, and the time saved (an
  estimate). brain `mochi stats <id>`, 0.15.5.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 21:32:08 +00:00
LouisandClaude f119d8dbb4 PR Triage: no more GitHub 502 on the queue (#1294)
Asked for 500 open PRs with their body, mergeable state and review in one GraphQL query, GitHub
answered 502 Bad Gateway. The queue is now read light (numbers, titles, sizes), then each PR of
the batch with `gh pr view` (body, mergeable, review, and weekly its files); a 502 or a timeout
on the queue is tried again once. brain 0.15.4.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 21:27:01 +00:00
LouisandClaude a910ff5a7e PR Triage once a week: every PR of the week before, ranked best to weakest (#1290)
On a weekly schedule (the ready-made one's default is now Monday 07:30), PR Triage sorts every
PR opened in the 7 days before (150 at most), sorted before or not; it notes, for each, the files
it changes that the default branch no longer has (the code moved since), and its report starts
with "The best" and "The weakest". On a daily schedule it works as before. brain 0.15.3.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 20:49:48 +00:00
LouisandClaude 7a54c7a72f Teams speak with one voice: the lead reports, its Mochis stay quiet (#1282)
- In a team whose lead is on, only the lead writes: no notch card, no iPhone notification, no
  Telegram or WhatsApp message from its Mochis. What went wrong for them since its last report
  is in its report ("What went wrong"), and it answers for them (Mac, Telegram, WhatsApp, iPhone).
- The bell on the lead's card picks where the team's report goes (notch, iPhone, Telegram,
  WhatsApp) without turning anyone off.
- The iPhone doesn't ring for what Telegram or WhatsApp already got.
- Botan's chat on the iPhone shows a team as its lead: its Mochis' pills are gone (still
  reachable with @).
- Messages say the team: "PR Triage · coucou had a problem".
- brain 0.15.2.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 20:08:21 +00:00
LouisandClaude 8adf0197a3 Teams: fold them, the lead wears the team's colour, turning it on wakes the team (#1281)
- A team folds on the Team page (the chevron by its name): its title and its Mochis' faces,
  remembered between launches.
- The lead takes the team's colour when it's made, and again when the team's colour changes
  (`team lead|set --color`).
- Turning a lead on turns its whole team on; each Mochi can be turned off again on its own.
- brain 0.15.1.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 19:49:48 +00:00
LouisandClaude f44300a470 Mochi teams with a lead: the Team page by project, who leads whom (#1278)
- The Team page groups the Mochis by team (tiles and list): each team under its title and
  repositories, its lead's card on top, the Mochis it sends below a line in the team's colour.
- A team is made or changed in one sheet (name, colour, its Mochis, a lead at its time);
  right-click a Mochi › Move to team; a team's menu edits, adds a lead or ungroups it.
- The Team Lead (brain `team-lead`, `lead: true`): at each run it reads what its Mochis did,
  what waits for a click and the team's repositories (PRs, issues, CI), sends up to 4 Mochis
  with a precise ask (a PR or an issue for code Mochis), and writes one report. It only sends
  Mochis that are on, awake, local and within budget; nothing is merged, closed or posted
  without the click. The page's mission goes through the team's lead (`team plan|run --team`).
- Telegram and WhatsApp: a Mochi sent by its lead only writes when something waits for a tap.
- Fix: pausing a Mochi (or changing its channels) no longer resets its time to "on demand".
- brain 0.15.0: `brain team set`, `brain team lead`; leads are shared in .mochis.json files.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 18:56:05 +00:00
LouisandClaude de2eef8438 PR Triage: a Mochi that sorts the whole PR queue every morning (#1277)
A ready-made Mochi (on: pr-queue, daily 07:30) for repositories that get more
pull requests than one can read. brain reads the open queue with gh, sorts
the new ones and a slice of the backlog against the repository's CLAUDE.md
and every title (to find duplicates): ready, needs work, duplicate or against
the rules, can wait. What it would close is one "close" proposal (15 at
most, each with its own comment), closed only on the click, never on its
own. It never merges and stays on the Mac.
brain 0.14.0.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 18:36:41 +00:00
LouisandClaude Opus 5.5 5434c4a27d Mochis: WhatsApp, where each reports, a new time or a pause in a sentence, the team from the iPhone (#1275)
* Mochis: WhatsApp, where each reports, another time or a pause in a sentence, the team from the iPhone

- WhatsApp (22): the Mochis' chat also works in your own WhatsApp chat,
  through Coucou's WhatsApp integration: /start <code> pairs it, only what
  you write from your account there is read, choices come numbered, Coucou's
  own messages are never read back.
- Where it reports (23): notch, iPhone, Telegram, WhatsApp, per Mochi (brain
  `quiet`); the Telegram page's switches use it.
- Sentences: "passe à 2 h", "every day at 7:30", "pause cette semaine",
  "pause until monday" change a Mochi from Telegram, WhatsApp, Botan on the
  iPhone and "@Name …" in the notch's chat (brain `mochi schedule`, `mochi
  snooze`: asleep until a date, a click still runs it).
- The team lead from the iPhone: /team <mission> in Botan's chat, the plan
  shows above the field, Run the team on a tap; how it went comes back.
- The notch's chat: "@Night Shift …" goes to that Mochi (MochiTalk).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

* Mochis on WhatsApp: the welcome says your name; explicit self in its tasks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 17:55:28 +00:00
LouisandClaude 2a4ae37d33 Mochis: a live status board, a hat and a face accessory, and their tools (#1274)
- Status board (14): a fourth view, Asleep / At work / Waiting for your OK /
  Done today. Each Mochi slides to the column of what it does now; the page
  reads them again every 6 seconds while the board shows.
- Outfit composer (34): a hat and a face accessory (glasses, monocle, scarf,
  bow), kept as "captainHat+sunglasses", drawn in code on the Mochis page,
  in the notch's finished card and (the hat) on the iPhone.
- Its tools (30): GitHub, Stripe, Vercel, Resend, Cal.com, n8n, Notion,
  Crypto and Mail can be given to a Mochi. Coucou writes what it already shows
  of the services some Mochi was given to one file on this Mac (no key), and
  brain adds it to that Mochi's instructions at each run.
brain: services field, read from the summary when it is less than a day old.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 17:23:59 +00:00
LouisandClaude b7366038dc Mochis: teams, a notebook of what they learn, export and import (#1273)
- Teams (10): a Mochi joins a team (Code, Quality, Release, Watch, Memory or
  your own, with its colour). The pills sort them by team; tiles and sheets
  show it; ready-made Mochis join theirs.
- Its own memory (32): "Learns from its runs" keeps a notebook. After a run
  it writes one "To remember:" line, kept out of its result, read again next
  time. The sheet lists it, one line or all can be forgotten.
- Sharing (33): export a Mochi or its whole team to a .mochis.json file (no
  repository path, no key), import one from a file or a GitHub link, with a
  preview. Imported Mochis arrive off, never autonomous, code Mochis on the
  repository picked.
- Telegram answers lose their markdown marks.
brain 0.13.0: team and learns fields, `mochi notes`, `mochi export`,
`mochi import`.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 17:05:00 +00:00
LouisandClaude 85cb93526c Mochis: a team lead for missions, and Mochis that wake after another (#1268)
Team lead, at the top of the team: a mission in a sentence, Claude picks
which Mochis do it and in what order (brain team plan), the plan shows
with each one's reason and can be trimmed, and on a click they run one
after the other, each reading the mission and what the ones before wrote
(brain team run). Each step shows working, done or failed, and opens its
result.

A new wake-up, "After another Mochi": when the Mochi it follows ends a
run well, it starts with what that one wrote. A Mochi runs once per
chain, so no loop; chains stay on the Mac (not in the Cloud). The
creator offers it, with the Mochi to follow.

brain 0.11.0: team plan, team run, on: after (+ tests).


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 14:08:25 +00:00
LouisandClaude 9ec65bf7c3 Mochis: group by place, filters and search, pin and order, Hire gallery, ideas from memory, duplicate, personality, tagline (#1261)
- Group the team by what wakes them or by where they run (this Mac, Cloud, paused)
- Search and filter pills (on, Cloud, one repository) when there are more than 3
- Pin a Mochi to the top, move it up or down (right-click)
- The ready-made gallery becomes Hire a Mochi: job offers grouped by wake-up, with their hours
- The creator suggests Mochis from tasks Memory saw you redo
- Duplicate a Mochi (opens the copy in the editor)
- Personality: tone, length, language, written into its prompt (brain)
- Tagline under the title: agents that wake up on their own


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 02:56:36 +00:00
LouisandClaude f6a156b68e Mochis: team grouped by what wakes them, Mochi sheet, create your own in 4 steps (#1258)
The Team page:
- what waits for your click comes first, from every Mochi
- the Mochis are grouped by what wakes them up (a time, GitHub, a mail,
  a watch, a click), as tiles, as the list, or as today's timeline
- a click on a Mochi opens its sheet: next wake, runs and success over
  30 days, API value, and its log, each result opening in place

New Mochi opens a creator in 4 steps (job, what wakes it, what it may
do, its look), the Mochi taking shape on the left. Its job can be
described in one sentence: Claude writes the name, instructions, wake-up
and outfit (brain mochi draft). A dry run shows what it would write
before it's created (brain mochi try): nothing saved or posted, a code
Mochi only reads in a copy.

brain 0.10.0: mochi draft, mochi try, today's runs in mochi list.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 02:01:23 +00:00
LouisandClaude 3a7eaba620 Coucou Cloud: every ready-made Mochi but the Memory Gardener (#1248)
The Cloud ran only PR Reviewer. It now runs what each Mochi needs:
- GitHub events: new PR (PR Reviewer), new issue (Issue Triage), an issue
  labelled for an unscheduled Night Shift, a failed run on the default
  branch (CI Fixer, its failed logs in the prompt);
- schedules in the user's time zone, once per slot (Night Shift takes the
  oldest labelled issue it hasn't worked on, Deps & Security, Ship Log from
  the week's commits);
- a click on the Mac (POST /v1/mochis/:id/run: Release Prep, or any of them now);
- Prod Watch every 15 minutes, no AI, a run only when an address changes.

A Mochi that changes files is asked, once its report is written, to run a
pack script mounted in the sandbox: the changed files go to the session's
outputs and the Worker keeps them until the click, which makes the draft PR
with GitHub's API (blobs, tree, commit, a mochi/ branch, the PR). Nothing is
pushed from the sandbox, which keeps read-only tokens; each GitHub token asks
only what its step needs. Issue Triage's reply is posted on the issue.

Mac: brain 0.9.1 sends kind, tools, schedule, label, addresses, runs a day
and the time zone; a Cloud Mochi no longer runs on the Mac's schedule, Run
now goes to the Cloud, turning one on or off reaches the Cloud, and Cloud
runs keep their link and what started them. The Cloud page lists Prod Watch
and says why a Mochi stays on the Mac.


Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-01 15:22:48 +00:00
Claude 5293c0ded0 Coucou Cloud: Stripe and the offers
The Cloud is now sold: Free (everything on the Mac, unchanged) and
« Cloud · your key » at 9 €/month (the AI on the user's own Anthropic key).
Solo, Pro and Max are listed as coming, until the credit offers open.

Worker (billing.ts): the offers in one place (GET /v1/plans, public, so a
price changes without an app update); Stripe Checkout and the customer
portal, opened in the browser (the card never touches Coucou); the signed
Stripe webhook keeps the subscription's state; a user's Mochis run in the
Cloud only with an active subscription (past_due included while Stripe
retries) or a login in COMP_LOGINS (Louis-CFM). Without STRIPE_SECRET_KEY,
billing is off. Under the VAT franchise: no VAT, the invoice footer says
« TVA non applicable, article 293 B du CGI »; STRIPE_TAX turns Stripe Tax on.
The new user columns are added by the Worker itself.
scripts/stripe-setup.mjs makes the price, the portal and the webhook, and
pipes the webhook's secret straight into wrangler.

brain: `cloud subscribe`, `cloud billing` (--json gives the URL to the app);
`cloud status` carries the offer and the offers.

App: the offers view (CloudPlans.swift, for the onboarding too), a
« Choose your offer » step in the Cloud setup, the offer on the account
card (renews / ends / payment failed, Manage, See the offers); the switch
to move a Mochi needs the offer. 28 strings in the 16 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 16:47:31 +00:00
Claude 31da031dbd Mochis: the Autonomous level; Cloud page: Mochis as tiles
A repo Mochi can now be Autonomous (editor › What it may do): it does what
is safe and can be undone on its own — opens the draft PR, posts the review
as a comment, replies on the issue — and tells you after. It never merges,
pushes to main, approves or sends a mail; a mail Mochi only drafts and only
a repo Mochi can be autonomous.

- brain: level "autonome"; runMochi posts with the user's git and gh right
  away and records it on the run (auto: applied + url, or failed + error).
  A post GitHub refuses waits for the click instead. A Cloud Mochi's level
  goes to the Cloud when it is saved.
- Worker: mochis.autonomous and runs.auto; when a run is collected, an
  autonomous Mochi's review is posted at once. The columns are added to the
  existing database by the Worker itself, no command to run.
- Notch: "PR Reviewer posted its review on PR #12" with Open, nothing to
  click. Results: "Posted its review on PR #12 on its own" with Open.
- Cloud page: the Mochis as small tiles (a switch each, Soon for the others,
  the level shown); the refresh button is gone, the page refreshes itself
  every minute while open; a run posted on its own says so, with Open.

12 new strings in the 16 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 14:21:16 +00:00
Claude 4b67c9be89 Mochis › Cloud: the Cloud page in the app
A new page in the Mochis section of the Hub for Coucou Cloud:
- the setup in three steps: sign in with GitHub (device code shown in
  the app), the Anthropic key (Coucou's own or pasted, sent to brain on
  stdin, never in the arguments), the GitHub app on the repositories;
- then where it stands: the account and the Cloud's health, this month's
  runs, cost and what waits for a click, the repo Mochis with a switch
  to move them to the Cloud ("Soon" for those it can't run yet), and the
  latest runs with Read and Post review.
- a small cloud badge on Cloud Mochis in Team, on their results, and on
  the notch card.

brain: `cloud status`, `login-start` / `login-finish`, `key --stdin`,
and --json on add, remove and pull; login takes its defaults from
brain.config.json (cloudUrl, cloudClientId, cloudInstallUrl).
Worker: GET /v1/me (login, key set, installations, Cloud Mochis).
51 new strings in the 16 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 03:00:56 +00:00
Claude 89020d7335 cloud: only your installation runs your Mochis; narrow GitHub tokens
Found while checking the Cloud's security: anyone could sign in, name
someone else's repository in a Cloud Mochi, and that Mochi would run on
the owner's pull_request events. On a private repository its session
would get a clone token, so its instructions could read the code.

- A pull_request event only starts the Mochis of the user who installed
  the app where the event comes from (installations.id = the event's).
- PUT /v1/mochis refuses repositories whose owner has no installation
  of this user, and says which; brain cloud add says so and the Mac keeps
  watching.
- The Worker reads the PR with a token limited to that repository,
  pull_requests and contents read; the sandbox clones (private only) with
  a token limited to that repository, contents read. Neither can post or
  push; posting still needs the click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 02:25:12 +00:00
Claude 2b69973c61 brain: the Cloud's runs in the notch, like the Mac's own
brain mochi due (launchd, every 15 minutes) now brings the Cloud's
finished runs to the Mac once signed in (also: brain cloud pull). Each is
written where the Mac's own runs are: a line in the Mochi's runs.jsonl
(trigger github, the PR, the proposal, the cost, `cloud: <run id>`) and
its Markdown result. So the app needs no change: the notch announces it,
Results lists it, Read opens it, and Post the review / Discard call
brain mochi apply / discard, which see `cloud` and go through the Cloud
(posted as the Coucou Cloud app). A click made elsewhere (brain cloud
post or discard) reaches the Mac at the next pull.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 02:21:06 +00:00
Claude 64b37d85b5 brain: say the language of what is posted, worked out from the PR itself
The Cloud's review of #1198 (an English PR in an English repo) came out
in French: the rule asked the model to pick the PR's language, but
everything it got was in French and it answered in French. The language
is now worked out from the PR's or issue's title and description (the
common words of en, fr, es, pt, de; code and links left out; nothing
when there is too little text) and said in the last section of the
prompt: "the review, titles included, is written in English".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 02:13:41 +00:00
Claude e5906b512d brain: brain cloud login, key, add, remove, runs, post, discard
The Mac's side of Coucou Cloud, as commands first:
- login: the Coucou Cloud GitHub App's device flow (a code to type on
  github.com), then the Cloud swaps the GitHub token for its own; the
  Cloud token goes to the Keychain ("Coucou Cloud") through security -i,
  never argv, never disk. Only the address and client id are on disk.
- key: hands the Cloud the Anthropic key from brain mochi key.
- add/remove: a `cloud: true` line in the Mochi's file, and the whole
  list of Cloud Mochis sent to the Cloud. While it's there, runDue no
  longer polls GitHub for it, so a PR is never reviewed twice. Only PR
  Mochis for now; if the Cloud says no, the flag is put back.
- runs/post/discard: the Cloud's runs, and the click.

saveMochi keeps the cloud flag when the app saves a Mochi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 01:51:34 +00:00
Claude 5a3dce5121 cloud: the Coucou Cloud engine, V0 (your own Anthropic key)
A Cloudflare Worker (cloud/) that runs the PR Reviewer while the Mac is
off: a GitHub App webhook for pull_request starts a Claude Managed Agents
session on the subscriber's own Anthropic key, on the PR's head commit,
with the diff in the prompt and a spend ceiling; a cron collects the
finished sessions every minute; the review waits until the click posts
it as a comment. D1 keeps the GitHub id and login, the hash of the Mac's
token, the Anthropic key sealed with AES-GCM, the Cloud Mochis and each
run's result. Never the code.

The prompt and the Managed Agents requests move to two modules with no
Node API, shared by the brain and the Worker: brain/src/prompt-core.ts
(buildRepoPrompt, languageRule, repoSystem) and brain/src/cloud-core.ts
(the client, the diff, agent/environment/session params, summarize,
looksLikeReport, withoutNotes). brain cloud try now uses them too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 01:47:49 +00:00
Claude 91b5a6db4b brain: a review is written in the PR's language, not its files'
The Cloud review of PR #1188 (pt-BR strings, described in English)
came out in Portuguese: the language rule said "the PR's language",
which it read as the language of the changed files. It now says the
title and description decide, and that the files' language never does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 01:40:03 +00:00
Louis 50b2f4636a Merge pull request #1193 from Louis-CFM/cloud/cma-prototype
brain: Coucou Cloud prototype, a repo Mochi on Claude Managed Agents
2026-11-30 02:31:35 +01:00
Claude 3c01225224 brain: Coucou Cloud prototype, a repo Mochi on Claude Managed Agents
`brain cloud try <mochi> --pr <n>` runs a repo Mochi once on Managed
Agents with the Keychain API key, and posts nothing:

- one agent per Mochi/model/system prompt (claude-sonnet-5-5 for
  "sonnet"), tools always allowed, web search and fetch off; one cloud
  environment with package registries and GitHub only; both made once
  and remembered in .state/cloud/ids.json
- the session clones the repo on the PR's head commit, gets the same
  prompt as on the Mac with the diff from GitHub (generated files left
  out), and a spend ceiling ($1 by default)
- polls until idle (25 min at most, then interrupts), prints the last
  message, the list cost, model calls, active minutes and tools used,
  saves it under .state/cloud/runs/, archives the session

No SDK: a few fetch calls with the managed-agents-2026-04-01 beta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 01:30:59 +00:00
Claude 28fec7e88b brain: cap a review at 25 turns and 20 minutes, tests only where the PR touches
The second review of PR #1148 (Android, Kotlin only) ran the whole
JavaScript suite twice (570 tests) and was still going after 30 minutes.

- --max-turns: 25 for read Mochis, 80 for those that write. Out of turns
  (error_max_turns) is not a failure: the session is resumed with 3 turns
  to write its report from what it has.
- The process limit drops from 60 to 20 minutes for read Mochis.
- A PR run gets a "Les tests" section: only the tests of the part the PR
  touches, once; a missing toolchain is said in one line, nothing is
  installed; a command that already passed is not run again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 01:24:10 +00:00
Claude 3c88ff0978 brain: give PR Reviewer the diff up front
A review cost $0.98 on average (2 runs, Nov 30): about 18 turns and
900k tokens read per run, mostly spent fetching the diff and files bit
by bit. The prompt of a PR run now carries the list of changed files
and the diff against the merge-base, without lockfiles, translations
and the Xcode project, cut at 60k characters. The Mochi is told to
start from it and open only the files it needs for context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-30 00:30:48 +00:00
Louis 191aab2d5b Merge pull request #1190 from Louis-CFM/digest/sonnet
brain: read sessions with Sonnet, stop retrying what can't succeed
2026-11-30 00:47:06 +01:00
Claude 0d5762427f brain: read sessions with Sonnet, stop retrying what can't succeed
- New digestModel setting (default sonnet) for brain ingest; mergeModel
  stays for skill and Mochi drafts. Desktop conversations follow it too.
- A usage or rate limit, a prompt too long or a missing login is a
  ClaudeLimitError: no retry, the run stops, and the sessions are not
  marked failed, so the next run picks them up.
- A long session whose parts all failed (each after its own retry) is
  not read a second time by the session-level retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 23:43:19 +00:00
Claude d39bdd573e Mochis: each run keeps what it cost
Claude Code's JSON answer says what a run weighs: tokens by kind (input, cache
written, cache read, output), turns, and its price at API rates. A Mochi's run now
keeps it (summed when it asks Claude Code twice, kept too when the run fails), and:

- brain mochi runs shows the price of each run;
- brain mochi usage [--days 30] [--json]: per Mochi, runs, average and total cost,
  average tokens and turns.

On a Claude subscription nothing is billed: the number is what the run would cost on
the API, which is what Coucou Cloud would pay. It sets Cloud's prices and caps from
real runs instead of guesses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 22:04:11 +00:00
Claude ed9ad500d6 Mochis: the notes for the user are never posted
A repo Mochi's report ends with notes for the user ("## Notes pour moi"), in the
brain's language. They stay in Coucou: the draft PR's description and the review are
posted without them, including for a proposal made before this, at the click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 20:37:18 +00:00
Claude e5244d22d6 Mochis: a review that isn't one is never posted
Claude Code's last message is what a repo Mochi proposes. When a test ran in the
background, that last message can be a line about it ("Background test finished —
exit 0, already incorporated above."), and that line was proposed as the review.

- It is told: nothing in the background, and its last message is the whole report.
- A last message that isn't a report (no sections, a line) is asked for again in the
  same session; still nothing, and the run is an error with no proposal.
- A review like that, already waiting, is refused at the click.
- A Mochi that only reads (a review, a reply) no longer leaves its mochi/ branch behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 20:15:30 +00:00
Claude a354a640da Mochis: what is posted on GitHub is in the repository's language
A review, a reply, a PR's description or a commit is read by the repository's people:
it is written in the language of the PR, the issue or the repository. Only the notes
for the user stay in the brain's language, and the titles that split what is posted
from what isn't stay as given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 19:41:34 +00:00
Claude 02f632d156 Mochis: a repository is checked before a Mochi gets it, and GitHub errors show
- brain mochi add / save refuse a folder that doesn't exist, isn't a git repository
  or has no GitHub remote.
- Every gh call names the repository (-R owner/name, from origin): gh won't choose
  between several remotes outside a terminal.
- When gh fails, the run is an error with what gh said (once, not every 15 minutes),
  and nothing is noted as seen.
- brain mochi due says what each GitHub Mochi did, even with nothing to do (its first
  look: how many it noted); brain mochi list shows what starts it and its repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 19:01:45 +00:00
Claude b41f94eb21 brain: ready-made Mochis that act on a repository
Nine ready-made Mochis (Night Shift, CI Fixer, PR Reviewer, Deps & Security,
Issue Triage, Ship Log, Prod Watch, Release Prep, Memory Gardener), added with
brain mochi add. Repo Mochis work in their own git worktree with no network
tools; what they made waits as a proposal until brain mochi apply (the click
in Coucou) pushes the branch and opens a draft PR, or posts the review or the
reply. GitHub is polled with the user's gh login; weekly schedules; Prod Watch
checks its URLs every 15 minutes and speaks only when one goes down or back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-29 16:57:12 +00:00
Claude 7f8f4824ef Mail Mochis: the word can be in the mail itself, and Run now answers the latest mail
A « containing » Mochi only looked at the sender and the subject, so a test mail with the word in
its body (no subject) was ignored. A new mail that doesn't match on its headers now has its text
read in Mail and checked for the word.

Run now on a mail Mochi used to fail (« il faut lui en donner un ») and count against the budget.
It now answers the latest mail of the inboxes it listens to (Mail open), the draft coming in the
notch as for a new mail; brain refuses a mail Mochi without a mail before logging anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 22:52:09 +00:00
Claude 5d70785068 Patterns: make a task into a Mochi
Each pattern card gets « Make it a Mochi ». brain mochi from-pattern <id> has Claude reread the
task's conversations and project files and write the instructions of a Mochi that prepares it
from memory (it can only write: it sums up, drafts, lists what is missing). The schedule follows
how often the task comes back (about daily: each morning; every 2-3 days: weekdays; else on
demand), and the colour and outfit are picked from the task. Nothing is saved: the draft opens in
the Mochi editor, and saving it goes to the Team page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 22:29:10 +00:00
Claude c84eb805b3 Mochis, phase 2: mail Mochis write draft replies
A Mochi can now be started by a mail instead of a time. Coucou already reads Mail
(MailController); while a mail Mochi is on and Mail is open, each new mail it listens to
(VIPs, all, or a sender or subject it names), arrived after it was turned on, is read and
handed to brain once, one at a time. brain gives the Mochi the mail, the memories that relate
to it (search on its subject, sender and first lines) and your preferences, with no tools;
the default instructions write a short reply in your tone, [brackets] for what it can't know.

The notch card: "<Mochi> drafted a reply to <sender>", the first lines, Open the draft
(Mail's reply window with the draft above the quote, and on the clipboard), Read, Later.
Nothing is ever sent: you send from Mail. Results lists the replies with their mail and the
same Open the draft. The editor gets "When a mail arrives" and which mails; Team shows it,
and says when Mail must be opened. brain mochi run <id> --mail <base64 JSON>; a run keeps the
mail's sender, subject and ids, never its text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 21:18:47 +00:00
Claude 7aa441e16b Mochis: create and edit a Mochi from the app
Mochis › Team gets New Mochi, and each Mochi an Edit button: name, what it writes, when (on
demand, every day, weekdays, at what time), colour, outfit (the live Mochi wears it), budget of
runs a day, subscription or API key. Remove sends its file to .state/mochis-trash (its results
stay). brain mochi show / save --data <base64 JSON> / remove; the scheduler follows. The
morning brief is written once only: removed, it doesn't come back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 21:03:50 +00:00
Claude 26f54421f5 Mochis, phase 0: small agents that work from your memory
A Mochi is a Markdown file in ~/CoucouBrain/mochis/ (settings in the frontmatter,
instructions in the body). Phase 0 Mochis only read: they get the memory as context (recent
conversations from the raw index, new memories, open tasks, the memories used the most,
recent decisions) and write a Markdown result. Claude Code runs them with no tools and no MCP,
on the user's subscription, or on an Anthropic API key kept in the Keychain (brain mochi key).

brain mochi list / run / runs / enable / due / key. A launchd agent runs `brain mochi due`
every 15 minutes while a Mochi is on: a Mochi whose time has passed today and hasn't run since
runs then (caught up after sleep), within its budget of runs a day. Each run is logged with its
result in .state/mochis/<id>/.

The first Mochi, written off the first time: the morning brief (every day at 8:30, what
moved per project, open tasks, memories to check, three actions for today).

New page Memory › Mochis: each Mochi with its schedule, level and budget, a switch, Run now,
its last result rendered, earlier results, and its file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 20:38:32 +00:00
Claude ee0a675978 Memory › Usage: one list with a selector, and archiving the memories nobody uses
The three blocks become one card: Most useful, Most used (week, month, year, all),
Never used, Archived. Never used memories can be archived one by one or all at once
(after a confirmation); Archived brings them back.

brain archive / brain restore: an archived memory leaves the state files (so the hooks,
MCP, search index, pages and galaxy no longer see it) and is kept in .state/archived.json.
Saving a state leaves archived ids out, so a later ingestion can't bring one back.
Nothing is deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 20:11:54 +00:00
Claude 5d3b87826d Hub: the page title stays on one line in a narrow window; Search skips the tools' echoes
The band's title broke letter by letter ("Se / arc / h") when the window got narrow.
Claude Code stores the tools' echoes ("[bash OK: …]", "[a lu /Users/…]") as human lines:
the first request of a conversation now skips them, so Search's recent rows show what
you asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 20:04:17 +00:00
Claude 68ab3309bc Memory › Usage: which memories the agents actually use
brain now counts every memory that reaches an agent, in .state/usage.jsonl on the Mac:
the SessionStart and prompt hooks write the ids they inject, the MCP tools the ids they
return (a search or a get counts as the agent picking it; brain_rules doesn't). The
prompt hook's old lines in hooks.log are read too, so the page isn't empty on day one.

`brain usage --json` gives the uses of the last 30 days, the share of memory that ever
served, the most used, the most useful (come back in the most sessions, an agent's own
search counts double) and the ones that never served.

New page Memory › Usage shows it, with the Statistics page's cards and bars.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 20:01:49 +00:00
Claude 96a2039d2b Memory › Graph: Home hides the map's controls and sits lower; galaxy cores kept apart
- Opening Home fades the zoom bar out (and back in when Home closes); the Home card starts lower,
  away from the "Memory · Home · Memories" row, and uses the room the bar left at the bottom.
- Layout: two small territories side by side could have their centres almost on top of each
  other (portfo and louis), names overlapping. Cores are now at least max(90, 0.2 R) apart: the
  biggest galaxies keep their centre, a smaller one too close moves to the nearest point of its
  own territory that is far enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 17:51:00 +00:00
Claude 8a32d25a4b Memory › Graph: a real page for each star, galaxy centres link to all their stars, steady names
- `brain page <id> --json`: what memory knows about a node: title, date, the Markdown file to open
  (record or project page), the claude.ai link, how many messages and the first request, the
  memory's full text and why, the record's summary and lists (decisions, facts, lessons…), the
  conversations it comes from. Records are indexed by their frontmatter (records.ts).
- The panel shows it like a page: kind tag, big title, "Updated …", "Open file ↗" (and Open in
  Claude), then one paragraph that ends with the linked stars as underlined links (click = that
  page, the camera flies there), Summary, then each list. In page mode the kind chips give way to
  a "Kind: title ⌄" row that goes back to the list.
- Hovering a galaxy centre (or its name) draws a line to every star of the galaxy (235 for portfo);
  a named centre (50 memories or more) no longer shows a label on top, its name is already below.
- The galaxy names always sit right under their centre: they used to switch rows when another
  label was in the way, so they jumped as the galaxy turned.
- graph: memories now hang off the conversation they come from (their sources are record ids,
  the record gives the conversation), and measures ("abonnés instagram louis") are no longer
  turned into people.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 17:28:01 +00:00
Claude 7011d6082a Memory › Search: searches to try and the last conversations before you type
- `brain suggest --json`: the 8 last conversations (brain's own runs left out, secrets masked)
  and up to 8 searches worth trying, the words that come back most in the titles of the last
  60 days ("Reel" and "Reels" counted as one, common words left out). Index only, instant.
- The empty search page shows them: round chips (click = search for that word) and the recent
  conversations as result rows (click = open on the right, like a result).
- "Tout" and "No results" were hard-coded: now in the catalog, 16 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 16:21:23 +00:00
Claude 5747c57790 Memory › Patterns: never lose the cards, same-height cards, a turning refresh arrow
- "Read again" emptied the page: from the app, the index read failed, brain took that for
  "no conversations" and dropped every project from the cache. A database that can't be read
  now throws (readAllConversations); the cache is never emptied all at once; a project whose
  Claude calls all failed keeps what it had; a merge reply that keeps nothing keeps the list.
  `brain patterns --json` prints {error}, and the page shows the reason above the cards.
- The cards found before stay on the page while Claude reads again.
- Every card has the same rows and line counts (title and description on two lines, the files
  line, the weekly bars, three conversations), so the grid is even.
- "Read again" is now a round arrow: it lights up under the pointer and turns while it works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 15:51:58 +00:00
Claude 31d49f271c Memory › Patterns: find the skills by itself, from conversations and project files
- The analysis starts on its own when Memory opens and it is due (never done, or a project
  changed and the last run is older than 6 h). Only the projects that changed are read again,
  and a lock file keeps two runs from overlapping.
- Each project's folder is read too (the cwd Claude Code recorded): CLAUDE.md and AGENTS.md
  (their rules, release and build sections first), the top of the README, package.json
  scripts, Makefile targets, the names in scripts/, bin/, tools/ and .github/workflows.
  Secrets are masked, and a folder that doesn't look like a project (or the home folder) is
  never read. A routine seen only in the files (a release checklist in CLAUDE.md) can be a
  pattern; it cites the files, and a file that wasn't there does not count.
- The skills and commands already in ~/.claude and each project's .claude/ are sent along, so a
  task that has its skill is not proposed again.
- The skill writer gets the project files as well, to use the real scripts and commands.
- The cards show where a task was seen ("Seen in CLAUDE.md, scripts/release.sh"); the empty and
  analysing texts say that the files are read, in the 16 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 15:36:12 +00:00
Claude e1b6034929 brain skill: the newest conversation wins, and no link it did not see
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 15:25:05 +00:00