Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(cli): reject --description-file/--content-file paths outside the workdir (MUL-4252) (#5167)

Bohan Jiang3b7eafc3ad89
diff --git a/server/cmd/multica/cmd_issue.go b/server/cmd/multica/cmd_issue.go
index 61dd91c888..bc721d27fc 100644
--- a/server/cmd/multica/cmd_issue.go
+++ b/server/cmd/multica/cmd_issue.go
@@ -9,6 +9,7 @@ import (
"net/http"
"net/url"
"os"
+ "path/filepath"
"sort"
"strconv"
"strings"
@@ -69,6 +70,9 @@ func resolveTextFlag(cmd *cobra.Command, flagName string) (string, bool, error)
return body, true, nil
}
if filePath != "" {
+ if err := ensureFileFlagWithinWorkdir(cmd, fileFlag, flagName, filePath); err != nil {
+ return "", false, err
+ }
data, err := os.ReadFile(filePath)
if err != nil {
return "", false, fmt.Errorf("read file for --%s: %w", fileFlag, err)
@@ -85,6 +89,79 @@ func resolveTextFlag(cmd *cobra.Command, flagName string) (string, bool, error)
return util.UnescapeBackslashEscapes(inline), true, nil
}
+// ensureFileFlagWithinWorkdir fails closed when a --<name>-file path resolves
+// outside the current working directory, unless --allow-external-file is set.
+//
+// Agent task workdirs are isolated per profile and per task; machine-shared
+// scratch paths like /tmp are not. MUL-4252 traced a cross-environment context
+// leak to exactly this gap: a quick-create run wrote its description to a fixed
+// /tmp/desc.md, the write silently failed because a *different* environment's
+// run had left a stale file there minutes earlier, and --description-file then
+// fed that stale content into the new issue. Requiring the file to live under
+// the workdir turns "silently read another run's file" into a loud command
+// failure — an "incorrect content" bug becomes a "command errored" bug.
+func ensureFileFlagWithinWorkdir(cmd *cobra.Command, fileFlag, flagName, filePath string) error {
+ if allow, _ := cmd.Flags().GetBool("allow-external-file"); allow {
+ return nil
+ }
+ within, err := fileWithinWorkingDir(filePath)
+ if err != nil {
+ return fmt.Errorf("resolve --%s path %q: %w", fileFlag, filePath, err)
+ }
+ if !within {
+ return fmt.Errorf(
+ "--%s path %q resolves outside the current working directory; "+
+ "write agent temp files inside the task workdir (e.g. ./%s.md) rather than machine-shared "+
+ "paths like /tmp, where another run's stale file can be read by mistake. "+
+ "Pass --allow-external-file to override.",
+ fileFlag, filePath, flagName)
+ }
+ return nil
+}
+
+// fileWithinWorkingDir reports whether filePath resolves to a location inside
+// the process working directory. Both sides are symlink-resolved so aliased
+// roots (e.g. macOS /tmp -> /private/tmp) and symlinks planted inside the
+// workdir fail closed. A path that does not exist yet is judged on its cleaned
+// absolute form so the caller's os.ReadFile still surfaces the real not-found
+// error afterwards.
+func fileWithinWorkingDir(filePath string) (bool, error) {
+ cwd, err := os.Getwd()
+ if err != nil {
+ return false, err
+ }
+ base := cwd
+ if resolved, err := filepath.EvalSymlinks(cwd); err == nil {
+ base = resolved
+ }
+ abs := filePath
+ if !filepath.IsAbs(abs) {
+ abs = filepath.Join(cwd, abs)
+ }
+ if resolved, err := filepath.EvalSymlinks(abs); err == nil {
+ abs = resolved
+ } else {
+ // The file may not exist yet (the caller's os.ReadFile surfaces that).
+ // Resolve symlinks on the parent directory instead so the comparison
+ // base and the candidate share the same canonical prefix — otherwise a
+ // workdir under a symlinked root (e.g. macOS temp dirs) would falsely
+ // read as "outside". A missing parent falls back to a plain clean.
+ if resolvedParent, perr := filepath.EvalSymlinks(filepath.Dir(abs)); perr == nil {
+ abs = filepath.Join(resolvedParent, filepath.Base(abs))
+ } else {
+ abs = filepath.Clean(abs)
+ }
+ }
+ rel, err := filepath.Rel(base, abs)
+ if err != nil {
+ return false, err
+ }
+ if rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator)) {
+ return false, nil
+ }
+ return true, nil
+}
+
var issueCmd = &cobra.Command{
Use: "issue",
Short: "Work with issues",
@@ -383,7 +460,8 @@ func init() {
issueCreateCmd.Flags().String("title", "", "Issue title (required)")
issueCreateCmd.Flags().String("description", "", "Issue description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
issueCreateCmd.Flags().Bool("description-stdin", false, "Read issue description from stdin (preserves multi-line content verbatim)")
- issueCreateCmd.Flags().String("description-file", "", "Read issue description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes)")
+ issueCreateCmd.Flags().String("description-file", "", "Read issue description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
+ issueCreateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
issueCreateCmd.Flags().String("status", "", "Issue status")
issueCreateCmd.Flags().String("priority", "", "Issue priority")
issueCreateCmd.Flags().String("assignee", "", "Assignee name (member, agent, or squad; fuzzy match)")
@@ -402,7 +480,8 @@ func init() {
issueUpdateCmd.Flags().String("title", "", "New title")
issueUpdateCmd.Flags().String("description", "", "New description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
issueUpdateCmd.Flags().Bool("description-stdin", false, "Read new description from stdin (preserves multi-line content verbatim)")
- issueUpdateCmd.Flags().String("description-file", "", "Read new description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes)")
+ issueUpdateCmd.Flags().String("description-file", "", "Read new description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
+ issueUpdateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
issueUpdateCmd.Flags().String("status", "", "New status")
issueUpdateCmd.Flags().String("priority", "", "New priority")
issueUpdateCmd.Flags().String("assignee", "", "New assignee name (member, agent, or squad; fuzzy match)")
@@ -459,7 +538,8 @@ func init() {
// issue comment add
issueCommentAddCmd.Flags().String("content", "", "Comment content (decodes \\n, \\r, \\t, \\\\; pipe via --content-stdin for multi-line bodies or to preserve literal backslashes)")
issueCommentAddCmd.Flags().Bool("content-stdin", false, "Read comment content from stdin (preserves multi-line content verbatim)")
- issueCommentAddCmd.Flags().String("content-file", "", "Read comment content from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes)")
+ issueCommentAddCmd.Flags().String("content-file", "", "Read comment content from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
+ issueCommentAddCmd.Flags().Bool("allow-external-file", false, "Allow --content-file to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
issueCommentAddCmd.Flags().String("parent", "", "Parent comment ID (reply to a specific comment)")
issueCommentAddCmd.Flags().StringSlice("attachment", nil, "File path(s) to attach (can be specified multiple times)")
issueCommentAddCmd.Flags().String("output", "json", "Output format: table or json")
diff --git a/server/cmd/multica/cmd_issue_test.go b/server/cmd/multica/cmd_issue_test.go
index 77fddd4f97..d3eca2c522 100644
--- a/server/cmd/multica/cmd_issue_test.go
+++ b/server/cmd/multica/cmd_issue_test.go
@@ -88,12 +88,14 @@ func pipeStdin(t *testing.T, body string, fn func()) {
}
// newFlagTestCmd builds a throwaway cobra.Command carrying the inline +
-// stdin + file flag triplet that resolveTextFlag expects.
+// stdin + file flag triplet that resolveTextFlag expects, plus the
+// --allow-external-file escape hatch its workdir guardrail reads.
func newFlagTestCmd(name string) *cobra.Command {
c := &cobra.Command{Use: "test"}
c.Flags().String(name, "", "")
c.Flags().Bool(name+"-stdin", false, "")
c.Flags().String(name+"-file", "", "")
+ c.Flags().Bool("allow-external-file", false, "")
return c
}
@@ -154,14 +156,17 @@ func TestResolveTextFlag(t *testing.T) {
// Reading the body straight off disk skips the shell entirely.
// See issues #2198, #2236, #2376.
t.Run("file body is preserved verbatim with non-ASCII content", func(t *testing.T) {
+ // The workdir guardrail (MUL-4252) requires the file to live inside the
+ // current working directory, so chdir into a scratch dir and reference
+ // it by a relative name — the mainline agents actually use.
dir := t.TempDir()
- path := dir + string(os.PathSeparator) + "desc.md"
+ t.Chdir(dir)
body := "标题 / Заголовок\n\n中文段落 with `code` and \"quotes\".\n"
- if err := os.WriteFile(path, []byte(body), 0o644); err != nil {
+ if err := os.WriteFile("desc.md", []byte(body), 0o644); err != nil {
t.Fatalf("write tempfile: %v", err)
}
c := newFlagTestCmd("description")
- _ = c.Flags().Set("description-file", path)
+ _ = c.Flags().Set("description-file", "desc.md")
got, ok, err := resolveTextFlag(c, "description")
if err != nil || !ok {
t.Fatalf("unexpected: ok=%v err=%v", ok, err)
@@ -173,8 +178,11 @@ func TestResolveTextFlag(t *testing.T) {
})
t.Run("file path that doesn't exist surfaces a useful error", func(t *testing.T) {
+ // A missing file inside the workdir clears the containment check and
+ // fails at the read, not at the guardrail.
+ t.Chdir(t.TempDir())
c := newFlagTestCmd("content")
- _ = c.Flags().Set("content-file", "/this/path/does/not/exist.txt")
+ _ = c.Flags().Set("content-file", "does-not-exist.txt")
_, _, err := resolveTextFlag(c, "content")
if err == nil {
t.Fatalf("expected error for missing file")
@@ -185,19 +193,83 @@ func TestResolveTextFlag(t *testing.T) {
})
t.Run("empty file is rejected", func(t *testing.T) {
- dir := t.TempDir()
- path := dir + string(os.PathSeparator) + "empty.md"
- if err := os.WriteFile(path, []byte(""), 0o644); err != nil {
+ t.Chdir(t.TempDir())
+ if err := os.WriteFile("empty.md", []byte(""), 0o644); err != nil {
t.Fatalf("write tempfile: %v", err)
}
c := newFlagTestCmd("description")
- _ = c.Flags().Set("description-file", path)
+ _ = c.Flags().Set("description-file", "empty.md")
_, _, err := resolveTextFlag(c, "description")
if err == nil {
t.Fatalf("expected error for empty file")
}
})
+ // MUL-4252: a --<name>-file path that resolves outside the working
+ // directory is rejected, so a stale file left in a machine-shared path
+ // (e.g. /tmp) by another run/environment cannot silently become this
+ // issue's content.
+ t.Run("file outside the working directory is rejected", func(t *testing.T) {
+ workdir := t.TempDir()
+ t.Chdir(workdir)
+ // A sibling directory outside the workdir stands in for /tmp.
+ outside := t.TempDir()
+ path := outside + string(os.PathSeparator) + "stale.md"
+ if err := os.WriteFile(path, []byte("another run's content"), 0o644); err != nil {
+ t.Fatalf("write tempfile: %v", err)
+ }
+ c := newFlagTestCmd("description")
+ _ = c.Flags().Set("description-file", path)
+ _, _, err := resolveTextFlag(c, "description")
+ if err == nil {
+ t.Fatalf("expected rejection for a file outside the working directory")
+ }
+ if !strings.Contains(err.Error(), "allow-external-file") {
+ t.Errorf("error should point at --allow-external-file, got %v", err)
+ }
+ })
+
+ t.Run("--allow-external-file permits a path outside the working directory", func(t *testing.T) {
+ t.Chdir(t.TempDir())
+ outside := t.TempDir()
+ path := outside + string(os.PathSeparator) + "external.md"
+ if err := os.WriteFile(path, []byte("intentional external body"), 0o644); err != nil {
+ t.Fatalf("write tempfile: %v", err)
+ }
+ c := newFlagTestCmd("description")
+ _ = c.Flags().Set("description-file", path)
+ _ = c.Flags().Set("allow-external-file", "true")
+ got, ok, err := resolveTextFlag(c, "description")
+ if err != nil || !ok {
+ t.Fatalf("unexpected: ok=%v err=%v", ok, err)
+ }
+ if got != "intentional external body" {
+ t.Errorf("got %q, want the external body verbatim", got)
+ }
+ })
+
+ t.Run("a symlink inside the workdir pointing outside is rejected", func(t *testing.T) {
+ workdir := t.TempDir()
+ t.Chdir(workdir)
+ outside := t.TempDir()
+ target := outside + string(os.PathSeparator) + "stale.md"
+ if err := os.WriteFile(target, []byte("escaped content"), 0o644); err != nil {
+ t.Fatalf("write tempfile: %v", err)
+ }
+ if err := os.Symlink(target, "link.md"); err != nil {
+ t.Skipf("symlink unsupported on this platform: %v", err)
+ }
+ c := newFlagTestCmd("description")
+ _ = c.Flags().Set("description-file", "link.md")
+ _, _, err := resolveTextFlag(c, "description")
+ if err == nil {
+ t.Fatalf("expected rejection: symlink escapes the working directory")
+ }
+ if !strings.Contains(err.Error(), "allow-external-file") {
+ t.Errorf("error should point at --allow-external-file, got %v", err)
+ }
+ })
+
t.Run("file plus inline is rejected", func(t *testing.T) {
dir := t.TempDir()
path := dir + string(os.PathSeparator) + "x.md"
@@ -233,6 +305,7 @@ func newIssueCreateTestCmd() *cobra.Command {
cmd.Flags().String("description", "", "")
cmd.Flags().Bool("description-stdin", false, "")
cmd.Flags().String("description-file", "", "")
+ cmd.Flags().Bool("allow-external-file", false, "")
cmd.Flags().String("status", "", "")
cmd.Flags().String("priority", "", "")
cmd.Flags().String("assignee", "", "")
@@ -2610,6 +2683,7 @@ func newIssueUpdateTestCmd() *cobra.Command {
cmd.Flags().String("description", "", "")
cmd.Flags().Bool("description-stdin", false, "")
cmd.Flags().String("description-file", "", "")
+ cmd.Flags().Bool("allow-external-file", false, "")
cmd.Flags().String("status", "", "")
cmd.Flags().String("priority", "", "")
cmd.Flags().String("assignee", "", "")
diff --git a/server/cmd/multica/cmd_user.go b/server/cmd/multica/cmd_user.go
index efd0ca3f15..1818f2a8de 100644
--- a/server/cmd/multica/cmd_user.go
+++ b/server/cmd/multica/cmd_user.go
@@ -58,7 +58,8 @@ func init() {
userProfileUpdateCmd.Flags().String("description", "", "New profile description (decodes \\n, \\r, \\t, \\\\; pipe via --description-stdin to preserve literal backslashes)")
userProfileUpdateCmd.Flags().Bool("description-stdin", false, "Read description from stdin (preserves multi-line content verbatim)")
- userProfileUpdateCmd.Flags().String("description-file", "", "Read description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes)")
+ userProfileUpdateCmd.Flags().String("description-file", "", "Read description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
+ userProfileUpdateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
userProfileUpdateCmd.Flags().Bool("clear", false, "Clear the profile description (equivalent to --description \"\")")
userProfileUpdateCmd.Flags().String("output", "table", "Output format: table or json")
}
diff --git a/server/internal/daemon/execenv/runtime_config_sections.go b/server/internal/daemon/execenv/runtime_config_sections.go
index ffae416632..e58018b005 100644
--- a/server/internal/daemon/execenv/runtime_config_sections.go
+++ b/server/internal/daemon/execenv/runtime_config_sections.go
@@ -200,7 +200,7 @@ func writeAvailableCommands(b *strings.Builder) {
b.WriteString("### Core\n")
b.WriteString("- `multica issue get <id> --output json` — full issue.\n")
b.WriteString("- `multica issue comment list <issue-id> [--thread <comment-id> [--tail N] | --recent N] [--before <ts> --before-id <uuid>] [--since <RFC3339>] [--full] --output json` — thread-aware comment reads. Resolved threads come back folded by default on complete-thread reads (default list, `--recent`, `--thread` without `--tail`); pass `--full` to expand. Page older replies / threads with `--before`/`--before-id` (stderr labels: `Next reply cursor`, `Next thread cursor`); `--help` for full semantics.\n")
- b.WriteString("- `multica issue create --title \"...\" [--description-file <path>] [--priority X] [--status X] [--assignee X | --assignee-id <uuid>] [--parent <issue-id>] [--stage N] [--project <project-id>] [--due-date <RFC3339>] [--attachment <path>]` — create an issue. For agent-authored long descriptions prefer `--description-file <path>` (heredoc stdin can swallow trailing flags, #4182).\n")
+ b.WriteString("- `multica issue create --title \"...\" [--description-file <path>] [--priority X] [--status X] [--assignee X | --assignee-id <uuid>] [--parent <issue-id>] [--stage N] [--project <project-id>] [--due-date <RFC3339>] [--attachment <path>]` — create an issue. For agent-authored long descriptions prefer `--description-file <path>` (heredoc stdin can swallow trailing flags, #4182). Write that file inside your working directory (e.g. `./description.md`), never `/tmp` or shared paths, and treat a failed write as fatal — the CLI rejects a path outside the workdir so a stale file from another run can't leak in (MUL-4252).\n")
b.WriteString("- `multica issue update <id> [--title X] [--description-file <path>] [--priority X] [--status X] [--assignee X] [--parent <issue-id>] [--stage N] [--project <project-id>] [--due-date <RFC3339>]` — update fields; pass `--parent \"\"` to clear parent.\n")
b.WriteString("- `multica issue status <id> <status>` — flip status (todo / in_progress / in_review / done / blocked / backlog / cancelled).\n")
b.WriteString("- `multica issue children <id> [--output json]` — list a parent's sub-issues grouped by stage.\n")
@@ -221,7 +221,7 @@ func writeAvailableCommandsQuickCreate(b *strings.Builder) {
b.WriteString("## Available Commands\n\n")
b.WriteString("**Use `--output json` for structured data.** For anything beyond `issue create`, run `multica --help` or `multica <command> --help`.\n\n")
b.WriteString("### Core\n")
- b.WriteString("- `multica issue create --title \"...\" [--description \"...\" | --description-file <path> | --description-stdin] [--priority X] [--status X] [--assignee X | --assignee-id <uuid>] [--parent <issue-id>] [--stage N] [--project <project-id>] [--due-date <RFC3339>] [--attachment <path>]` — Create a new issue; `--attachment` may be repeated. For agent-authored long descriptions, prefer `--description-file <path>` over `--description-stdin` (flags after a HEREDOC terminator can be silently swallowed, #4182).\n\n")
+ b.WriteString("- `multica issue create --title \"...\" [--description \"...\" | --description-file <path> | --description-stdin] [--priority X] [--status X] [--assignee X | --assignee-id <uuid>] [--parent <issue-id>] [--stage N] [--project <project-id>] [--due-date <RFC3339>] [--attachment <path>]` — Create a new issue; `--attachment` may be repeated. For agent-authored long descriptions, prefer `--description-file <path>` over `--description-stdin` (flags after a HEREDOC terminator can be silently swallowed, #4182). Write that file inside your working directory (e.g. `./description.md`), never `/tmp` or shared paths, and treat a failed write as fatal — the CLI rejects a path outside the workdir so a stale file from another run can't leak in (MUL-4252).\n\n")
}
// writeCommentFormatting emits the cross-platform file-first guardrail.
@@ -230,10 +230,10 @@ func writeAvailableCommandsQuickCreate(b *strings.Builder) {
func writeCommentFormatting(b *strings.Builder) {
b.WriteString("## Comment Formatting\n\n")
if runtimeGOOS == "windows" {
- b.WriteString("On Windows, **always write the comment body to a UTF-8 file with your file-write tool first, then post it with `--content-file <path>`** — do NOT pipe via `--content-stdin` (PowerShell 5.1's `$OutputEncoding` defaults to ASCIIEncoding when piping to a native command, silently dropping non-ASCII characters as `?` before they reach `multica.exe`). Never use inline `--content` for agent-authored comments. Keep the same `--parent` value from the trigger comment when replying. Delete the temp file (`Remove-Item ./reply.md`) after posting; do not rely on `\\n` escapes.\n\n")
+ b.WriteString("On Windows, **always write the comment body to a UTF-8 file with your file-write tool first, then post it with `--content-file <path>`** — do NOT pipe via `--content-stdin` (PowerShell 5.1's `$OutputEncoding` defaults to ASCIIEncoding when piping to a native command, silently dropping non-ASCII characters as `?` before they reach `multica.exe`). Never use inline `--content` for agent-authored comments. Write that file inside your working directory (`./reply.md`), never `/tmp` or shared paths — the CLI rejects a `--content-file` path outside the workdir so another run's stale file can't leak in (MUL-4252). Keep the same `--parent` value from the trigger comment when replying. Delete the temp file (`Remove-Item ./reply.md`) after posting; do not rely on `\\n` escapes.\n\n")
return
}
- b.WriteString("For issue comments, **always write the comment body to a UTF-8 file with your file-write tool first, then post it with `--content-file <path>`**. Never use inline `--content` for agent-authored comments — the shell rewrites backticks / `$()` / quotes in the body (MUL-2904). Never use `--content-stdin` with a HEREDOC alongside other flags either — the heredoc/flag boundary is fragile and flags get silently swallowed (#4182). Keep the same `--parent` value from the trigger comment when replying. Delete the temp file (`rm ./reply.md`) after posting; do not rely on `\\n` escapes.\n\n")
+ b.WriteString("For issue comments, **always write the comment body to a UTF-8 file with your file-write tool first, then post it with `--content-file <path>`**. Never use inline `--content` for agent-authored comments — the shell rewrites backticks / `$()` / quotes in the body (MUL-2904). Never use `--content-stdin` with a HEREDOC alongside other flags either — the heredoc/flag boundary is fragile and flags get silently swallowed (#4182). Write that file inside your working directory (`./reply.md`), never `/tmp` or shared paths — the CLI rejects a `--content-file` path outside the workdir so another run's stale file can't leak in (MUL-4252). Keep the same `--parent` value from the trigger comment when replying. Delete the temp file (`rm ./reply.md`) after posting; do not rely on `\\n` escapes.\n\n")
}
// writeRepositories emits the Repositories section when at least one repo
diff --git a/server/internal/daemon/prompt.go b/server/internal/daemon/prompt.go
index f61d0a75fb..c683702d64 100644
--- a/server/internal/daemon/prompt.go
+++ b/server/internal/daemon/prompt.go
@@ -66,6 +66,7 @@ func buildQuickCreatePrompt(task Task) string {
b.WriteString(" CC exception: `multica issue create` has no `--subscriber` flag, and the platform auto-subscribes members whose `[@Name](mention://member/<uuid>)` link appears in the description. When the user wrote \"cc @Y\", strip the verbal \"cc\" wrapper from the User request body and append a final `CC: <mention link(s)>` line to the description so the cc routing still fires.\n\n")
b.WriteString(" 2. **Context** — include ONLY when the input cited external resources AND you successfully fetched them AND they produced verifiable facts worth recording. Summarize facts only (e.g. \"PR #45 changes auth to JWT\"), not interpretation or unsolicited reference implementations. If you have nothing factual to add, omit the section entirely — never use it as an apology log for resources you could not fetch.\n\n")
b.WriteString(" Hard rules: never invent requirements, implementation details, or acceptance criteria the user did not express; never reduce multi-sentence input to a single vague sentence; never echo the title.\n\n")
+ b.WriteString(" Passing the description: a short, single-line body with no code, quotes, backticks, `$()`, or other special characters may go inline via `--description \"...\"`. Anything multi-line, or containing code snippets / file paths / quotes / backticks / `$()` / special characters, or otherwise long — which quick-create descriptions usually are — MUST be written to `./description.md` and passed with `--description-file ./description.md`; passing rich text inline lets the shell rewrite or truncate it (MUL-2904). That file MUST live inside your current working directory (e.g. `./description.md`) — never `/tmp` or any machine-shared path, where a different run may have left a stale file that would silently become this issue's description. If the file write fails for any reason, stop and fix it; never run `--description-file` against a file whose write did not succeed.\n\n")
// priority
b.WriteString("- **priority**: one of `urgent`, `high`, `medium`, `low`, or omit. Map P0/P1 → urgent/high; \"asap\" → urgent. If unspecified, omit.\n\n")