Skip to content

docs: re-land Kilo AGENTS.md and rewrite the v2 fork conventions - #15259

Merged
fpliger merged 5 commits into
v2from
reland-agents-md
Oct 20, 2026
Merged

fpliger merged 5 commits into
v2from
reland-agents-md

Conversation

@fpliger

@fpliger fpliger commented Oct 19, 2026 •

Copy link
Copy Markdown

Plan unit U-E0-03 (pre-gate), issue #15175. Part of #15171.

The root AGENTS.md on origin/v2 is upstream's. It tells every session to base work on origin/dev, which does not exist on Kilo's remote, and to test with bun run dev:live against the installed opencode service, which the isolation rule forbids. This PR adds one Kilo block on top of it, rewrites the fork conventions for origin/v2 and the moving base, and makes v2-baseline.ts run at the current base again.

Changes

File Change
AGENTS.md One marked block at the top (13 lines). Upstream text untouched
script/upstream/shared-patches.json AGENTS.md entry, rung 4; limits files 29→30, markedLines 304→315 (base after #15261)
migration-tracking/technical-notes/v2-fork-conventions.md Rewritten, stale banner removed
migration-tracking/technical-notes/script/v2-baseline.ts Rewritten: pin from pinned(), ancestry assertions, CI mirror
migration-tracking/technical-notes/baseline/pinned-v2-baseline.md Reproducer section only; capture not re-measured
migration-tracking/progress/{README.md,progress.json} Regenerated: the ratchet counts shared patches by rung (28 seam, 2 patch)

Acceptance

  • AGENTS.md names the integration branch origin/v2, BASE and branch rules. The block covers the repository and gh -R, origin/v2 and never main or upstream dev, upstream/dev as sync source and frozen upstream/v2, BASE through pinned() or migration-context.md (no SHA), branch, commit and Changesets rules, bun dev only (overrides "Live TUI Testing" and the dev:live story command), plugin first then host (KiloPlugins, packages/kilo-cli), markers plus shared-patches.json, the two skills, checks. git diff origin/v2 -- AGENTS.md is one hunk at line 1: 14 added lines, 0 removed.

    • Commands named in the block verified: env KILO_V2_PROFILE=$(mktemp -d) bun dev --help prints the CLI help through script/dev-isolated.ts with the temp profile; bun run check exists (lint && typecheck) and passes; .kilo/skills/v2-migration/SKILL.md, .kilo/skills/v2-feature-placement/SKILL.md, packages/kilo-plugin/src/index.ts (KiloPlugins) and packages/kilo-cli exist; pinned() is in script/upstream/utils/upstream.ts.
  • Conventions carry the base pin, no-prefix branches and services/www. Per stale item of doc-inventory.md §4, re-verified on the current tree:

    §4 item Result
    Pin 76dbaf20 Fixed: by reference to pinned() and migration-context.md, no SHA
    Record the validated SHA; never "latest" Still applies, reworded for D1 (release commit per sync, PR validated against the origin/v2 it targets)
    Adopting a snapshot Fixed: merge.ts and script/upstream/README.md, then re-run the baseline and diff against the capture
    Unreachable SHA, never force-push Still applies, now against upstream/dev
    upstream/dev sibling, diverged at 0e2dd4ad Removed: false since 2026-10-10; upstream/dev is the sync source, upstream/v2 frozen
    virtua patch Moved to "Packages that are not on v2 yet" (applies when kilo-vscode lands, G2); verified v1 main has virtua@0.49.1 + patches/virtua@0.49.1.patch and the handle.measure() call in MessageList.tsx, v2 has neither
    johnnyeric/kilo-opencode-v2, johnnyeric/v2-* Fixed: origin/v2, short no-prefix names
    Merge forward, never rebase Still applies; open PRs take origin/v2 by merge
    johnnyeric/ prefix override Removed; type(scope): summary kept
    Triage lane, "parity ledger" Still applies; home named: v1 delta sweep U-L2-01 and the progress map, with the mapping to proofs and dispositions
    Kilo-owned paths table Fixed: points to owned in script/upstream/utils/owned.ts; kilo-* packages added, plans/ row removed (no root plans/)
    No fork/rename, no packages/opencode Still applies
    Compact tables, no prettier Still applies, verified: .prettierignore now has five entries, no workflow runs prettier, no check-md-table-padding.ts on v2
    Root AGENTS.md hook Fixed: describes the block this PR lands
    Narrow hooks, generated output Fixed: services/www/openapi.json, packages/protocol/openapi.json, client paths src/{promise,effect}/generated and src/effect/api (from check:generated)
    Marker rules Still applies; packages/kilo-ide-ui example replaced by packages/kilo-plugin; checker commands and shared-patches.json added
    Validation commands Fixed: services/www, CI files, the script
    Companion docs Fixed: context brief, plan, host strategy, both skills, script/upstream/README.md, baseline; progress-plan link dropped

    The plugin-first rung table, vocabulary and "Areas expected to need rung 3 or 4" are unchanged.

  • v2-baseline.ts runs at BASE (pin-is-ancestor assertion, mirrors check.yml/test.yml). See "Baseline run" below.

  • (E0 exit) AGENTS.md and conventions name the current base and branch rules. Both point to pinned() and migration-context.md.

  • Mechanism recorded: not a plugin concern (documentation and conventions).

Placement

Change Rung Why not lower Proof
Kilo block in root AGENTS.md 4 AGENTS.md is the only root instruction file every agent here reads (v2 core loads only AGENTS.md, core/src/config/plugin/instruction.ts). A Kilo-owned file via instructions in a root kilo.json would reach Kilo sessions only, and the contradicting upstream rules would still be in this file, so the override sits next to them. The evidence for an alternative is not clear, so I did not switch AGENTS.md:1-14, shared-patches.json entry

Marker form: the block uses <!-- kilocode_change start - agents-md: ... --> / <!-- kilocode_change end - agents-md -->, not kilocode_change(agents-md) start. Both counters recognize a block only when start/end follows kilocode_change directly (script/upstream/utils/shared.ts:139-140, utils/markers.ts:55-56). With the tagged form, check-shared-patches counted 2 marked and 9 unmarked lines and failed. The conventions now say so. Package-level AGENTS.md files are untouched.

bun script/check-shared-patches.ts: before 29 files, 304 marked, 50 unmarked (origin/v2 after #15261); after 30 files, 315 marked, 50 unmarked, ok. bun script/check-opencode-annotations.ts: ok (59 shared files against 775d1d0d713). bun script/check-workflows.ts: ok (3 workflows). bun script/upstream/progress.ts --check: up to date (after regenerating twice, identical output).

Baseline run

v2-baseline.ts now imports pinned(), so a sync moves the pin without an edit. Offline assertions: the pin is an ancestor of HEAD, and of upstream/dev when that ref exists locally. The upstream/v2 == pin assertion is gone. --checks mirrors check.yml, test.yml (unit, sdk, build) and kilo-v2.yml in CI order, with bun install --frozen-lockfile as setup-bun does (a plain bun install reorders patchedDependencies in bun.lock on this tree). --only a,b re-runs a subset. Logs go to baseline/logs/ (gitignored, .gitignore:38 logs/).

Not mirrored, listed in the script: lint:changed (PR only), affected/e2e (if: false), test shards and --affected (the baseline runs every package once with --force), Windows matrix, JUnit and artifact steps, the kilo-v2.yml archive/upload and progress comment, and the Node build on Node < 26 (CI pins 26.4.0).

Ancestry at HEAD (pin 775d1d0d713, v2.0.30): both ok; 268 commits on top of the pin; upstream/dev 121 past it. With a deliberately wrong pin (temporary edit to origin/main 35a7472549c, reverted): both assertions FAIL, "baseline ancestry broken; refusing to run checks", exit 1.

Full --checks at 5ac694c41f, macOS arm64, bun 1.4.2, node 24.13.0, 27.7 min:

Check Result vs v2.0.30 capture
install, check (oxlint 214 warnings, 0 errors; typecheck 28/28), effect-simplification rules and lint ok Same; typecheck 27→28 tasks (@kilocode/kilo-cli since). Uncached bun turbo typecheck --force: 28/28, 32 s
test (turbo test --concurrency=3 --continue --force, isolated) FAIL, 283 s 24/25 tasks. @opencode/core 6,609 pass, 31 fail: the same 30 host-environment cases (7 shell, 23 ripgrep) plus Npm.add > installs and locates unnamed Git packages… (5 s timeout under load; test/npm.test.ts alone: 17 pass). cli and tui pass (capture: 1 load flake each)
codemode dry-run, client / www check:generated, sdk verify:package ok sdk failed on the first run with npm ENOTFOUND (DNS) then ETARGET wrangler@4.110.0; passed on re-run (204 s). Not in the capture
cli build, binary --version, service smoke ok Same
Node build + smoke skip Same (Node 24)
workflow allowlist, annotations, shared patches, import rule ok Not in the capture
progress map FAIL, then ok Stale at the first commit: the summary counts shared patches by rung. Regenerated in the second commit
script/upstream install, typecheck, test ok, test flaky merge.test.ts: 4 timeouts (5 s) in the full run, 2 in one re-run; 87/87 in four further runs. A load flake near the default timeout, not caused by this change (no code change)
kilo-plugin (9), kilo-cli (5), startup ratchet, test runner (6) ok Capture listed kilo-plugin 1 test
lint:effect-patterns, protocol check:generated (not CI) red 27 / ok Same 27 (20 star import, 4 die string, 2 JSON cast, 1 alias)

No new failure in a package this PR changes (it changes no package).

Overlap with #15020

#15020 lists "script/v2-baseline.ts from U-E0-03" ("run the pinned baseline again after each merge"). This PR covers that row: the script follows each sync through pinned() and runs the CI commands. The rest of #15020 (merge tooling, the counters, the marker guard, v2 modes of the merge agent and skills) is not touched.

Stale statements found outside this PR's scope

  • migration-tracking/plans/migration-context.md:74: "the AGENTS.md on this branch is upstream's until Kilo's is re-landed" is stale once this merges (coordinator).
  • migration-tracking/plans/kilo-v2-migration-plan.md U-E0-03 Status cell (coordinator).
  • script/upstream/README.md:71: "Kilo host (U-E0-01) … It does not exist yet." The host merged in feat(kilo-cli): add the Kilo host and the feature placement finder #15232.
  • script/check-workflows.ts:7: "The Kilo v2 line merges upstream/v2 regularly"; the sync source is upstream/dev.
  • pinned-v2-baseline.md current capture names CI jobs unit (linux), unit (windows); they are now sharded (unit (linux, 1/2) …) plus sdk package and build (…) jobs. For the next re-measure.
  • Skills (v2-feature-placement, v2-host-strategy.md §5): "every marked line carries its feature" cannot apply to block markers until the counters accept kilocode_change(<feature>) start (U-L3-01 tooling).
  • Upstream .prettierignore lists packages/client/src/generated/ and generated-effect/, which no longer exist (upstream file; informational).

Checks

bun run check (root, pre-push hook) passes. bun script/upstream/progress.ts --check up to date. Tests were not run from the root.

Add one marked Kilo block to the root AGENTS.md (rung 4 in shared-patches.json), rewrite v2-fork-conventions.md for origin/v2 and the moving base, and rewrite v2-baseline.ts to take the pin from pinned() and mirror check.yml, test.yml and kilo-v2.yml. U-E0-03, #15175.
…md patch

Regenerate the progress map (31 shared patches, 2 at rung 4), point the pinned-v2-baseline reproducer at the rewritten script, and install with --frozen-lockfile as CI does.
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

➖ v2 migration progress: 0.9% → 0.9% (0 done, 0 total, 0 dropped; 86/9829 cells)

Placement: 11 new marked lines in shared files (11 patch), 0 new kilo_port annotations, 0 new core-internal imports.

Ratchets: 9 core-internal imports (base 9); shared patches by rung 28 seam, 2 patch (base 28 seam, 1 patch).

No change to the progress map.

v2 migration progress map at this commit

Full map · how cells close

process.exit(0)
}

const only = Bun.argv.includes("--only") ? new Set(Bun.argv[Bun.argv.indexOf("--only") + 1]?.split(",")) : undefined

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SUGGESTION: --only with no value silently runs zero checks

When --only is the last argument, Bun.argv[indexOf("--only") + 1] is undefined, so new Set(undefined) is an empty set. The loop filter !only || only.has(check.name) then matches nothing, and the script prints a total and exits 0, which reads like a successful baseline run. The --only=test form is also not recognized and instead runs every check. Validate that a value follows --only and fail with usage rather than silently running zero or all checks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 64c9494. --only with no names (--only, --only --force, --only=, --only=,) now exits 1 with usage instead of running zero checks; --only=a,b is accepted alongside --only a,b; unknown names still fail. All seven cases verified locally.


Rules that apply once a package lands, kept here so the landing PR finds them:

- **`kilo-vscode` (G2): `virtua` patch.** v1 `main` pins `virtua@0.49.1` and patches it (`patches/virtua@0.49.1.patch`, adds `VirtualizerHandle.measure()`), and `kilo-vscode/webview-ui/src/components/chat/MessageList.tsx` calls `handle.measure()` for the transcript handoff-flicker fix. v2 has neither the dependency nor the patch. Port the patch with its call site, or neither, and do not bump `virtua` without both.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SUGGESTION: the v1 call-site path is missing the packages/ prefix

On v1 (origin/main) the file is packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx, with the handle.measure() call around line 511, not kilo-vscode/webview-ui/.... Since this line tells the future landing PR where the call site lives, use the full repository path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 64c9494: packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx (verified with git ls-tree origin/main).

@kilo-code-bot

kilo-code-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Both findings from the previous review are resolved at 6b8cee57a66a9d83f7ca56096c5b5f0f69587305: selection() now rejects --only with no names (and empty --only= / --only=,) with exit 1 while accepting --only=a,b, and the v1 call-site path in v2-fork-conventions.md now includes the packages/ prefix. The remaining incremental changes are the D-4 plan text merged in from origin/v2. No new issues found in the changed code; the script's temp directory per isolated check is still removed, and selection() adds no resources to leak.

Files Reviewed (7 files)
  • AGENTS.md - 0 issues
  • migration-tracking/progress/README.md - 0 issues
  • migration-tracking/progress/progress.json - 0 issues
  • migration-tracking/technical-notes/baseline/pinned-v2-baseline.md - 0 issues
  • migration-tracking/technical-notes/script/v2-baseline.ts - 0 issues (previous finding fixed)
  • migration-tracking/technical-notes/v2-fork-conventions.md - 0 issues (previous finding fixed)
  • script/upstream/shared-patches.json - 0 issues
Previous Review Summary (commit 51e57ce)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 51e57ce)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
migration-tracking/technical-notes/script/v2-baseline.ts 141 --only with no value produces an empty set, so zero checks run and the script exits 0; --only=name is ignored and runs everything
migration-tracking/technical-notes/v2-fork-conventions.md 129 The v1 call-site path omits the packages/ prefix (packages/kilo-vscode/...)
Files Reviewed (7 files)
  • AGENTS.md - 0 issues
  • migration-tracking/progress/README.md - 0 issues
  • migration-tracking/progress/progress.json - 0 issues
  • migration-tracking/technical-notes/baseline/pinned-v2-baseline.md - 0 issues
  • migration-tracking/technical-notes/script/v2-baseline.ts - 1 issue
  • migration-tracking/technical-notes/v2-fork-conventions.md - 1 issue
  • script/upstream/shared-patches.json - 0 issues

Verified against the tree: pinned() takes a ref and returns { tag, commit } from the sync merge history; the marker regexes require kilocode_change start/end with no feature tag in between, matching the block form used here; the referenced paths (services/www, packages/protocol, script/kilocode/test, script/upstream/README.md, the plan files) exist; the v1 virtua@0.49.1 pin and patch exist on origin/main; .prettierignore has five entries; bunfig.toml has the root test guard. The shared-patches.json limits (31 files, 316 marked lines) match the added block, and the progress ratchet (29 seam, 2 patch) matches the generated files. No memory-leak or resource-lifetime issue: the only code change is the baseline script, which removes its per-check temp directories after each run.


Reviewed by deepseek-v4.1-flash-1017 · Input: 51.7K · Output: 7.5K · Cached: 697.2K

Review guidance: REVIEW.md from base branch v2

…l-site path

--only without names now fails instead of running zero checks and exiting 0, and --only=a,b is accepted. Addresses the review on #15259.
# Conflicts:
#	migration-tracking/progress/README.md
#	migration-tracking/progress/progress.json
#	script/upstream/shared-patches.json
@fpliger
fpliger merged commit d011f04 into v2 Oct 20, 2026
22 of 24 checks passed
@fpliger
fpliger deleted the reland-agents-md branch October 20, 2026 00:12
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