xonecas.io
64875
Mc

mini-coder / commit 4df3be8

docs: remove phase-label comments from performance plan implementation

xonecas2026-03-14 4df3be8a71540f62f54d648d5348fb3f99471f45 parent 0396a86

12 files changed

src/agent/session-runner.ts+2−2
@@ -82,7 +82,7 @@ export class SessionRunner {
8282 public totalIn = 0;
8383 public totalOut = 0;
8484 public lastContextTokens = 0;
85- // P2: Cache the system prompt so the file-system reads in buildSystemPrompt
85+ // Cache the system prompt so the file-system reads in buildSystemPrompt
8686 // (context files, skills index) are not repeated on every processUserInput call.
8787 // Re-built only when extraSystemPrompt changes.
8888 private _extraSystemPrompt: string | undefined;
@@ -199,7 +199,7 @@ export class SessionRunner {
199199 this.coreHistory.push(userMsg);
200200
201201 const llm = resolveModel(this.currentModel);
202- // P2: Use cached system prompt; rebuild only on first use or after
202+ // Use cached system prompt; rebuild only on first use or after
203203 // extraSystemPrompt / sessionTimeAnchor change.
204204 if (!this._systemPrompt) {
205205 this._systemPrompt = buildSystemPrompt(
src/agent/subagent-runner.ts+1−2
@@ -35,8 +35,7 @@ async function consumeTail(
3535 ): Promise<string> {
3636 if (!stream) return "";
3737 const reader = stream.getReader();
38- // P7: Accumulate Uint8Array chunks instead of string-concatenating (O(n²));
39- // decode and slice once at the end.
38+ // Accumulate Uint8Array chunks and decode once at the end to avoid O(n²) string concatenation.
4039 const chunks: Uint8Array[] = [];
4140 try {
4241 while (true) {
src/agent/tools.ts+1−1
@@ -41,7 +41,7 @@ function withCwdDefault(
4141 return {
4242 ...tool,
4343 execute: async (input: unknown) => {
44- // P6: Mutate defaults onto the existing input object instead of
44+ // Mutate defaults onto the existing input object instead of
4545 // allocating a new spread object on every tool invocation.
4646 const patched = (
4747 typeof input === "object" && input !== null ? input : {}
src/llm-api/turn.ts+4−4
@@ -62,7 +62,7 @@ function safeStringify(value: unknown): string {
6262 }
6363
6464 /**
65- * P4: Lightweight alternative to getMessageDiagnostics that computes only the
65+ * Lightweight alternative to getMessageDiagnostics that computes only the
6666 * fields needed for the context-pruned yield event (no roleBreakdown / tool
6767 * contributor maps). Used when the API log is disabled.
6868 */
@@ -630,7 +630,7 @@ export function stripGPTCommentaryFromHistory(
630630 // ─── Main turn function ───────────────────────────────────────────────────────
631631
632632 /**
633- * P9: Merged single-pass replacement for the sequential
633+ * Merged single-pass replacement for the sequential
634634 * `stripGPTCommentaryFromHistory` + `stripOpenAIItemIdsFromHistory` calls in
635635 * `runTurn`. Both transforms are OpenAI-only; combining them into one loop
636636 * halves the number of full-array allocations on OpenAI sessions.
@@ -875,7 +875,7 @@ export async function* runTurn(options: {
875875 });
876876 }
877877
878- // P9: Single-pass merged transform (commentary + item-ID strip) instead of
878+ // Single-pass merged transform (commentary + item-ID strip) instead of
879879 // two sequential full-array passes; individual functions kept for tests.
880880 const openAIStrippedMessages = stripOpenAIHistoryTransforms(
881881 geminiSanitizedMessages,
@@ -888,7 +888,7 @@ export async function* runTurn(options: {
888888 logApiEvent("openai history transforms applied", { modelString });
889889 }
890890
891- // P4: Only compute full diagnostics when the API log is active; otherwise
891+ // Only compute full diagnostics when the API log is active; otherwise
892892 // use a lightweight count+bytes helper that skips roleBreakdown/topContributors.
893893 const apiLogOn = isApiLogEnabled();
894894 const prePruneDiagnostics = apiLogOn
src/session/db/connection.ts+1−1
@@ -170,7 +170,7 @@ export function pruneOldData(): void {
170170
171171 // Reclaim pages freed by deletions.
172172 if (deletedSessions > 0 || deletedHistory > 0) {
173- // P10: Defer VACUUM off the synchronous startup path so the CLI prompt
173+ // Defer VACUUM off the synchronous startup path so the CLI prompt
174174 // renders before the (potentially slow) page-reclaim scan runs.
175175 setImmediate(() => {
176176 db.exec("VACUUM;");
src/session/db/message-repo.ts+2−2
@@ -2,7 +2,7 @@ import { renderError } from "../../cli/output.ts";
22 import type { CoreMessage } from "../../llm-api/turn.ts";
33 import { getDb } from "./connection.ts";
44
5-// P5: Hoist prepared statement to module-level lazy singleton to avoid re-compiling SQL each call.
5+// Hoist prepared statement to module-level lazy singleton to avoid re-compiling SQL each call.
66 type Stmt = ReturnType<ReturnType<typeof getDb>["prepare"]>;
77 let _insertMsgStmt: Stmt | null = null;
88 function getInsertMsgStmt(): Stmt {
@@ -28,7 +28,7 @@ export function saveMessages(
2828 // providerMetadata thought signatures and part ordering required for Gemini
2929 // tool-call replay correctness.
3030
31- // P1: Single transaction so all rows in a saveMessages call are flushed together
31+ // Single transaction so all rows in a saveMessages call are flushed together
3232 // instead of triggering one implicit WAL flush per row.
3333 db.transaction(() => {
3434 for (const msg of msgs) {
src/tools/create.ts+1−1
@@ -41,7 +41,7 @@ export const createTool: ToolDef<CreateInput, CreateToolOutput> = {
4141 await input.snapshotCallback?.(filePath);
4242 await Bun.write(filePath, input.content);
4343
44- // P3: diff deferred to finalizeWriteResult / stripWriteResultMeta.
44+ // diff deferred to finalizeWriteResult / stripWriteResultMeta.
4545 return {
4646 path: relPath,
4747 created,
src/tools/hooks.ts+1−1
@@ -71,7 +71,7 @@ export async function runHook(
7171
7272 // ─── Env builders (one per tool) ─────────────────────────────────────────────
7373
74-// P3: Accept WriteResultMeta so diff is computed here (only when a hook fires)
74+// Accept WriteResultMeta so diff is computed here (only when a hook fires)
7575 // instead of being pre-computed and then discarded in applyFileEdit.
7676 type WriteResult = WriteResultMeta & { path: string };
7777
src/tools/insert.test.ts+1−1
@@ -4,7 +4,7 @@ import { createTestHelpers } from "./test-helpers.ts";
44 import { stripWriteResultMeta } from "./write-result.ts";
55
66 const { setup, teardown, write, read, anchor, getDir } = createTestHelpers();
7-// P3: diff is deferred; strip meta before asserting on public fields.
7+// diff is deferred; strip meta before asserting on public fields.
88 const execute = async (...args: Parameters<typeof insertTool.execute>) =>
99 stripWriteResultMeta(await insertTool.execute(...args));
1010
src/tools/replace.test.ts+1−1
@@ -4,7 +4,7 @@ import { createTestHelpers } from "./test-helpers.ts";
44 import { stripWriteResultMeta } from "./write-result.ts";
55
66 const { setup, teardown, write, read, anchor, getDir } = createTestHelpers();
7-// P3: diff is deferred; strip meta before asserting on public fields.
7+// diff is deferred; strip meta before asserting on public fields.
88 const execute = async (...args: Parameters<typeof replaceTool.execute>) =>
99 stripWriteResultMeta(await replaceTool.execute(...args));
1010
src/tools/shared.ts+1−1
@@ -62,7 +62,7 @@ export async function applyFileEdit(
6262 await snapshotCallback?.(filePath);
6363 await Bun.write(filePath, updated);
6464
65- // P3: diff deferred to finalizeWriteResult (hook path) or stripWriteResultMeta
65+ // diff deferred to finalizeWriteResult (hook path) or stripWriteResultMeta
6666 // (no-hook path) to avoid computing it twice on every write in repos with hooks.
6767 return {
6868 path: relPath,
src/tools/write-result.ts+2−2
@@ -27,8 +27,8 @@ export function stripWriteResultMeta<
2727
2828 /**
2929 * Hook path: re-read the file after the hook ran and compute the diff against
30- * the original content. This replaces any diff that would have been computed
31- * before the hook (P3: intermediate diff removed from applyFileEdit).
30+ * the original content. This generates the final diff against the post-hook file,
31+ * replacing the intermediate diff that was removed from applyFileEdit.
3232 */
3333 export async function finalizeWriteResult<T extends FinalizableWriteResult>(
3434 result: T,