Repository navigation
Conversation
`ltm connect` needs a fenced region of its own (#175), and init's scanner already reports a duplicate block, an end marker with no begin, an end before its begin, and a begin with no end. `findMarkers` now takes the begin and end patterns plus a label for its messages, so connect reuses those rules from one place. `appendGap` holds the blank-line rule that `replaceRegion` had inline. Init passes `ltm:generated`, and its messages come out byte-identical.
Rerunning `ltm connect >> AGENTS.md` stacks a second `## Org memory` section on the first (#175), and nothing can find the old one to replace it. `connectRegion` wraps the section in `<!-- ltm:connect:begin -->` and `<!-- ltm:connect:end -->` with a blank line inside each marker, the padding Prettier and oxfmt add, so formatting the file afterward changes nothing. `spliceConnectRegion` finds the region by whole-line markers through init's `findMarkers`, never by the heading text, so a hand-written `## Org memory` stays put. It replaces the region in place, or appends it below one blank line, and throws on any malformed marker state rather than pair the wrong markers.
The documented `ltm connect >> AGENTS.md` duplicates the section on every rerun, for example after a second Bank goes into `.ltm.yaml` (#175). `ltm connect` now prints the section inside the `ltm:connect` markers, so working-memory-kit's installer and any other tool editing AGENTS.md can tell it apart from hand-written text. `--write <file>` replaces that region in place, appends it once, or creates the file, and prints nothing on success. A malformed marker state or an unreadable path exits 1 naming the file, without writing. Bank resolution runs first, so a repo with no Bank never gets its file touched.
The README and getting-started guide now point Consumer repos at `ltm connect --write AGENTS.md`, which replaces the fenced section on later runs instead of appending a copy. The design doc said no tool writes into consumer repos, but `ltm promote` already stamps `promoted_to` into one when a person runs it. The `connect` row now says `--write` is the same kind of explicit write, and that no tool writes there on its own.
Self-review caught the new connect code drifting from house style. Two imports used `.js` where the repo imports `.ts`, the CLI split the error's first line by hand when `firstLine` already does it, and the marker regexes spelled out the marker strings again, so they could drift from CONNECT_BEGIN/CONNECT_END. They're now built from those constants. The README and guide also named `--write` without its file argument.
Owner
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Owner
Author
Deferred findings
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ltm connectnow wraps its## Org memorysection in<!-- ltm:connect:begin -->and<!-- ltm:connect:end -->, andltm connect --write <file>replaces that region in place or appends it once. The documented step wasltm connect >> AGENTS.md, so every rerun added a second section and left the stale one behind. With the markers, a rerun after adding a Bank rewrites one region, and other tools that edit AGENTS.md, such as working-memory-kit's installer, can tell the region apart from hand-written text.Closes #175
Start with
src/core/connect.ts. It reusesfindMarkersfromsrc/core/init.ts, which now takes the begin and end patterns and a label instead of hard-coding theltm:generatedones. Theinit.tschange is mechanical, and its error messages come out byte-identical forltm:generated. The blank-line rulereplaceRegionused for appending moved intoappendGapso both callers share it.--writematches on the markers alone, never on the heading text. A hand-written## Org memoryoutside any markers stays put, and the fenced region goes below it. A file with a begin marker and no end marker exits 1, names the file, and writes nothing. A missing file is the first-connect case and gets created. Plainltm connectstill prints to stdout, unchanged except for the markers.The design doc said no tool writes into Consumer repos. Its
connectrow now says--writeis an explicit write a person runs, the same kind aspromote'spromoted_tostamp. README andguide/getting-started.mdnow showltm connect --write AGENTS.md.The part I'm least sure about is that
--writecallswriteFileSyncstraight onto the target rather than writing a temp file and renaming it. A crash mid-write could truncate AGENTS.md.ltm init'sreplaceRegioncallers write the same way, so I matched them rather than adding a pattern only here.Verification
A reproducer that didn't write the code reran each claim at HEAD 4f06469 against base 7cd6c4b. All 12 came back REPRODUCED.
callermeans it drove the real CLI (bun src/cli/bin.ts connect) in a scratch repo with its own.ltm.yamlandLTM_CONFIG.seammeans no production caller applies, so the check ran on the file or suite directly.caller):bun src/cli/bin.ts connectgave rc=0, first line<!-- ltm:connect:begin -->, last line<!-- ltm:connect:end -->.caller):bun src/cli/bin.ts connect --write A.mdtwice gave rc=0 both times,grep -c '## Org memory' A.md= 1.caller):.ltm.yamlset tobanks: [acme, second], text appended after the region, thenconnect --write A.mdgave one heading, twoBank atlines, one begin marker, and the leading# Hellotext and the trailingtailline unchanged.caller):connect --write B.mdon a file starting## Org memory/hand writtenleft those lines first and gave 2 headings and 1 begin marker.caller):connect --write C.mdgave rc=1, stderrltm connect: C.md: the ltm:connect begin marker has no matching end marker; nothing written, andcmpshows C.md unchanged.seam, docs have no caller):grep -c 'ltm connect --write AGENTS.md' README.md guide/getting-started.mdgave 1 and 1;git diff --statshows the design doc changed by one line.seam, whole-suite run):bun run typecheck && bun testgave tsc clean, 1754 pass, 3 skip, 0 fail across 90 files. I reran it after the publish rebase, which was a no-op, with the same counts.caller):connect --writeon a file with an existing region replaced it in place, and on C.md it caught the unmatched begin marker.bun test test/core/connect.test.tsgave 9 pass, covering CRLF and the malformed-marker cases.firstLinefromcore/text.ts(caller): the AC5 run above goes through it..ts, and imports are sorted (seam, static text): checked withgrepandsed -n 3,8p src/cli/connect.ts.The wave merge test also ran this branch together with #176's and #178's branches on origin/main 7cd6c4b: typecheck plus 1768 pass, 0 fail.
Not Independently Verified
Every claim ran a command, so none.
Plan Concerns
The plan allowed the README and guide prose to name the argument as
ltm connect --write <file>.test/guide-commands.test.tschecks only flag names against the CLI, so the<file>placeholder passes it, and nothing else needed to change.Left Out
BEGIN_LINEandEND_LINEfrom the constants. The patterns are the same as the literals they replaced, since the constants hold no regex metacharacters, and the existing CRLF and malformed-marker tests intest/core/connect.test.tscover them. The reproducer checked this against the code and agreed.adversarial-reviewdidn't run and has no advisories to list.