@sayknow-cli/coding-agent 0.7.17 → 0.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/types/decisions/prompt-triage.d.ts +7 -1
  3. package/dist/types/defaults/skc-ui-skills.d.ts +1 -1
  4. package/dist/types/hooks/ui-skill-keywords.d.ts +4 -3
  5. package/dist/types/modes/controllers/ssh-command-controller.d.ts +5 -0
  6. package/dist/types/sdk/host/control/operations.d.ts +2 -0
  7. package/dist/types/sdk/host/external-permissions.d.ts +47 -0
  8. package/dist/types/session/client-bridge.d.ts +1 -0
  9. package/dist/types/tui/file-list.d.ts +0 -3
  10. package/dist/types/tui/status-line.d.ts +9 -0
  11. package/package.json +9 -8
  12. package/src/decisions/prompt-triage.ts +11 -3
  13. package/src/defaults/skc/ui-skills/LICENSE.motionsites +30 -0
  14. package/src/defaults/skc/ui-skills/LICENSE.pbakaus +191 -0
  15. package/src/defaults/skc/ui-skills/NOTICE.md +22 -1
  16. package/src/defaults/skc/ui-skills/impeccable/SKILL.md +2719 -0
  17. package/src/defaults/skc/ui-skills/motionsites-web-builder/SKILL.md +697 -0
  18. package/src/defaults/skc-ui-skills.ts +10 -0
  19. package/src/hooks/ui-skill-keywords.ts +27 -6
  20. package/src/modes/acp/acp-event-mapper.ts +143 -5
  21. package/src/modes/components/ttsr-notification.ts +7 -4
  22. package/src/modes/controllers/ssh-command-controller.ts +20 -9
  23. package/src/modes/controllers/todo-command-controller.ts +13 -7
  24. package/src/modes/utils/tools-markdown.ts +12 -5
  25. package/src/prompts/agents/executor.md +1 -1
  26. package/src/prompts/system/subagent-system-prompt.md +1 -0
  27. package/src/prompts/system/system-prompt.md +7 -1
  28. package/src/prompts/tools/ask.md +5 -4
  29. package/src/sdk/host/control/operations.ts +2 -0
  30. package/src/sdk/host/external-permissions.ts +330 -0
  31. package/src/session/agent-session.ts +7 -1
  32. package/src/session/client-bridge.ts +1 -1
  33. package/src/skc-runtime/state-renderer.ts +41 -25
  34. package/src/skill-state/workflow-mutation-guard.ts +18 -8
  35. package/src/tools/gh-renderer.ts +44 -25
  36. package/src/tools/ssh.ts +2 -1
  37. package/src/tui/code-cell.ts +16 -2
  38. package/src/tui/file-list.ts +14 -3
  39. package/src/tui/status-line.ts +145 -4
@@ -9,8 +9,10 @@ import emilDesignEngSkill from "./skc/ui-skills/emil-design-eng/SKILL.md" with {
9
9
  import findAnimationOpportunitiesSkill from "./skc/ui-skills/find-animation-opportunities/SKILL.md" with {
10
10
  type: "text",
11
11
  };
12
+ import impeccableSkill from "./skc/ui-skills/impeccable/SKILL.md" with { type: "text" };
12
13
  import improveAnimationsSkill from "./skc/ui-skills/improve-animations/SKILL.md" with { type: "text" };
13
14
  import mobileNativeSkill from "./skc/ui-skills/mobile-native/SKILL.md" with { type: "text" };
15
+ import motionsitesWebBuilderSkill from "./skc/ui-skills/motionsites-web-builder/SKILL.md" with { type: "text" };
14
16
  import pickUiLibrarySkill from "./skc/ui-skills/pick-ui-library/SKILL.md" with { type: "text" };
15
17
  import prototypeSkill from "./skc/ui-skills/prototype/SKILL.md" with { type: "text" };
16
18
  import reactBitsSkill from "./skc/ui-skills/react-bits/SKILL.md" with { type: "text" };
@@ -39,6 +41,8 @@ export const BUNDLED_SKC_UI_SKILL_NAMES = [
39
41
  "ask-sonner",
40
42
  "appllama-app-design-skill",
41
43
  "react-bits",
44
+ "impeccable",
45
+ "motionsites-web-builder",
42
46
  ] as const;
43
47
 
44
48
  export type BundledSkcUiSkillName = (typeof BUNDLED_SKC_UI_SKILL_NAMES)[number];
@@ -80,6 +84,12 @@ const BUNDLED_UI_SKILL_SOURCES: readonly BundledUiSkillSource[] = [
80
84
  content: appllamaAppDesignSkill,
81
85
  },
82
86
  { name: "react-bits", relativePath: "ui-skills/react-bits/SKILL.md", content: reactBitsSkill },
87
+ { name: "impeccable", relativePath: "ui-skills/impeccable/SKILL.md", content: impeccableSkill },
88
+ {
89
+ name: "motionsites-web-builder",
90
+ relativePath: "ui-skills/motionsites-web-builder/SKILL.md",
91
+ content: motionsitesWebBuilderSkill,
92
+ },
83
93
  ];
84
94
 
85
95
  export function getEmbeddedSkcUiSkills(): Skill[] {
@@ -27,7 +27,7 @@ export interface UiSkillKeywordDefinition {
27
27
  * SKC's design center. Every frontend match loads it first, ahead of the
28
28
  * specialized lead and the craft baseline, whatever the surface.
29
29
  */
30
- export const UI_SKILL_CORE: BundledSkcUiSkillName = "stageshow";
30
+ export const UI_SKILL_CORE = "stageshow" satisfies BundledSkcUiSkillName;
31
31
 
32
32
  /** Base craft skill paired with any specialized web frontend match. */
33
33
  export const UI_SKILL_BASE: BundledSkcUiSkillName = "emil-design-eng";
@@ -115,6 +115,24 @@ export const UI_SKILL_KEYWORD_DEFINITIONS: readonly UiSkillKeywordDefinition[] =
115
115
  pattern:
116
116
  /\bapple\b[^.?!]{0,40}\b(design|motion|style|feel|hig)\b|\b(spring|gesture|drag|swipe|sheet)\b[^.?!]{0,40}\b(animation|motion|physics)\b|애플\s*(디자인|스타일|느낌)/i,
117
117
  },
118
+ {
119
+ // Impeccable's steering and evaluation vocabulary applied to a visual
120
+ // surface. The refine verbs need a UI noun nearby so "polish the API
121
+ // errors" or "harden the auth endpoint" stay out of frontend routing.
122
+ skill: "impeccable",
123
+ priority: 67,
124
+ pattern:
125
+ /\b(polish|bolder|quieter|distill|critique|harden|typeset|colorize|declutter)\b[^.?!]{0,40}\b(ui|ux|design|page|screen|layout|interface|site|website|dashboard|landing|hero|form|card|components?|typography|palette)\b|\b(ui|ux|visual) (design )?(critique|audit|review)\b|\bdesign (critique|audit)\b|\bmake it (bolder|quieter|pop)\b|\b(looks?|feels?) (too )?(bland|generic|boring)\b|\bai[- ]slop\b|\bimpeccable\b|(ui|ux)\s*(리뷰|검토|점검|감사|크리틱)|디자인\s*(리뷰|검토|점검|감사|크리틱|비평)|(화면|페이지|디자인|ui)[^.?!]{0,20}(다듬|폴리싱|밋밋|과감하게|차분하게|톤\s*다운)|ai\s*슬롭/i,
126
+ },
127
+ {
128
+ // Whole marketing surfaces: landing pages, marketing sites, cinematic
129
+ // heroes, and build prompts for Lovable/Bolt/v0. A faux product demo
130
+ // inside such a page is still built by `stageshow`, which loads first.
131
+ skill: "motionsites-web-builder",
132
+ priority: 66,
133
+ pattern:
134
+ /\blanding[- ]?pages?\b|\bmarketing (site|website|page)s?\b|\bhero sections?\b|\b(cinematic|award[- ](winning|level))\b[^.?!]{0,40}\b(site|website|page|hero|landing)\b|\b(lovable|bolt|v0)\b[^.?!]{0,40}\bprompts?\b|랜딩\s*페이지|히어로\s*섹션|마케팅\s*(사이트|페이지)|시네마틱/i,
135
+ },
118
136
  {
119
137
  skill: "animate",
120
138
  priority: 65,
@@ -232,13 +250,12 @@ export function buildUiSkillDirectiveForSkill(skill: BundledSkcUiSkillName): str
232
250
  *
233
251
  * This is the whole contract with the routing model — the skill ids alone carry
234
252
  * almost no signal, and `appllama-app-design-skill` carries actively misleading
235
- * signal. Kept next to the patterns so the two cannot drift apart.
253
+ * signal. Kept next to the patterns so the two cannot drift apart. The design
254
+ * center has no entry: every pick loads it, so it is never a routing option.
236
255
  */
237
- export const BUNDLED_UI_SKILL_MEANINGS: Record<BundledSkcUiSkillName, string> = {
238
- stageshow:
239
- "Faux product UI for marketing and docs pages: hero demos, feature cards, bento grids, cursor walkthroughs, mocked app screenshots, product shots. Every other frontend pick loads it too as the design center.",
256
+ export const BUNDLED_UI_SKILL_MEANINGS: Record<Exclude<BundledSkcUiSkillName, typeof UI_SKILL_CORE>, string> = {
240
257
  "emil-design-eng":
241
- "General web UI/UX craft: building or reviewing components, layout, spacing, typography, design systems, CSS. The default for frontend work with no more specific fit.",
258
+ "General web UI/UX craft: building or reviewing components, layout, spacing, typography, design systems, CSS, and faux product UI for marketing and docs pages (hero demos, bento grids, cursor walkthroughs, mocked app screens). The default for frontend work with no more specific fit.",
242
259
  animate:
243
260
  "Adding new motion to a web UI: animations, transitions, easing, keyframes, hover effects, micro-interactions.",
244
261
  "review-animations": "Reviewing motion that already exists and judging whether it is good.",
@@ -254,6 +271,10 @@ export const BUNDLED_UI_SKILL_MEANINGS: Record<BundledSkcUiSkillName, string> =
254
271
  "ask-sonner": "Toast notifications, specifically the Sonner library.",
255
272
  "appllama-app-design-skill": "Native app screens built with Expo or React Native — not a website viewed on a phone.",
256
273
  "react-bits": "Pre-built animated React components: animated text, animated backgrounds, cursor and scroll effects.",
274
+ impeccable:
275
+ "Steering or evaluating an existing visual design: polish, make bolder or quieter, distill, typography, color, layout, UX copy, hardening, design critique or audit, removing AI slop.",
276
+ "motionsites-web-builder":
277
+ "Building a whole landing page, marketing site or cinematic hero section, or writing a build prompt for Lovable, Bolt or v0.",
257
278
  };
258
279
 
259
280
  /**
@@ -6,6 +6,7 @@ import type {
6
6
  ToolCallLocation,
7
7
  ToolKind,
8
8
  } from "@agentclientprotocol/sdk";
9
+ import { sanitizeText } from "@sayknow-cli/utils";
9
10
  import type { AgentSessionEvent } from "../../session/agent-session";
10
11
  import { resolveToCwd } from "../../tools/path-utils";
11
12
  import type { TodoStatus } from "../../tools/todo-write";
@@ -550,6 +551,139 @@ function extractTodoEntries(phases: unknown[]): Array<{ content: string; status:
550
551
  function isTodoStatus(status: unknown): status is TodoStatus {
551
552
  return status === "pending" || status === "in_progress" || status === "completed" || status === "abandoned";
552
553
  }
554
+
555
+ /** Shallow copies stay recursive. Deeper rawInput values use one iterative pass. */
556
+ const CLIENT_VALUE_MAX_DEPTH = 64;
557
+
558
+ function isClientContainer(value: object): boolean {
559
+ if (Array.isArray(value)) return true;
560
+ const prototype = Object.getPrototypeOf(value);
561
+ return prototype === Object.prototype || prototype === null;
562
+ }
563
+
564
+ /** Strip terminal controls from tool-argument text copied into a session update. */
565
+ function sanitizeClientValue(value: unknown): unknown {
566
+ return sanitizeClientValueWalk(value, new WeakMap(), 0);
567
+ }
568
+
569
+ function sanitizeClientValueWalk(value: unknown, seen: WeakMap<object, unknown>, depth: number): unknown {
570
+ if (typeof value === "string") {
571
+ const clean = sanitizeText(value);
572
+ return clean === value ? value : clean;
573
+ }
574
+ if (typeof value !== "object" || value === null) return value;
575
+ if (depth >= CLIENT_VALUE_MAX_DEPTH) return sanitizeClientTail(value, seen);
576
+ const existing = seen.get(value);
577
+ if (existing !== undefined) return existing;
578
+ if (Array.isArray(value)) {
579
+ const next: unknown[] = [];
580
+ seen.set(value, next);
581
+ let changed = false;
582
+ for (const item of value) {
583
+ const clean = sanitizeClientValueWalk(item, seen, depth + 1);
584
+ if (clean !== item) changed = true;
585
+ next.push(clean);
586
+ }
587
+ if (!changed) seen.set(value, value);
588
+ return changed ? next : value;
589
+ }
590
+ if (!isClientContainer(value)) return value;
591
+ const next = Object.create(Object.getPrototypeOf(value)) as Record<string, unknown>;
592
+ seen.set(value, next);
593
+ let changed = false;
594
+ for (const key of Object.keys(value)) {
595
+ const current = (value as Record<string, unknown>)[key];
596
+ const clean = sanitizeClientValueWalk(current, seen, depth + 1);
597
+ if (clean !== current) changed = true;
598
+ Object.defineProperty(next, key, { value: clean, enumerable: true, writable: true, configurable: true });
599
+ }
600
+ if (!changed) seen.set(value, value);
601
+ return changed ? next : value;
602
+ }
603
+
604
+ type ClientTailFrame = {
605
+ source: object;
606
+ keys: readonly string[] | null;
607
+ index: number;
608
+ box: object;
609
+ changed: boolean;
610
+ holdKey?: string | number;
611
+ };
612
+
613
+ /** Iterative copy of one nested rawInput value. Each container is entered once. Keys are copied as-is. */
614
+ function sanitizeClientTail(root: object, seen: WeakMap<object, unknown>): unknown {
615
+ const cached = seen.get(root);
616
+ if (cached !== undefined) return cached;
617
+ if (!isClientContainer(root)) return root;
618
+
619
+ const open = (node: object): ClientTailFrame => {
620
+ const box = Array.isArray(node) ? [] : Object.create(Object.getPrototypeOf(node));
621
+ seen.set(node, box);
622
+ return {
623
+ source: node,
624
+ keys: Array.isArray(node) ? null : Object.keys(node),
625
+ index: 0,
626
+ box,
627
+ changed: false,
628
+ };
629
+ };
630
+ const put = (frame: ClientTailFrame, key: string | number, child: unknown, dirty: boolean): void => {
631
+ if (Array.isArray(frame.box)) (frame.box as unknown[]).push(child);
632
+ else {
633
+ Object.defineProperty(frame.box, String(key), {
634
+ value: child,
635
+ enumerable: true,
636
+ writable: true,
637
+ configurable: true,
638
+ });
639
+ }
640
+ if (dirty) frame.changed = true;
641
+ };
642
+
643
+ const stack = [open(root)];
644
+ let finished: unknown = stack[0]!.box;
645
+ while (stack.length > 0) {
646
+ const frame = stack[stack.length - 1]!;
647
+ const length = frame.keys === null ? (frame.source as unknown[]).length : frame.keys.length;
648
+ if (frame.index >= length) {
649
+ finished = frame.changed ? frame.box : frame.source;
650
+ if (!frame.changed) seen.set(frame.source, frame.source);
651
+ stack.pop();
652
+ const parent = stack[stack.length - 1];
653
+ if (parent && parent.holdKey !== undefined) {
654
+ put(parent, parent.holdKey, finished, finished !== frame.source);
655
+ parent.holdKey = undefined;
656
+ }
657
+ continue;
658
+ }
659
+ const key = frame.keys === null ? frame.index : frame.keys[frame.index]!;
660
+ const child =
661
+ frame.keys === null
662
+ ? (frame.source as unknown[])[frame.index]
663
+ : (frame.source as Record<string, unknown>)[key];
664
+ frame.index += 1;
665
+ if (typeof child === "string") {
666
+ const clean = sanitizeText(child);
667
+ put(frame, key, clean, clean !== child);
668
+ continue;
669
+ }
670
+ if (typeof child === "object" && child !== null) {
671
+ const found = seen.get(child);
672
+ if (found !== undefined) {
673
+ put(frame, key, found, found !== child);
674
+ continue;
675
+ }
676
+ if (isClientContainer(child)) {
677
+ frame.holdKey = key;
678
+ stack.push(open(child));
679
+ continue;
680
+ }
681
+ }
682
+ put(frame, key, child, false);
683
+ }
684
+ return finished;
685
+ }
686
+
553
687
  export function buildToolCallStartUpdate(input: {
554
688
  toolCallId: string;
555
689
  toolName: string;
@@ -564,7 +698,7 @@ export function buildToolCallStartUpdate(input: {
564
698
  title: buildToolTitle(input.toolName, input.args, input.intent),
565
699
  kind: mapToolKind(input.toolName),
566
700
  status: input.status ?? "pending",
567
- rawInput: input.args,
701
+ rawInput: sanitizeClientValue(input.args),
568
702
  };
569
703
  const content = buildToolStartContent(input.toolName, input.args);
570
704
  if (content.length > 0) {
@@ -604,7 +738,9 @@ function buildToolStartContent(toolName: string, args: unknown): ToolCallContent
604
738
  return [];
605
739
  }
606
740
  const command = extractStringProperty<CommandContainer>(args, "command");
607
- return command ? [textToolCallContent(`$ ${command}`)] : [];
741
+ if (!command) return [];
742
+ const safeCommand = sanitizeText(command);
743
+ return safeCommand.length > 0 ? [textToolCallContent(`$ ${safeCommand}`)] : [];
608
744
  }
609
745
 
610
746
  function mergeToolUpdateContent(startContent: ToolCallContent[], resultContent: ToolCallContent[]): ToolCallContent[] {
@@ -645,7 +781,8 @@ function isCommandToolName(toolName: string): boolean {
645
781
  function buildToolTitle(toolName: string, args: unknown, intent: string | undefined): string {
646
782
  const trimmedIntent = intent?.trim();
647
783
  if (trimmedIntent) {
648
- return trimmedIntent;
784
+ const safeIntent = sanitizeText(trimmedIntent).trim();
785
+ if (safeIntent.length > 0) return safeIntent;
649
786
  }
650
787
 
651
788
  const subject =
@@ -654,10 +791,11 @@ function buildToolTitle(toolName: string, args: unknown, intent: string | undefi
654
791
  extractStringProperty<PatternContainer>(args, "pattern") ??
655
792
  extractStringProperty<QueryContainer>(args, "query");
656
793
  if (subject) {
657
- return `${toolName}: ${subject}`;
794
+ const safeSubject = sanitizeText(subject);
795
+ if (safeSubject.length > 0) return sanitizeText(`${toolName}: ${safeSubject}`);
658
796
  }
659
797
 
660
- return toolName;
798
+ return sanitizeText(toolName);
661
799
  }
662
800
 
663
801
  /**
@@ -1,4 +1,5 @@
1
1
  import { Box, Container, Spacer, Text } from "@sayknow-cli/tui";
2
+ import { sanitizeText } from "@sayknow-cli/utils";
2
3
  import type { Rule } from "../../capability/rule";
3
4
  import { theme } from "../../modes/theme/theme";
4
5
 
@@ -36,8 +37,10 @@ export class TtsrNotificationComponent extends Container {
36
37
  #rebuild(): void {
37
38
  this.#box.clear();
38
39
 
39
- // Build header: warning symbol + rule name + rewind icon
40
- const ruleNames = this.rules.map(r => theme.bold(r.name)).join(", ");
40
+ // Build header: warning symbol + rule name + rewind icon.
41
+ // Sanitize before theme styling and the two-line cut so a control
42
+ // sequence cannot reach the terminal, including one split by truncation.
43
+ const ruleNames = this.rules.map(r => theme.bold(sanitizeText(r.name))).join(", ");
41
44
  const label = this.rules.length === 1 ? "rule" : "rules";
42
45
  const header = `${theme.icon.warning} Injecting ${label}: ${ruleNames}`;
43
46
 
@@ -52,7 +55,7 @@ export class TtsrNotificationComponent extends Container {
52
55
  if (desc) {
53
56
  this.#box.addChild(new Spacer(1));
54
57
 
55
- let displayText = desc.trim();
58
+ let displayText = sanitizeText(desc).trim();
56
59
  if (!this.#expanded) {
57
60
  // Truncate to first 2 lines
58
61
  const lines = displayText.split("\n");
@@ -70,7 +73,7 @@ export class TtsrNotificationComponent extends Container {
70
73
  if (!this.#expanded) {
71
74
  const hasMoreContent = this.rules.some(r => {
72
75
  const desc = r.description || r.content;
73
- return desc && desc.split("\n").length > 2;
76
+ return !!desc && sanitizeText(desc).trim().split("\n").length > 2;
74
77
  });
75
78
  if (hasMoreContent) {
76
79
  this.#box.addChild(new Text(theme.italic(" (ctrl+o to expand)"), 0, 0));
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Handles /ssh subcommands for managing SSH host configurations.
5
5
  */
6
- import { getProjectDir, getSSHConfigPath } from "@sayknow-cli/utils";
6
+ import { getProjectDir, getSSHConfigPath, sanitizeDisplayLine } from "@sayknow-cli/utils";
7
7
  import { type SSHHost, sshCapability } from "../../capability/ssh";
8
8
  import { loadCapability } from "../../discovery";
9
9
  import { addSSHHost, readSSHConfigFile, removeSSHHost, type SSHHostConfig } from "../../ssh/config-writer";
@@ -18,6 +18,14 @@ import {
18
18
  showCommandMessage,
19
19
  } from "./command-controller-shared";
20
20
 
21
+ /**
22
+ * One terminal row for an untrusted `/ssh list` field.
23
+ * Ordinary names, hosts, usernames, and ports are unchanged.
24
+ */
25
+ export function sshListTerminalLabel(value: string): string {
26
+ return sanitizeDisplayLine(value);
27
+ }
28
+
21
29
  export class SSHCommandController {
22
30
  constructor(private ctx: InteractiveModeContext) {}
23
31
 
@@ -287,7 +295,7 @@ export class SSHCommandController {
287
295
  for (const name of userHosts) {
288
296
  const config = userConfig.hosts![name];
289
297
  const details = this.#formatHostDetails(config);
290
- lines.push(` ${theme.fg("accent", name)} ${details}`);
298
+ lines.push(` ${theme.fg("accent", sshListTerminalLabel(name))} ${details}`);
291
299
  }
292
300
  lines.push("");
293
301
  }
@@ -298,7 +306,7 @@ export class SSHCommandController {
298
306
  for (const name of projectHosts) {
299
307
  const config = projectConfig.hosts![name];
300
308
  const details = this.#formatHostDetails(config);
301
- lines.push(` ${theme.fg("accent", name)} ${details}`);
309
+ lines.push(` ${theme.fg("accent", sshListTerminalLabel(name))} ${details}`);
302
310
  }
303
311
  lines.push("");
304
312
  }
@@ -308,7 +316,10 @@ export class SSHCommandController {
308
316
  for (const { providerName, shortPath, items: hosts } of groupBySource(discoveredHosts, h => h._source)) {
309
317
  lines.push(
310
318
  theme.fg("accent", "Discovered") +
311
- theme.fg("muted", ` (${providerName}: ${shortPath}):`) +
319
+ theme.fg(
320
+ "muted",
321
+ ` (${sshListTerminalLabel(providerName)}: ${sshListTerminalLabel(shortPath)}):`,
322
+ ) +
312
323
  theme.fg("dim", " read-only"),
313
324
  );
314
325
  for (const host of hosts) {
@@ -317,7 +328,7 @@ export class SSHCommandController {
317
328
  username: host.username,
318
329
  port: host.port,
319
330
  });
320
- lines.push(` ${theme.fg("accent", host.name)} ${details}`);
331
+ lines.push(` ${theme.fg("accent", sshListTerminalLabel(host.name))} ${details}`);
321
332
  }
322
333
  lines.push("");
323
334
  }
@@ -332,11 +343,11 @@ export class SSHCommandController {
332
343
  /**
333
344
  * Format host details (host, user, port) for display
334
345
  */
335
- #formatHostDetails(config: { host?: string; username?: string; port?: number }): string {
346
+ #formatHostDetails(config: { host?: string; username?: string; port?: number | string }): string {
336
347
  const parts: string[] = [];
337
- if (config.host) parts.push(config.host);
338
- if (config.username) parts.push(`user=${config.username}`);
339
- if (config.port && config.port !== 22) parts.push(`port=${config.port}`);
348
+ if (config.host) parts.push(sshListTerminalLabel(config.host));
349
+ if (config.username) parts.push(`user=${sshListTerminalLabel(config.username)}`);
350
+ if (config.port && config.port !== 22) parts.push(`port=${sshListTerminalLabel(String(config.port))}`);
340
351
  return theme.fg("dim", parts.length > 0 ? `[${parts.join(", ")}]` : "");
341
352
  }
342
353
 
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs/promises";
2
+ import { sanitizeText } from "@sayknow-cli/utils";
2
3
  import { resolveToCwd } from "../../tools/path-utils";
3
4
  import {
4
5
  applyOpsToPhases,
@@ -27,6 +28,11 @@ const USAGE = [
27
28
  " /todo rm [<task|phase>] Remove task/phase/all",
28
29
  ].join("\n");
29
30
 
31
+ // Session todo text is drawn with showStatus, which does not strip terminal controls.
32
+ function todoStatusText(text: string): string {
33
+ return sanitizeText(text);
34
+ }
35
+
30
36
  // =============================================================================
31
37
  // Argument tokenizer (respects double-quoted strings)
32
38
  // =============================================================================
@@ -196,7 +202,7 @@ export class TodoCommandController {
196
202
  this.ctx.showStatus("No todos. Use /todo append <task> to start one.");
197
203
  return;
198
204
  }
199
- this.ctx.showStatus(phasesToMarkdown(phases).trimEnd());
205
+ this.ctx.showStatus(todoStatusText(phasesToMarkdown(phases).trimEnd()));
200
206
  }
201
207
 
202
208
  #copyMarkdown(): void {
@@ -296,7 +302,7 @@ export class TodoCommandController {
296
302
  });
297
303
 
298
304
  this.#commit(next, `/todo append → ${targetPhase.name}`);
299
- this.ctx.showStatus(`Appended to ${targetPhase.name}: ${finalContent}`);
305
+ this.ctx.showStatus(todoStatusText(`Appended to ${targetPhase.name}: ${finalContent}`));
300
306
  }
301
307
 
302
308
  // ------------------------------------------------------------- start / done / drop / rm
@@ -318,7 +324,7 @@ export class TodoCommandController {
318
324
  return;
319
325
  }
320
326
  this.#commit(phases, `/todo start ${hit.task.content}`);
321
- this.ctx.showStatus(`Started: ${hit.task.content}`);
327
+ this.ctx.showStatus(todoStatusText(`Started: ${hit.task.content}`));
322
328
  }
323
329
 
324
330
  #mutateStatus(rest: string, target: "completed" | "abandoned"): void {
@@ -345,7 +351,7 @@ export class TodoCommandController {
345
351
  return;
346
352
  }
347
353
  this.#commit(phases, `/todo ${op} ${taskHit.task.content}`);
348
- this.ctx.showStatus(`Marked ${target}: ${taskHit.task.content}`);
354
+ this.ctx.showStatus(todoStatusText(`Marked ${target}: ${taskHit.task.content}`));
349
355
  return;
350
356
  }
351
357
 
@@ -357,7 +363,7 @@ export class TodoCommandController {
357
363
  return;
358
364
  }
359
365
  this.#commit(phases, `/todo ${op} ${phaseHit.name}`);
360
- this.ctx.showStatus(`Marked phase ${phaseHit.name} ${target}.`);
366
+ this.ctx.showStatus(todoStatusText(`Marked phase ${phaseHit.name} ${target}.`));
361
367
  return;
362
368
  }
363
369
 
@@ -380,7 +386,7 @@ export class TodoCommandController {
380
386
  return;
381
387
  }
382
388
  this.#commit(phases, `/todo rm ${taskHit.task.content}`);
383
- this.ctx.showStatus(`Removed: ${taskHit.task.content}`);
389
+ this.ctx.showStatus(todoStatusText(`Removed: ${taskHit.task.content}`));
384
390
  return;
385
391
  }
386
392
  const phaseHit = findPhaseFuzzy(current, trimmed);
@@ -391,7 +397,7 @@ export class TodoCommandController {
391
397
  return;
392
398
  }
393
399
  this.#commit(phases, `/todo rm ${phaseHit.name}`);
394
- this.ctx.showStatus(`Removed phase: ${phaseHit.name}`);
400
+ this.ctx.showStatus(todoStatusText(`Removed phase: ${phaseHit.name}`));
395
401
  return;
396
402
  }
397
403
  this.ctx.showError(`No task or phase matched "${trimmed}".`);
@@ -1,14 +1,20 @@
1
+ import { sanitizeText } from "@sayknow-cli/utils";
1
2
  import type { Tool } from "../../tools";
2
3
 
3
4
  export interface ToolsMarkdownBindings {
4
5
  tools: ReadonlyArray<Pick<Tool, "description" | "name">>;
5
6
  }
6
7
 
8
+ /**
9
+ * Flatten breaks before stripping controls so a carriage return cannot stay in
10
+ * the cell, then escape pipes. `sanitizeText` removes the sequence, not only ESC.
11
+ */
12
+ function neutralizeCellText(value: string): string {
13
+ return sanitizeText(value.replace(/\r?\n+/g, " ").replace(/\r/g, " "));
14
+ }
15
+
7
16
  function escapeTableCell(value: string): string {
8
- return value
9
- .replace(/\|/g, "\\|")
10
- .replace(/\r?\n+/g, " ")
11
- .trim();
17
+ return neutralizeCellText(value).replace(/\|/g, "\\|").trim();
12
18
  }
13
19
 
14
20
  export function buildToolsMarkdown(bindings: ToolsMarkdownBindings): string {
@@ -20,8 +26,9 @@ export function buildToolsMarkdown(bindings: ToolsMarkdownBindings): string {
20
26
  "| Tool | Description |",
21
27
  "|------|-------------|",
22
28
  ...bindings.tools.map(tool => {
29
+ const name = neutralizeCellText(tool.name);
23
30
  const description = escapeTableCell(tool.description) || "No description provided.";
24
- return `| \`${tool.name}\` | ${description} |`;
31
+ return `| \`${name}\` | ${description} |`;
25
32
  }),
26
33
  ].join("\n");
27
34
  }
@@ -21,7 +21,7 @@ Explore just enough context, implement the smallest correct change, and leave co
21
21
  - Explore first, ask last. Ask only when progress is impossible or the next decision is destructive, credentialed, external-production, or materially scope-changing.
22
22
  - Use normal repository inspection for file/symbol/pattern lookup. Do not recommend deprecated repository-explore workflows.
23
23
  - Respect repository instructions, especially no new dependencies unless explicitly requested.
24
- - For frontend UI/UX, animation, visual polish, component-craft, or faux product UI work, invoke `stageshow` first (the design center for every frontend surface, real product UI included), then the matching bundled UI skill (`emil-design-eng`, `animate`, `review-animations`, `improve-animations`, `find-animation-opportunities`, `pick-ui-library`, `prototype`, `mobile-native`, `appllama-app-design-skill` for native Expo/React Native screens, `ask-sonner`, `apple-design`, `animation-vocabulary`) before implementing. Do not ask the user to install these skills.
24
+ - For frontend UI/UX, animation, visual polish, component-craft, or faux product UI work, invoke `stageshow` first (the design center for every frontend surface, real product UI included), then the matching bundled UI skill (`emil-design-eng`, `impeccable` for polish/critique/audit passes, `motionsites-web-builder` for landing pages and marketing sites, `animate`, `review-animations`, `improve-animations`, `find-animation-opportunities`, `pick-ui-library`, `prototype`, `mobile-native`, `appllama-app-design-skill` for native Expo/React Native screens, `ask-sonner`, `apple-design`, `animation-vocabulary`) before implementing. Do not ask the user to install these skills.
25
25
  </constraints>
26
26
 
27
27
  <execution_loop>
@@ -40,6 +40,7 @@ Use `irc` to DM `0-Main` on unexpected state instead of guessing; coordinate bef
40
40
 
41
41
  [COMPLETION]
42
42
  No TODO tracking, no progress updates. Execute, call `yield`, done.
43
+ The one exception: when you measure comparable numbers (sizes, timings, counts per variant), you MAY show them with `report_metric`. It is display-only, so the same numbers still belong in `yield`.
43
44
 
44
45
  While work remains, always continue with another tool call — investigate, edit, run, verify. Save narrative for the final `yield` payload.
45
46
 
@@ -26,7 +26,7 @@ Optimize for correctness first, maintainability second, and brevity third. Prefe
26
26
  - Clear work with non-trivial architecture or sequencing risk uses `/skill:ralplan --deliberate` and stops pending approval.
27
27
  - Use `/skill:ultragoal` for durable goal ledgers and `/skill:team` for approved coordinated persistent work.
28
28
  - Delegate large implementation slices to `executor`; use `planner`, `architect`, or `critic` for bounded planning and review.
29
- - Frontend UI/UX work (web, dashboard, mobile web, native app screens, animation, visual polish, component craft, faux product UI) MUST invoke `stageshow` first — the design center for every frontend surface, real product UI included — and then the matching bundled UI skill before writing or reviewing that surface: `emil-design-eng` for general UI/UX, `animate` for new motion, `review-animations` / `improve-animations` / `find-animation-opportunities` for motion review/audit/opportunity, `pick-ui-library` for library choice, `prototype` for variant exploration, `mobile-native` for phone-web native feel, `appllama-app-design-skill` for native Expo/React Native app screens, `ask-sonner` for Sonner toasts, `apple-design` for Apple-style motion/materials, `animation-vocabulary` for naming a motion effect. These are bundled; do not ask the user to install them. They are not workflow skills and do not use `skc state`.
29
+ - Frontend UI/UX work (web, dashboard, mobile web, native app screens, animation, visual polish, component craft, faux product UI) MUST invoke `stageshow` first — the design center for every frontend surface, real product UI included — and then the matching bundled UI skill before writing or reviewing that surface: `emil-design-eng` for general UI/UX, `impeccable` for steering or evaluating a design (polish, bolder/quieter, distill, typography, color, layout, critique, audit), `motionsites-web-builder` for landing pages, marketing sites, cinematic heroes and Lovable/Bolt/v0 build prompts, `animate` for new motion, `review-animations` / `improve-animations` / `find-animation-opportunities` for motion review/audit/opportunity, `pick-ui-library` for library choice, `prototype` for variant exploration, `mobile-native` for phone-web native feel, `appllama-app-design-skill` for native Expo/React Native app screens, `ask-sonner` for Sonner toasts, `apple-design` for Apple-style motion/materials, `animation-vocabulary` for naming a motion effect. These are bundled; do not ask the user to install them. They are not workflow skills and do not use `skc state`.
30
30
  - Active skills are authoritative: never ignore an invoked skill; read the full skill text and follow it exactly.
31
31
  - Before explicit execution approval, planning and interview workflows NEVER edit product source, run mutating shell commands, commit, push, open PRs, or delegate implementation.
32
32
  </routing>
@@ -36,6 +36,7 @@ Optimize for correctness first, maintainability second, and brevity third. Prefe
36
36
  <communication>
37
37
  - Be concise and information-dense.
38
38
  - Do not narrate progress, ceremony, timing, scope inflation, or session limits.
39
+ - Conciseness never means a silent `ask`: before opening a selector, state in visible text what you found, why the decision is the user's, and what each option changes.
39
40
  - If the user's intent is clear, act without asking. Ask only when the next step is destructive or requires a missing choice that materially changes the outcome.
40
41
  - Treat an informational question as a request for an answer, not implicit permission to take action; answer read-only unless the user explicitly asks for a concrete change or command execution.
41
42
  - When the user proposes something wrong, say what breaks and what to do instead once; then defer to their call.
@@ -217,11 +218,16 @@ For image understanding, call `{{toolRefs.read}}` on the image path; the image i
217
218
  - Do not yield non-trivial work without proof: focused tests, e2e, browsing, QA, or an explicit reason verification cannot be run.
218
219
  - Test observable behavior, edge values, branch conditions, invariants, and error handling.
219
220
  - Do not test defaults or tautologies.
221
+ - When a second fix built on the same assumption fails the same check, test the assumption directly before writing a third fix.
222
+ - Before attributing a measured result (speedup, regression, latency, eval score) to a change, identify the bottleneck or confounder that bounds it and rule out that it measured something else; label attribution you could not verify.
223
+ - When a change alters a shared data contract (key, identifier, serialized format, schema, default), also check the consumers symbol search misses: persisted data, other languages, config and flags, and pinned dependency source.
220
224
  </verification>
221
225
  </workflow>
222
226
 
223
227
  {{#unless subagent}}
224
228
  <soul>
229
+ - **Routing comes first** - The action bias below never overrides `<routing>`: informational questions ("why is X failing?") and judgment asks ("what do you think of X?") stay answer-only and read-only unless the user explicitly asks for a change.
230
+
225
231
  You carry the soul of a senior staff engineer who has shipped and owned load-bearing systems for years. This is your character, not a checklist:
226
232
 
227
233
  - **Craft.** You care about correct, boring, maintainable code and a clean diff in the right place. You have no patience for cargo-culting, busywork, ceremony, or decoration.
@@ -13,19 +13,20 @@ Asks user when you need clarification or input during task execution.
13
13
  </instruction>
14
14
 
15
15
  <caution>
16
- - Provide 2-5 concise, distinct options
16
+ - Provide 2-5 distinct options. Keep labels short; put premise and trade-offs in the question body, not the labels.
17
17
  </caution>
18
18
 
19
19
  <critical>
20
+ - **Explain before you ask.** Before calling `ask`, explain the decision in your visible reply: what you found, why you cannot resolve it yourself, what each option changes (consequences, risk, reversibility), and your recommendation with its reason. The `ask` call must never be the first thing the user sees about this decision; conciseness rules do not waive this explanation. Also keep each question body self-contained (one or two sentences of premise and trade-offs) so it can be answered even if the preceding text scrolled away.
20
21
  - **Default to action.** Resolve ambiguity yourself using repo conventions, existing patterns, and reasonable defaults. Exhaust existing sources (code, configs, docs, history) before asking. Only ask when options have materially different tradeoffs the user must decide.
21
22
  - **If multiple choices are acceptable**, pick the most conservative/standard option and proceed; state the choice.
22
- - **Do NOT include "Other" option** — UI automatically adds "Other (type your own)" to every question.
23
+ - **Do NOT include the automatic custom-input control or labels that imitate it** such as "Other (type your own)", "Other (specify)", "type your own", "custom input", or "직접 입력" — UI automatically adds "Other (type your own)" to every question. A plain domain value such as "Other" is allowed when it is a genuine answer, not a request for free text. To collect free text, ask for it in the question body and rely on the automatic Other/custom-input control instead of adding a fake option.
23
24
  </critical>
24
25
 
25
26
  <examples>
26
27
  # Single question
27
- questions: [{"id": "auth_method", "question": "Which authentication method should this API use?", "options": [{"label": "JWT"}, {"label": "OAuth2"}, {"label": "Session cookies"}], "recommended": 0}]
28
+ questions: [{"id": "auth_method", "question": "The API has no auth yet and both web and CLI clients call it. JWT stays stateless and suits the CLI; session cookies are simpler for the web app but need a shared store to scale. Which authentication method should it use?", "options": [{"label": "JWT"}, {"label": "OAuth2"}, {"label": "Session cookies"}], "recommended": 0}]
28
29
 
29
30
  # Multiple questions
30
- questions: [{"id": "storage_type", "question": "Which storage backend?", "options": [{"label": "SQLite"}, {"label": "PostgreSQL"}]}, {"id": "auth_method", "question": "Which auth method?", "options": [{"label": "JWT"}, {"label": "Session cookies"}]}]
31
+ questions: [{"id": "storage_type", "question": "The service runs as a single process today. SQLite needs no extra infrastructure but serializes writes; PostgreSQL handles concurrent writers but must be provisioned. Which storage backend?", "options": [{"label": "SQLite"}, {"label": "PostgreSQL"}]}, {"id": "auth_method", "question": "Sessions must be revocable immediately after a permission change. Session cookies support that directly; JWTs need a denylist to do the same. Which auth method?", "options": [{"label": "JWT"}, {"label": "Session cookies"}]}]
31
32
  </examples>
@@ -29,6 +29,8 @@ export interface ControlSurface {
29
29
  setThinking(level: ControlValue): Promise<ControlValue> | ControlValue;
30
30
  cycleThinking(): Promise<ControlValue> | ControlValue;
31
31
  setPermissionMode(mode: ControlValue): Promise<ControlValue> | ControlValue;
32
+ configurePermissionChannel?(input: ControlInput): Promise<ControlValue> | ControlValue;
33
+ respondPermission?(input: ControlInput): ControlValue;
32
34
  setQueueMode(kind: string, mode: ControlValue): Promise<ControlValue> | ControlValue;
33
35
  runCompaction(): Promise<ControlValue> | ControlValue;
34
36
  setAutoCompaction(on: boolean): Promise<ControlValue> | ControlValue;