Skip to content

A bug report's pointers carry the flags earlier sessions added to a command they had already run - #2337

Open
zlareb1 wants to merge 15 commits into
mainfrom
feat/command-flag-line
Open

zlareb1 wants to merge 15 commits into
mainfrom
feat/command-flag-line

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 6, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The Claude Code plugin now tells a session a command convention of its repository. Under a bug report's code pointers it prints, for a flag that three or more earlier sessions added to a command they had already run, how many sessions did so; the counts come from the sessions' shell commands, with no model call.

Why

A repository can need a flag on a command that nothing in it names. A type checker with an incremental cache is one example: run without --no-incremental it can print a result the session cannot use.

  • Failing cases. A session runs the command, reads the result, and runs the same command again with the flag. Every session in the repository pays for that first run, because nothing carries what the earlier sessions found out.
  • Pattern. The convention shows in the shell commands alone. The session's first run of the program does not carry the flag, a later run is an earlier one plus the flag's word, and from then on most of its runs of the program carry it.
  • Change. The plugin counts that pattern per repository and hands the counts to a later session before its first run, under a bug report's code pointers, where the test cost line already goes. A session that knows the flag starts with it.

The line gives counts and no instruction:

Command conventions in this repository (counted in earlier sessions, from the first that added the flag): of the 5 sessions that ran mypy, 3 first ran it without --no-incremental and then added that flag to a mypy command they had already run; none had the flag on its first mypy run.

How it works:

  • After each shell command hooks/loom-record.mjs notes its runs, and the names its text holds, in the session's private state (noteRuns in the new lib/command-flags.mjs), from the prompt that read the repository's row on. The state holds the program's name, the flag's word and hashes of the runs' folders and words and of the names, and no other text of a command. It is a file of lines: the session's start writes the first, and each shell command that changes the state adds one after the others and rewrites none.
  • At the session's end hooks/loom-session-memory.mjs hands one memory.set to the flusher: the repository's row with the session's counts (flagsPost).
  • hooks/loom-prompt-pack.mjs reads that row by key beside a bug report's search and prints a line for at most two of its pairs under the pointers (flagsLine).
  • hooks/loom-session-start.mjs writes that state at the start of a new session whose shell commands are counted (startFlags). A session is counted only while it holds the state: a resumed session, one that starts with no credential and one whose state is gone store nothing.
  • The read of a repository's row into the session's state and the write that revises it are one helper, the new lib/repo-row.mjs, for this row and the test cost row.
  • namespace.audit and the mentor leave the row's read out of their exact-key counts, as they do for the test cost row.

The rules, each stated in the feature page, HOOKS.md and the README:

  • A call the reader does not know is not read at all. That is a call with a command substitution, a backslash, an open quote, a parenthesis or a brace outside quotes, a | at a line's end (the pipeline goes on in the next line), a simple command that starts with a shell keyword (if, for, while, function and the others), or a here-document whose word is not a plain word. A missed convention costs nothing. A wrong line is read by every later session.
  • A run is a simple command of a call that is read, and no later stage of a pipeline. A command with a redirect to a file, a job in the background or more than 24 words is no run. A run in a folder outside the checkout is not noted, and neither is one in another checkout under it, a folder that holds a .git on the way down from the root (a submodule, a worktree, a clone): its runs are another repository's. The folder is the command's, or the one a cd of the call to one plain path changed to. The reader joins the folders of a call as POSIX paths on every host.
  • The program is a bare command name with no dot, or the module of python -m. A script path is never a program, and neither is a module named with a dot (python -m scripts.sync), which is a file of the checkout. A word that starts another command (env, timeout, sudo, uv, npx and others) is no program, and neither is an interpreter that is given a script (bash, node, ruby, julia, awk and the others of the list in the docs). An interpreter or a wrapper that is not on its list is a program, and a flag after the script it runs is counted as its own: the docs say so.
  • A flag is stored as its word only. A flag written with its value (--name=value) and a short flag are not counted. Neither is a flag of one or two letters (--lf, --co): it is an abbreviation, and no refused word can be read in it. A flag is counted as added only before the run's first bare word, so the flag of a subcommand, or of the command a wrapper runs, is not counted for the first word's program. A run that holds the flag's word after that still carries the flag: a session whose first run holds it there had the flag on its first run.
  • A session converged on a flag when its first run of the program does not carry it, a run that carries it where it is counted as added has an earlier run in the same folder with the same words but for the flag's word, and from the first run that carries it more than half of its runs of the program carry it. A flag a session tries once and drops is no convergence. Runs are compared by a hash of their folder and their words, so the same words in another folder are another command. The folder is the command's own or the absolute path a cd named. After a cd to a relative path it is the command's folder with the path as the call wrote it, since the hook is given the session's folder from before the call or from after it: two such runs are the same only after the same cd from the same folder.
  • A program is counted only where the session knows its first run. A session can run a program in a shape that is not read: after timeout, by its path, with its output in a file or inside a $(. So every shell command is read for the names it holds, a word or the last part of a path anywhere in its text. A word of one dash and letters also names what follows its first m, so the module in python -mmypy is a name. A program that a command names before its first noted run, or names more often than it runs it, is not counted for the session. pip install mypy before the first mypy run ends the count of mypy.
  • A pair is handed when three sessions or more converged on it, and more converged on it than had the flag on their first run. A pair counts 30 sessions at most, so those that converged are a tenth or more of the sessions that ran the program: the bound keeps that share, and the module tests no third condition. A prompt gets two lines at most.
  • A pair counts sessions until 30 have run its program. A pair the row does not hand by then stays as it is and, while the row holds it, does not enter the row again, so no later session writes the row for a pair that can never be handed. The row holds eight pairs. A new pair takes the place of a pair that one session converged on, or of one that counts no more and is not handed, and a pair that lost its place enters again as any other pair does. A pair the row still names by its hash at 30 sessions is such a one, whatever its counts: no session matches its flag to the hash again. A stored row with a count that no sessions give, such as more than 30 sessions that ran a program, is left as it is.
  • A session that was handed a pair's line adds nothing to that pair's counts. It starts with the flag because it was told to, which would read as a flag on the first run and end the line. A resumed session stores nothing, for the same reason: it knows what its earlier part learned.
  • The row names a flag by its word only for a pair it hands. Any other pair holds a hash of the program's name and the word, which a session matches against its own flags. Recall of the row, and the session primer's list of the newest memories, so print no flag that the line would not. The hash has no secret part: who can read the row can try the program's flags against it and find the word. The docs say so.
  • A flag or a program on a refused list is never counted. The flag list holds words (force, yes, override, delete, kill, flush, skip, ignore, suppress, verif, fix, format, exec, commit, dry, run, plan, only, collect, exclude, filter, prompt, test, lint, error, quiet, public, share and others), and a flag whose word holds one of them is refused: such a flag forces or confirms, destroys or rewrites, turns a trial run into a real one or back, skips, narrows or weakens a check, reaches outside the checkout or waits for a person. The program list holds programs that act outside the checkout, as a release tool and a database client do, move or write the files their operands name, or run a file of recipes (git, rm, cp, ln, tar, patch, ssh, docker, curl, pip, npm, cargo, semantic-release, psql, clickhouse-client, make, tox and others). The two lists are the whole of the rule, and the docs print both in full and say so: a flag of a program on neither list can be counted, whatever it does. A test holds the feature page's lists to the module's. A pair of a stored row whose program or flag is not counted is read as not there, and the next write of the row leaves it out: a word that joins a list later ends that pair's line and leaves the row's other pairs readable. The line states what earlier sessions did and gives no instruction.

The line names no time. The hooks hold no duration of a shell call, so there is nothing to print one from.

Scope and risk

  • Hooks in a user's session. The launcher reads the command of each shell call in its own process, with no request and no added wait. It adds a line to the state only where the command changes what the session noted, and only in a session that holds the state its start wrote. In code mode, with session memory off or with no credential the start writes none, so the launcher notes no run. With session memory off, or once a credential has come, a bug report still prints the line, so the session still keeps its copy of the row it read; in code mode no row is read and no state is written. A session that starts with no credential stores nothing, also where a credential comes later: its earlier shell commands were not noted. The start writes the state before it signs the session up, and the launcher removes a session's state at a SessionEnd with no credential, where no hand-off runs. Whether a session's shell commands are counted is one predicate, countsRuns in lib/test-report.mjs, which the launcher, the library and the session's start ask. The row's read is sent beside the prompt's search and never waited for past its answer. Every path returns nothing on an error.
  • Shell commands whose hooks run at the same time. Parallel shell calls and subagents end within milliseconds of each other, and their hooks overlap. A hook adds its command's line to the state and rewrites no other, so both commands are noted, in the order their lines were written. The line holds what the state the hook read takes of the command. A later state takes no run and no name that an earlier one refused, so what a line leaves out would change nothing after the other command's line. A file whose first line is not the start's is no state: a hook that read the state before another removed it adds its line to a new file, and that session stores nothing. node --test --test-name-pattern="same time" tests/command-flags.test.mjs starts twelve hooks together and finds twelve programs; with a state that each hook rewrote whole, one to three of them were missing in each of three runs.
  • Where the line goes. It goes to a Claude Code session on a POSIX host, in any checkout that gets code pointers: the session needs no test report, since the counts read nothing of one. So such a session sends one more memory.get at its first bug report in a checkout, and none after. A Codex session reads no row and notes no run: the launcher that reads the shell commands is Claude Code's. Nothing is noted or read on Windows, where a cd can name a folder by a path the reader does not resolve.
  • Server. HOOK_READ_KEYS in server/memory/domain/namespace_shapes.py is now a regular expression that holds the whole key of either row, and namespace.audit and the mentor test a read's key with match. The audit rules exact_key_store and intentional_exact_key_reads go to versions 4 and 3. No table, op or field changes.
  • What leaves the machine. The program's name, three counts and the flag's word for a pair the row hands, or a hash of the program's name and that word for any other pair, under the repository's id. The hash has no secret part, so a reader of the row can find the word by trying the program's flags against it. A value the secret redaction would change is not sent. The call's text stays in no state: the session's state holds hashes of folders and words and is removed at the session's end.
  • Stored data. One memory row a repository, key repo:<id>/command-flags/shell, tagged command-flags. The write names the value the session read at its first bug report (if_match_sha256) and is create-only after a miss. A row that another session wrote after that read refuses the write, and the session's counts are dropped, so a long session loses its counts more often than a short one. The docs state that loss. A value that is not the row's sentence is neither printed nor overwritten.
  • Where the counts start. A pair enters the row with the first session that converged on it, so a session before it that ran the program is not counted, and the line says "from the first that added the flag". Counting every program from its first run would send a write at nearly every session's end and store the name of every program a session ran.
  • Frozen counts. The counts of a pair stay as they are while the row hands it, since the sessions that are handed it do not count. A pair that a third pair overtakes is handed no more: the row names it by its hash again, and it counts sessions again. A convention that no longer holds leaves the row by memory.delete on its key.
  • A flag followed by its value. The words alone do not tell a flag's value from an operand. Such a flag converges only where an earlier run held the value as a word of its own, and the value is never kept.
  • A session that cannot tell at all stores nothing. Runs and names are noted from the prompt that read the row on. A session is counted only while it holds the state its start wrote, so one whose start the hooks did not see, one that was resumed and one that started with no credential have none and store nothing. A session that ran a shell command before that prompt, ran one of more than 64 KiB or read the row of a second checkout loses its state and stores nothing. The sweep of day-old state files removes the state like any other, and a session that lost its state or its copy of the row so stores nothing: no mark has to outlive the sweep.
  • The sender census. tests/unit/session_content_senders.json holds the reviewed memory.get of both plugins' lib/repo-row.mjs, in place of the one of lib/test-cost.mjs, and the pins of the files this change touches, in the layout the file has on main. The module's regular expressions hold no quote character, which the census's scanner would read as the start of a string.
  • One reader. lib/command-flags.mjs cuts a command with the helpers of lib/shell-command.mjs, which exports four names it kept to itself and one split of a simple command into words (shellWords) that readsOnly uses too. The row's read, its copy in the session's state and its conditional write are one helper for both rows, the new lib/repo-row.mjs (heldRow, rowPost), with the state's kind, the key, the parser and the tag as its arguments. lib/test-cost.mjs loses its copy.
  • Shared files. hooks/loom-record.mjs, hooks/loom-session-memory.mjs, hooks/loom-prompt-pack.mjs and hooks/loom-session-start.mjs change by a few lines each. lib/test-report.mjs gains the two predicates beside testReportOn. lib/test-cost.mjs changes by 6 lines added and 35 removed: its read and its write call the helper. lib/test-gate.mjs and hooks/loom-test-report.mjs are untouched. Three test files change by a few lines: the stub server of tests/test-cost.test.mjs leaves the new row's requests out of the counts its tests assert, the session helper tests/mode-session.mjs leaves the row's read out of the ops of a session, since it is sent only where the search has not answered first, and tests/prompt-pack-hook.test.mjs lists the row's memory.get among the requests of a bug report on a POSIX host and expects none on Windows. tests/plugin-modes.test.mjs is untouched. The test_report option's text in the Claude Code manifest names command conventions, and the Codex page lists the feature among what Codex does not have. Prettier pads four tables again: the switch table of HOOKS.md, since the row of LOOM_SESSION_MEMORY grew, and the hook tables of HOOKS.md, the README and the feature page, since the row of loom-session-memory names the second memory.set.
  • main changed the test cost files after this branch began. The branch holds a merge of main. Git joined lib/test-cost.mjs, lib/test-report.mjs, HOOKS.md, the README and the feature page with no conflict. The version line of both manifests and the two lines of the sender census that pin the hash of lib/test-cost.mjs conflicted: the merge keeps 1.2.191 and pins the hash of the merged file.
  • Version. Both plugin manifests go to 1.2.191. main is at 1.2.190.

Compatibility, rollout and rollback

  • Wire: no op or field is added or changed. The hooks call memory.get and memory.set on the key repo:<id>/command-flags/shell, with the fields the test cost row uses; tests/unit/test_plugin_memory_contract.py checks both requests and the reply against the wire models, and both keys against HOOK_READ_KEYS.
  • Operator steps: none. LOOM_TEST_REPORT=off (or the test_report option) stops the note and the line, LOOM_SESSION_MEMORY=off the note and the write, and code mode all three. The feature has no switch of its own. A server of an earlier release counts the new row's read among the exact-key reads of the namespace and of the agent, one a session and checkout, until it is upgraded.
  • Rollback: reverting leaves the rows that sessions stored. They are ordinary memory rows that recall can serve; memory.delete on the key removes one.

Tests

  • The first commit holds the tests alone, and they fail there for want of lib/command-flags.mjs: node --test integrations/claude-code-plugin/tests/command-flags.test.mjs. The second adds the module. The third to the ninth are review rounds: the rules above that the earlier commits did not hold, with a test for each, and the tests that failed on Windows and under WSL 2. Two merges of main follow, with one more review round between them: the docs say what the hash of a flag is made of, and the reader loses a fallback that no call reaches. One more review round follows: a module in the word of an interpreter's -m is a name of its call, and the bound on a call's size is checked in one place, where it ends the session's count. After a third merge of main, the last commit is a review round too: the state is a file of lines, so shell commands whose hooks run at the same time are all noted, and a test holds that a session with session memory off still gets the line.
  • The plugin's tests cover the reader (lists, pipelines, one that goes on in the next line, here-documents, cd, the calls that are not read), the refused programs, interpreters, wrappers and flag words, a wrapper that is on no list, a flag of one or two letters, the feature page's lists against the module's, the bare-word rule, the names of a call and a program named before its first run, what a session counts, which pairs are handed, how a row is revised, the 30-session bound, a row with a count over it, a pair that lost its place and enters again, the stored sentence with its hashes and its parser, a row's pair that is not counted, and the hooks end to end against a stub server: the note after a command that passed or failed, the write at the session's end, the line under a bug report's pointers with no test report, shell commands whose hooks run at the same time, the state read from its lines, a file that does not start with the start's line, the switches, the line of a session with session memory off, a Codex client, a second checkout, a resumed session, a start after a compaction, a session whose start the hooks did not see, a session whose state the day-old sweep removed, a session that starts with no credential and gets one later, the state's removal at an end with no credential, a start with a switch off, which writes no state, the same words in another folder, a flag added with a move to another folder, a run in another checkout under the row's checkout, a shell command before the row's read, a shell command over 64 KiB, a run outside the checkout, a row the secret redaction would change, which is not sent, and a write the server refuses, which is not sent again. One test runs only on Windows: no state, no noted run and no read of the row there.
  • node --test integrations/claude-code-plugin/tests/*.test.mjs holds 1374 tests, 8 of them skipped on a POSIX host. CI runs it on Linux, macOS, Windows, WSL 2 and Alpine. On a loaded local machine the whole run can fail a few timing tests, a different set each run; the last local run failed one, in tests/file-context-read.test.mjs, which passes when that file is run alone. The five test files that exercise the change pass when run alone: node --test tests/command-flags.test.mjs tests/plugin-modes.test.mjs tests/prompt-pack-hook.test.mjs tests/record-hook.test.mjs tests/test-cost.test.mjs from the plugin's folder gives 238 pass and 1 skipped, the test that runs only on Windows.
  • .venv/bin/python -m pytest tests/unit/test_session_content_senders.py tests/unit/test_plugin_memory_contract.py tests/unit/test_codex_plugin.py tests/unit/test_doc_links.py tests/unit/test_public_copy.py tests/unit/test_agent_instructions.py tests/unit/test_agent_plugin.py tests/unit/test_plugin_agrees_with_server.py: 579 pass.
  • tests/unit/test_mentor.py and tests/unit/test_namespace_audit.py hold the server's side: a hook's reads of both rows are left out of the mentor's and the audit's counts, and the mentor reads no test tag in a hook's write of either row. The mentor's tests of the hooks pass locally. Ten tests of the two files that load the memory table stop at Unknown setting 'enable_quantized_codec' with my local ClickHouse binary, nine of them tests this change does not touch, so the audit's test runs in CI. I ran its NOT match(...) predicate over the test's rows with clickhouse local.
  • tests/analyzer and tests/unit/test_package_contracts.py pass.
  • make format-check, make lint and make typecheck pass. node --check passes over every hook and library file of both plugins. python -m scripts.codegen.agent_plugin_sync wrote the Codex copies and python -m scripts.codegen.docs_reference the mentor's reference page.
  • claude plugin validate integrations/claude-code-plugin --profile directory --strict reports one warning with the local client, about the plugin's bin/ folder, which this change does not touch.
  • No integration test: the change adds no op, and the row's requests are the ones the wire-model test checks.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I checked the reader against the shapes in the tests, ran the plugin's whole test suite, read the merge of main's change to the test cost files, and read every doc sentence against the code.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

🤖 Generated with Claude Code

zlareb1 and others added 2 commits December 6, 2026 06:20
…carries

They import lib/command-flags.mjs, which the next commit adds: the plugin tests fail until then. The fixture of the row's two requests is held to the memory wire models.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ommand they had already run

A session that does not know a repository needs a flag on a command runs
the command, reads a result it cannot use, and runs it again with the
flag. The launcher now notes the runs of each shell command in the
session's private state, as hashes of their words. At the session's end
the counts go to one memory row a repository: for a program and a flag,
the sessions that converged on the flag, the ones that had it on their
first run and the ones that ran the program. A later bug report in a
session that has the test report reads the row by key beside its search
and prints a line for at most two pairs that three or more sessions
converged on.

The reader refuses a shape it does not know. It never counts a program
that acts outside the checkout or a flag whose word forces, destroys,
skips or weakens a check, or rewrites files. A session that was handed a
pair's line adds nothing to that pair's counts.

Both plugin manifests go to 1.2.191.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 6, 2026 10:46am UTC
loom-telemetry Ready Ready Preview Dec 6, 2026 10:46am UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

let changed = false;
const next = pairs.map((pair) => {
const seen = counts[pair.program];
if (!seen || told.includes(pair)) return pair;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unread lines still freeze counts

Medium Severity

flagsLine saves the repository row as soon as memory.get returns, but the prompt only appends those lines when code pointers were sent. revised then treats every pair from handed as already shown, so a session that never saw the line adds nothing to those counts.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7059ff9. Configure here.

…e call

A wrong line is read by every later session, so the reader refuses more
than it reads:

- A call with a parenthesis, a brace, a shell keyword or a here-document
  whose word is not plain is not read at all, and a run in a folder
  outside the checkout is not noted.
- A flag counts only before the run's first bare word: the flag of a
  subcommand, or of the command a wrapper runs, is not the first word's.
  Wrappers and interpreters that are given a script are no programs.
- A session converged on a flag when more than half of its runs from the
  first that carries it carry it, so a flag tried once and dropped is not
  counted. More programs and flag words are refused, and the docs say the
  two lists are the whole of that rule.
- A resumed session stores nothing: it knows what its earlier part
  learned.
- The row names a flag by its word only for a pair it hands and by a hash
  otherwise, so recall and the session primer tell no session a flag that
  the line would not.

namespace.audit and the mentor leave a hook's read of the row out of
their exact-key counts, as for the test cost row: HOOK_READ_KEYS is a
regular expression over the whole key, and the audit rules exact_key_store
and intentional_exact_key_reads go to versions 4 and 3.

The sender census holds the reviewed read of both plugins and the pins of
the files it covers.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

// The folder of what follows is known only after a `cd` to one plain path.
if (all[0] !== "cd" || !read || all.length !== 2 || !PLAIN_PATH.test(all[1])) break;
dir = path.isAbsolute(all[1]) ? all[1] : path.join(dir, all[1]);
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directory tracking follows cd in pipelines

Medium Severity

A cd in the first stage of a pipeline still updates the folder used for every later command, and a cd before || does too. Those commands either did not run or ran in the original folder, but they can be stored as in-checkout runs and create a false convention.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 093ecd1. Configure here.

zlareb1 and others added 2 commits December 6, 2026 09:38
…first run

A session can run a program in a shape the reader does not read: after a
wrapper, by its path, with its output in a file or inside a substitution.
Such a run was invisible, so a session that had the flag from the start
could read as one that added it.

- Every shell command is read for the names it holds. A program that a
  command names before its first noted run is not counted for the session.
- A session that ran a shell command before a prompt read the row, or one
  over 64 KiB, stores nothing.
- A run carries a flag wherever the flag's word stands. The place before the
  first bare word decides only whether the flag is counted as added.
- A program's name holds no dot, so a module named with one is no program.
  More interpreters that are given a script are refused, and more flag
  words: the docs state that the two lists are the whole of the rule.
- A pair counts sessions until 30 have run its program. A pair the row does
  not hand by then is written by no later session, and a full row can give
  its place to a new pair.
- The feature needs no test report. It runs in a Claude Code session on a
  POSIX host, under the test report's switch, and the launcher notes
  nothing with no credential.
- The sender census is in main's layout again, and HOOKS.md lists
  LOOM_SESSION_MEMORY once.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ine goes on in the next line

A flag of one or two letters (`--lf`, `--co`) is no flag: no refused word,
three letters at least, can be read in an abbreviation, so a flag refused by
its word was counted by its alias. The refused words gain `exec` (in place
of `execute`), `plan`, `only`, `collect` and `stepwise`.

A call that holds a `|` at a line's end is not read: the next line is a
later stage of that pipeline, and it was read as a run.

A resumed session is marked only where its runs are noted (`notesOn`): with
no credential, in code mode or with session memory off it wrote a mark that
nothing removed at the session's end.

The docs say that a pair which counts no more does not enter the row again
while the row holds it, and name the conditions under which runs are noted.
A test holds the feature page's lists of keywords, programs and flag words
to the library's.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

zlareb1 and others added 7 commits December 6, 2026 11:44
…nd no pair a list refuses

A session that starts with no credential is marked at its start and stores
nothing: its shell commands are not noted, so its first run after a
credential comes was read as its first run of the program. The mark is
written before the start signs the session up, so a resumed session that
is signed up there is marked too. The launcher removes the mark at a
SessionEnd with no credential, where no hand-off runs.

A row's pair whose program or flag is not counted is read as not there,
and the next write of the row leaves it out. Such a pair made the whole
row unreadable, so a word added to a list left a repository with a row
that printed no line and took no count until someone deleted it.

The refused flag words gain `yolo`, `interact` (in place of
`interactive`), `bail`, `changed`, `quick`, `exclude`, `select` and
`filter`. The programs that act outside the checkout or run a file of
recipes gain `cargo`, `gem`, `composer`, `go`, `dnf`, `yum`, `tox`, `nox`,
`invoke`, `ninja`, `gradle`, `mvn` and `bazel`, and the words that start
another command gain nine wrappers. The docs say that a wrapper which is
not on the list is a program, and that a flag after a script it runs is
counted as its own.

Tests hold three rules that had none: a shell command over 64 KiB marks
the session, nothing is noted or read on Windows, and the mentor reads no
test tag in the write of either row. `simpleCommands` and `readsOnly`
share one split of a command into words (`shellWords`).

The `test_report` option's text names command conventions. The tables of
what `loom-session-memory` sends at SessionEnd name the second
`memory.set`, the Codex page lists the feature among what Codex does not
have, and the README states the whole rule for a full row.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The reader joined the folder of a `cd` with the host's path rules, so a
Windows host turned `cd /tmp/scratch` into `\tmp\scratch`. The paths of a
shell call are a POSIX shell's on every host, and the reader now joins
them so.

Four tests held more than the feature promises, and failed on Windows and
under WSL 2:

- The test of the feature page's lists read the page with the host's line
  ends. It now reads a CRLF clone as it reads an LF one.
- The mode tests listed `memory.get` among a bug report's ops. The read of
  the row is sent only where the search has not answered first, and never
  on Windows, so the session helper leaves that one read out of a
  session's ops and the mode tests are as they were.
- Two prompt tests expected the read on every host. They expect it on a
  POSIX host and expect none on Windows.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… start wrote

A session's start writes its command conventions state, and a session is
counted only while that state is there. The sweep of day-old state files
removed the mark of a session that stores nothing, so a long session was
counted again from its next shell command, with its first run of a program
not among its runs. A session whose state is gone now stores nothing: one
the sweep reached, one that was resumed, one that started with no
credential, one whose start the hooks did not see.

A run is compared by its folder and its words. The same words in another
folder were read as the command the session had already run, so a flag
first used in a second package counted as added. A run in another checkout
under the row's checkout (a submodule, a worktree, a clone) is not noted:
it was counted for the outer repository.

The programs that are not counted gain the ones that move or write the
files their operands name (`cp`, `ln`, `tar`, `patch` and others), and the
refused flag words gain `override`, `batch`, `kill`, `flush`, `cascade`,
`reverse`, `bless`, `suppress`, `lenient`, `public`, `share` and others.
`verify` becomes `verif` and `upgrade` becomes `grade`, which refuse more
spellings.

A row's pair is read only with a count of sessions the row can hold, 30 at
most. The tests use counts a row can reach.

The docs say what a row holds for a pair it does not hand: a hash of the
program's name and the flag's word with no secret part, which a reader of
the row can try the program's flags against. They say that the counts of a
pair stay only while the row hands it, and what happens to a pair another
one displaces.

One predicate says whether a session's shell commands are counted
(`countsRuns` in lib/test-report.mjs): the launcher, the library and the
session's start wrote the condition out three times. The read of a
repository's row into the session's state and the write that revises it
are one helper (lib/repo-row.mjs) for the test cost row and the command
conventions row, which each had a copy.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ull row gives up a pair it can never hand

A release tool and the ClickHouse clients join the programs that are never
counted: one more flag can turn a release tool's trial run into a release,
and a database client acts outside the checkout. The feature page lists
them, and a test holds the page's list to the module's.

A full row gives a new pair the place of a pair that counts no more and
that the row does not hand, as the docs say. Before, a pair whose counts
would hand it kept its place where the row named it by its hash behind two
pairs of more converged sessions: no session matches its flag to the hash
once 30 have run its program, so it was never handed and never replaced.

The test of handing drops the tenth of the sessions that ran the program:
a pair counts 30 sessions at most and is handed from three, so the
condition could not be false. The docs say that the bound keeps the tenth.

HOOKS.md names the state the launcher removes at a SessionEnd with no
credential, and lists the session's start among the readers of
LOOM_SESSION_MEMORY and of the memory plane.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…/test-cost.mjs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…hat a session that is not counted keeps

- The row names a flag it does not hand by a hash of the program's name
  and the word. The README, the feature page, HOOKS.md and the
  `test_report` option's text said a hash of the word in five places.
- HOOKS.md said a session whose shell commands are not counted writes no
  state. It notes no run and its start writes none, and one whose prompts
  are told still keeps its copy of the row a bug report read.
- `simpleCommands` holds no fallback for a stage `unquotedText` does not
  read: a call it does not read is refused before the call is cut, and a
  cut outside quotes leaves every stage readable.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b189dbf. Configure here.

export function runs(command) {
const joined = String(command || "").replace(/\\\n/g, "");
const text = joined.length <= MAX_CALL ? withoutBodies(joined) : null;
const commands = text === null ? null : simpleCommands(withoutComments(text.replace(NO_FILE_REDIRECT, " ")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments can start here-documents

Medium Severity

runs strips here-document bodies before it strips comments, and withoutBodies does not treat # as a comment. A << inside a comment is read as an opener, so later real commands up to a matching line are dropped. Losing those runs can make a flag look converged when the session did not keep it.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b189dbf. Configure here.

zlareb1 and others added 3 commits December 6, 2026 15:23
…call

- `names` reads a word of one dash and letters from after its first `m`,
  so `python -mmypy` and `python -Bmmypy` name `mypy`. Such a run is not
  read, and a session whose first run had that shape now has no count for
  the program where it was counted as one that added the flag.
- `runs` holds no size bound. `noteRuns` ends a session's count at a
  call over 64 KiB before it reads the call, and the docs state the bound
  there only.
- `revised` and `noted` name three things by what they are: `inRow`,
  `freeSlot` and `nameCounts`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
- The session's state of command conventions is a file of lines. The
  start writes the first, and `noteRuns` adds one line for a command that
  changes the state and rewrites none. Each hook used to rewrite the whole
  state from the copy it read, so of two hooks that overlapped one lost
  its command, and a session could be counted with a first run it did not
  have. `stateOf` reads the lines back through the rule `noted` held, now
  `entry` and `folded`.
- A test holds that a session with LOOM_SESSION_MEMORY=off still gets the
  line at a bug report.
- The module's header says what a program with no known first run is
  before it says what a name is, and `revised` adds one to `ran` plainly.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>

This branch has not been deployed

No deployments
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