Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat([issue-2621]): feature-ideas prompt consults REJECTED.md and closed-unmerged PRs before brainstorming

[._.]/ Adam Eivy08e53ef3115a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 380b4358ae..416036dd87 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -1,5 +1,9 @@
# Unreleased
+## CoS self-learning reliability
+
+- **[issue-2621] Feature brainstorming remembers rejected ideas** — the feature-ideas task now checks REJECTED.md and previously closed-unmerged proposals before suggesting, so declined ideas stop coming back.
+
## Added
- **First-run tutorial for POST cognitive drills.** The timed, stimulus-driven cognitive drills (n-back, digit-span, stroop, schulte-table, mental-rotation, reaction-time) start flashing a stimulus the instant they mount, which is disorienting the first time you meet one. Each drill type now shows a one-time how-to card — a plain-language goal, numbered steps, and the controls — the first time it's encountered, and holds the drill (and its timers) until you tap **Start drill**. The card is config-aware (it names the n-back lag, the digit-span direction, and the reaction-time mode), then never shows again for that type (tracked per type in `localStorage`). Non-timed drills (math/memory, LLM/verbal) are self-explanatory and are not gated.
diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.js
index 42319832c0..dd92a532eb 100644
--- a/server/services/taskPromptDefaults.test.js
+++ b/server/services/taskPromptDefaults.test.js
@@ -66,6 +66,24 @@ describe('taskPromptDefaults integrity snapshot', () => {
expect(actual).toEqual(SNAPSHOT.PREVIOUS_DEFAULT_PROMPTS);
});
+ // feature-ideas v10: rejected-ideas ledger consultation (issue #2621).
+ // Pins the version-bump pairing — the prompt change ships WITH its version
+ // bump and the outgoing v9 default preserved for cross-install auto-upgrade.
+ it('feature-ideas v10 consults REJECTED.md and closed-unmerged PRs, preserving the v9 default', () => {
+ const current = DEFAULT_TASK_PROMPTS['feature-ideas'];
+ expect(current).toContain('REJECTED.md');
+ expect(current).toContain('is:unmerged');
+ expect(PROMPT_VERSIONS['feature-ideas']).toBe(10);
+
+ const previous = PREVIOUS_DEFAULT_PROMPTS['feature-ideas'];
+ const v9 = previous[previous.length - 1];
+ // The outgoing v9 default lacked the rejected-ideas consultation and is
+ // preserved verbatim so installs holding it are recognized and upgraded.
+ expect(v9).not.toContain('REJECTED.md');
+ expect(v9).toContain('.changelog/');
+ expect(v9).not.toBe(current);
+ });
+
// NOTE: PROMPT_VERSIONS keys are SCHEDULE keys, not always prompt keys —
// code-reviewer-a/b version a pipeline whose stages use the
// code-reviewer-review / code-reviewer-implement prompt bodies — so there is
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 81a9275d89..4b26517351 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -10,7 +10,7 @@
"documentation": "74aa8433896647e7815f9d6d9e4a56c8",
"ui-bugs": "def9ad96bd74ab397233f234d79a1974",
"mobile-responsive": "16d8e7f63a673a2de48994c0ac08ef3d",
- "feature-ideas": "0741418bd275b8953131155f8bc89460",
+ "feature-ideas": "d3282f16da29efe2d53595b3b34778bc",
"plan-task": "2189019880ee12a8ba4d7975e7afc646",
"claim-issue": "935e47c14b4f5eef1d030dedce5338fc",
"claim-issue-gitlab": "9a4f517a0af3200dcd54f71aa2b8d924",
@@ -34,7 +34,7 @@
"refresh-local-llm-catalog": "a9dce67bb9f0837ba904f3412b03637f"
},
"PROMPT_VERSIONS": {
- "feature-ideas": 9,
+ "feature-ideas": 10,
"plan-task": 9,
"claim-issue": 5,
"claim-issue-gitlab": 4,
@@ -67,7 +67,8 @@
"52b76c852fd00f15c50eb73ea0bc4340",
"5a0350fa6db8ac040fb638fdd4a31700",
"d076e19a6848f6452f4d1078b096ba4b",
- "73cdc70f8d14fc909668054bbcee1259"
+ "73cdc70f8d14fc909668054bbcee1259",
+ "0741418bd275b8953131155f8bc89460"
],
"plan-task": [
"e7ff71a98468960cb4465741bd54e6aa",
diff --git a/server/services/taskPromptDefaults/previousDefaults.js b/server/services/taskPromptDefaults/previousDefaults.js
index 071cf657d1..9fcf64534a 100644
--- a/server/services/taskPromptDefaults/previousDefaults.js
+++ b/server/services/taskPromptDefaults/previousDefaults.js
@@ -395,6 +395,76 @@ When PLAN.md is missing, empty, or fully completed, brainstorm and implement a n
\`\`\`
- [x] [<slug-of-feature>] <description of the feature you implemented>
\`\`\`
+8. Commit with a clear description of the feature and rationale`,
+ // v9 default prompt (`.changelog/` + `git log` completed-work signal — superseded by v10, which consults REJECTED.md and recently closed-unmerged automation PRs before brainstorming)
+ `[Improvement: {appName}] Implement Next Planned Feature
+
+Your goal is to implement the next planned item from PLAN.md, or brainstorm a new feature if no plan exists.
+
+Repository: {repoPath}
+{planConstraint}
+## Phase 1 — Find the Next Task
+
+1. Read PLAN.md from {repoPath}
+2. Skim recent \`.changelog/\` entries and \`git log\` (last 50 commits) to understand what has already shipped — do NOT re-implement completed features
+3. If the **Item Constraint** block above named a specific \`[plan-id]\`, find the matching \`- [ ]\` line and use that — do NOT pick a different one, do NOT brainstorm. If the line is missing, has been checked, or carries \`<!-- NEEDS_INPUT -->\`, exit cleanly without commits or PR.
+4. Otherwise, if PLAN.md does not exist, is empty, or has no unchecked items (\`- [ ]\`), go to **Phase 4 — Brainstorm**.
+5. Otherwise, find the first unchecked item (\`- [ ]\`) that does NOT have a \`<!-- NEEDS_INPUT -->\` annotation.
+6. If all unchecked items have \`<!-- NEEDS_INPUT -->\`, go to **Phase 4 — Brainstorm**.
+
+## Phase 2 — Evaluate Feasibility
+
+7. Read relevant source files to understand the scope of the item
+8. Determine: can this be implemented without user clarification?
+ - Consider: are requirements clear? Are there ambiguous design choices? Does it depend on external decisions?
+
+## Phase 3a — Implement (if feasible)
+
+9. Implement the feature:
+ - Write clean, tested code following existing patterns
+ - Run tests to ensure nothing is broken
+10. **Review your changed code for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix any findings. Claude Code can run \`/simplify\` for this pass; on other CLIs, do the equivalent diff review by hand.
+11. Check the PLAN.md item: change \`- [ ]\` to \`- [x]\`. **Preserve the \`[plan-id]\` slug verbatim** — only the box character flips, never the ID. Reference the slug in the commit message (e.g. \`feat([plan-id]): …\`).
+12. Commit with a clear description referencing the PLAN.md item
+
+## Phase 3b — Request Clarification (if not feasible)
+
+9. Create a file named \`.plan-questions.md\` in the repository root with this format:
+ \`\`\`
+ # Plan Question: <short title summarizing the PLAN.md item>
+
+ ## PLAN.md Item
+ <the exact text of the unchecked item, including its [plan-id]>
+
+ ## Questions
+ - <question 1>
+ - <question 2>
+ \`\`\`
+10. **Move the unchecked item to the bottom of PLAN.md and annotate it with \` <!-- NEEDS_INPUT -->\`** — remove the line from its current position and append it at the end of the file with the annotation, **preserving its \`[plan-id]\` slug**. This keeps the queue moving so the next \`feature-ideas\` run picks up a different actionable item instead of repeatedly tripping on this one.
+11. Commit both changes (the new \`.plan-questions.md\` file and the PLAN.md move) with message \`chore: flag PLAN.md item needing user input\`. Then proceed to the **Completion** section below so the clarification PR is opened for the user to review — do NOT leave the worktree orphaned.
+
+## Phase 4 — Brainstorm a New Feature
+
+When PLAN.md is missing, empty, or fully completed, brainstorm and implement a new feature:
+
+1. Read GOALS.md from {repoPath} for context on the app's goals and priorities.
+ If no GOALS.md exists, focus on general improvements.
+2. Skim recent \`.changelog/\` entries and the last 50 \`git log\` entries to avoid re-implementing completed features
+3. Review the codebase structure, recent git log, and any README or docs to understand the app
+4. Identify ONE small, high-impact feature that:
+ - Aligns with GOALS.md priorities (if available)
+ - Is NOT already shipped per recent \`.changelog/\` entries or \`git log\` (avoid re-implementing shipped features)
+ - Saves user time, improves UX, or makes the app more useful
+ - Is self-contained and completable in one session
+ - Does NOT duplicate existing functionality
+5. Implement the feature:
+ - Write clean, tested code following existing patterns
+ - Run tests to ensure nothing is broken
+6. **Review your changed code for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix any findings. Claude Code can run \`/simplify\` for this pass; on other CLIs, do the equivalent diff review by hand.
+7. Add the feature as a checked item in PLAN.md (create the file if needed) **with a slug ID** derived from the feature title (lowercase kebab-case, ≤50 chars, unique against every existing \`[slug]\` in PLAN.md):
+ \`\`\`
+ - [x] [<slug-of-feature>] <description of the feature you implemented>
+ \`\`\`
8. Commit with a clear description of the feature and rationale`
],
'plan-task': [
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index 7067723a77..aeeddf9ee2 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -281,22 +281,25 @@ When PLAN.md is missing, empty, or fully completed, brainstorm and implement a n
1. Read GOALS.md from {repoPath} for context on the app's goals and priorities.
If no GOALS.md exists, focus on general improvements.
2. Skim recent \`.changelog/\` entries and the last 50 \`git log\` entries to avoid re-implementing completed features
-3. Review the codebase structure, recent git log, and any README or docs to understand the app
-4. Identify ONE small, high-impact feature that:
+3. Read REJECTED.md from {repoPath} (if it exists) to understand previously rejected ideas — do NOT re-propose an idea matching a rejected entry
+4. Check the repo's recently closed-unmerged PRs (\`gh pr list --state closed --search "is:unmerged" --limit 20\`, or the forge's equivalent) — a brainstormed feature whose PR the user closed WITHOUT merging was rejected; treat those ideas as rejected too
+5. Review the codebase structure, recent git log, and any README or docs to understand the app
+6. Identify ONE small, high-impact feature that:
- Aligns with GOALS.md priorities (if available)
- Is NOT already shipped per recent \`.changelog/\` entries or \`git log\` (avoid re-implementing shipped features)
+ - Does NOT match a REJECTED.md entry or a closed-unmerged automation PR (rejected ideas stay rejected)
- Saves user time, improves UX, or makes the app more useful
- Is self-contained and completable in one session
- Does NOT duplicate existing functionality
-5. Implement the feature:
+7. Implement the feature:
- Write clean, tested code following existing patterns
- Run tests to ensure nothing is broken
-6. **Review your changed code for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix any findings. Claude Code can run \`/simplify\` for this pass; on other CLIs, do the equivalent diff review by hand.
-7. Add the feature as a checked item in PLAN.md (create the file if needed) **with a slug ID** derived from the feature title (lowercase kebab-case, ≤50 chars, unique against every existing \`[slug]\` in PLAN.md):
+8. **Review your changed code for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix any findings. Claude Code can run \`/simplify\` for this pass; on other CLIs, do the equivalent diff review by hand.
+9. Add the feature as a checked item in PLAN.md (create the file if needed) **with a slug ID** derived from the feature title (lowercase kebab-case, ≤50 chars, unique against every existing \`[slug]\` in PLAN.md):
\`\`\`
- [x] [<slug-of-feature>] <description of the feature you implemented>
\`\`\`
-8. Commit with a clear description of the feature and rationale`,
+10. Commit with a clear description of the feature and rationale`,
'plan-task': `[Plan Task: {appName}] Claim and ship next PLAN.md item
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index a88a8f88fd..60771c9de3 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -7,7 +7,7 @@
// Prompt versions — bump when a default prompt changes so existing instances auto-upgrade.
// Only non-customized prompts (promptCustomized !== true) are upgraded.
export const PROMPT_VERSIONS = {
- 'feature-ideas': 9, // v9: drop DONE.md reads — use `.changelog/` + `git log` (last 50) as the completed-work signal
+ 'feature-ideas': 10, // v10: Phase 4 (Brainstorm) consults the repo's REJECTED.md and recently closed-unmerged PRs before proposing, so ideas the user already declined aren't re-proposed (mirrors idle-review's REJECTED.md contract). v9: drop DONE.md reads — use `.changelog/` + `git log` (last 50) as the completed-work signal
'plan-task': 9, // v9: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v8: Phase-6 merge fallback prefers --merge over --squash (after --auto), matching the /do:pr + review-loop default and PortOS's merge-only policy
'claim-issue': 5, // v5: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v4: Phase 5 chooses the issue trailer deliberately (Closes for a full ship, Refs + a `## Remaining` section for a partial one) and Phase 7 reconciles the issue with the partial-ship hybrid — close + file a scoped follow-up when the remainder is separable, else comment "done/remaining" + release the `in-progress` claim — so a partial ship is never left OPEN + `in-progress` (a zombie the claim queue skips forever). v3: Phase 3 tags an ambiguous/too-large issue `needs-input` (not just a comment) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge instead of re-picking the same un-actionable issue. v2: stop treating the bare `plan` label as a skip — `plan` is the claimable-queue label (do-replan --issues labels every migrated backlog item `plan`), so v1's exclusion emptied the whole actionable queue; now skip only true epics (`epic` label or "(epic)" title)
'claim-issue-gitlab': 4, // v4: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v3: mirrors claim-issue v4 — Phase 5 chooses Closes-vs-Refs deliberately and Phase 7 reconciles the issue with the partial-ship hybrid (close + scoped follow-up when separable, else "done/remaining" note + release the `in-progress` claim) so a partial ship is never stranded. v2: Phase 3 tags an ambiguous/too-large issue `needs-input` (mirrors claim-issue v3) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge. v1: GitLab sibling of claim-issue — same 7-phase /claim --issues flow over `glab` issues + merge requests. Reached via the claim-work router when an app's resolved workTracker is 'gitlab'.