@devflow-core/dsh-devflow 0.1.0

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 (61) hide show
  1. package/NOTICE +13 -0
  2. package/README.md +82 -0
  3. package/assets/commands/devflow-adversarial.toml +11 -0
  4. package/assets/commands/devflow-audit.toml +32 -0
  5. package/assets/commands/devflow-debt.toml +42 -0
  6. package/assets/commands/devflow-find-fault.toml +11 -0
  7. package/assets/commands/devflow-learn.toml +21 -0
  8. package/assets/commands/devflow-plan.toml +58 -0
  9. package/assets/commands/devflow-prove.toml +20 -0
  10. package/assets/commands/devflow-pua.toml +40 -0
  11. package/assets/commands/devflow-review.toml +36 -0
  12. package/assets/commands/devflow-spec.toml +49 -0
  13. package/assets/commands/devflow.toml +35 -0
  14. package/assets/presets/devflow-2/NOTICE +4 -0
  15. package/assets/presets/devflow-2/README.md +71 -0
  16. package/assets/presets/devflow-2/agent.cordis.yml +337 -0
  17. package/assets/presets/devflow-2/custom-bash.mjs +213 -0
  18. package/assets/presets/devflow-2/preset.yml +3 -0
  19. package/assets/presets/devflow-2/tool-bootstrap.mjs +496 -0
  20. package/assets/scripts/devflow-audit.js +275 -0
  21. package/assets/scripts/devflow-debt.js +196 -0
  22. package/assets/scripts/devflow-doctor.js +90 -0
  23. package/assets/scripts/devflow-plan.js +638 -0
  24. package/assets/scripts/devflow-review.js +93 -0
  25. package/assets/scripts/devflow-spec.js +238 -0
  26. package/assets/skills/devflow-adversarial/SKILL.md +71 -0
  27. package/assets/skills/devflow-audit/SKILL.md +78 -0
  28. package/assets/skills/devflow-brainstorm/SKILL.md +176 -0
  29. package/assets/skills/devflow-brainstorm/references/interview-discipline.md +184 -0
  30. package/assets/skills/devflow-build/SKILL.md +238 -0
  31. package/assets/skills/devflow-build/references/build-methods.md +40 -0
  32. package/assets/skills/devflow-core/SKILL.md +93 -0
  33. package/assets/skills/devflow-core/references/core-methods.md +131 -0
  34. package/assets/skills/devflow-core/references/reference-projects.md +133 -0
  35. package/assets/skills/devflow-core/references/skill-guide.md +63 -0
  36. package/assets/skills/devflow-cut/SKILL.md +208 -0
  37. package/assets/skills/devflow-cut/references/cut-methods.md +65 -0
  38. package/assets/skills/devflow-cut/references/native-capability-checklist.md +112 -0
  39. package/assets/skills/devflow-docs-followup/SKILL.md +132 -0
  40. package/assets/skills/devflow-docs-followup/agents/openai.yaml +4 -0
  41. package/assets/skills/devflow-find-fault/SKILL.md +109 -0
  42. package/assets/skills/devflow-learn/SKILL.md +176 -0
  43. package/assets/skills/devflow-plan/SKILL.md +142 -0
  44. package/assets/skills/devflow-plan/references/plan-methods.md +74 -0
  45. package/assets/skills/devflow-project-knowledge/SKILL.md +354 -0
  46. package/assets/skills/devflow-prove/SKILL.md +216 -0
  47. package/assets/skills/devflow-prove/references/code-review-checklist.md +202 -0
  48. package/assets/skills/devflow-prove/references/flow-self-test.md +775 -0
  49. package/assets/skills/devflow-prove/references/proof-recovery-methods.md +26 -0
  50. package/assets/skills/devflow-pua/SKILL.md +197 -0
  51. package/assets/skills/devflow-pua/references/flavor-display.md +49 -0
  52. package/assets/skills/devflow-pua/references/methodology-library.md +193 -0
  53. package/assets/skills/devflow-pua/references/methodology-router.md +78 -0
  54. package/assets/skills/devflow-spec/SKILL.md +92 -0
  55. package/assets/skills/devflow-spec/references/spec-plan-methods.md +15 -0
  56. package/cordis.patch.yml +11 -0
  57. package/lib/dsh-home.js +33 -0
  58. package/lib/index.js +79 -0
  59. package/lib/mount-once.js +34 -0
  60. package/lib/sync.js +168 -0
  61. package/package.json +32 -0
@@ -0,0 +1,112 @@
1
+ # Native Capability Checklist
2
+
3
+ Use this before adding a dependency, wrapper, generic helper, or custom framework layer. The goal is not code golf. The goal is fewer owned moving parts while keeping correctness, security, accessibility, and verification.
4
+
5
+ ## Browser And HTML
6
+
7
+ | You think you need | Check first |
8
+ |---|---|
9
+ | Date picker | `<input type="date">` |
10
+ | Time picker | `<input type="time">` |
11
+ | Color picker | `<input type="color">` |
12
+ | Range slider | `<input type="range">` |
13
+ | Modal/dialog library | `<dialog>` and `showModal()` |
14
+ | Accordion/FAQ component | `<details><summary>...</summary>...</details>` |
15
+ | Searchable dropdown | `<input list>` and `<datalist>` |
16
+ | Progress/gauge | `<progress>` or `<meter>` |
17
+ | Tooltip | `title` for simple hints, CSS pseudo-elements for styled hints |
18
+ | Auto-growing textarea | `field-sizing: content` where supported |
19
+ | Sticky header | `position: sticky` |
20
+
21
+ ## CSS
22
+
23
+ | You think you need JS for | Check first |
24
+ |---|---|
25
+ | Responsive layout | Grid/flex with `minmax`, `auto-fit`, `auto-fill` |
26
+ | Component-level responsive layout | Container queries |
27
+ | Dark mode | `prefers-color-scheme` |
28
+ | Reduced motion | `prefers-reduced-motion` |
29
+ | Sticky header | `position: sticky` |
30
+ | Text truncation | `text-overflow`, line clamp |
31
+ | Scroll carousel | Scroll snap |
32
+ | Theming | CSS custom properties |
33
+ | Aspect ratio boxes | `aspect-ratio` |
34
+ | Parent-state styling | `:has(...)` |
35
+ | Native CSS nesting | nested selectors |
36
+
37
+ ## JavaScript And Browser APIs
38
+
39
+ | You think you need | Check first |
40
+ |---|---|
41
+ | Query-string parser | `URLSearchParams` |
42
+ | Deep clone | `structuredClone` |
43
+ | Currency/number formatting | `Intl.NumberFormat` |
44
+ | Date formatting | `Intl.DateTimeFormat` |
45
+ | Relative time | `Intl.RelativeTimeFormat` |
46
+ | Plural rules | `Intl.PluralRules` |
47
+ | UUID | `crypto.randomUUID()` |
48
+ | Clipboard helper | `navigator.clipboard` |
49
+ | Infinite scroll | `IntersectionObserver` |
50
+ | Resize listener | `ResizeObserver` |
51
+ | DOM mutation watcher | `MutationObserver` |
52
+ | Abort fetch on timeout | `AbortSignal.timeout()` |
53
+ | Simple event bus | `EventTarget` and `CustomEvent` |
54
+
55
+ ## Node.js
56
+
57
+ | You think you need | Check first |
58
+ |---|---|
59
+ | `mkdirp` / `make-dir` | `fs.mkdirSync(path, { recursive: true })` |
60
+ | `rimraf` | `fs.rmSync(path, { recursive: true, force: true })` |
61
+ | `path-exists` | `fs.existsSync` |
62
+ | JSON file helpers | `fs.readFileSync` + `JSON.parse`, `fs.writeFileSync` + `JSON.stringify` |
63
+ | `object-assign` | `Object.assign` or spread |
64
+ | array unique | `new Set()` |
65
+ | array flatten | `Array.prototype.flat()` |
66
+ | stream check | `value instanceof stream.Readable` |
67
+ | path normalization | `path.normalize`, `path.posix`, or `path.win32` |
68
+
69
+ ## Python
70
+
71
+ | You think you need | Check first |
72
+ |---|---|
73
+ | simple data records | `dataclasses.dataclass` |
74
+ | basic timezone support | `zoneinfo.ZoneInfo` |
75
+ | JSON | `json` |
76
+ | CLI parsing | `argparse` |
77
+ | caching | `functools.lru_cache` |
78
+ | path handling | `pathlib.Path` |
79
+ | basic iteration helpers | `itertools` |
80
+ | partial/reduce helpers | `functools.partial`, `functools.reduce` |
81
+ | dict merge | `dict_a | dict_b` on Python 3.9+ |
82
+
83
+ ## Database
84
+
85
+ | App code temptation | Database primitive |
86
+ |---|---|
87
+ | Uniqueness checks | `UNIQUE` constraint |
88
+ | Referential integrity | `FOREIGN KEY` |
89
+ | Value ranges | `CHECK` constraint |
90
+ | Pagination | `LIMIT` / `OFFSET` or cursor query |
91
+ | Deduplication | `DISTINCT` / conflict handling |
92
+ | Running totals or ranking | Window functions |
93
+ | JSON query | Native JSON support |
94
+ | Full-text search basics | Built-in FTS / text indexes |
95
+ | Insert/update timestamps | column defaults and update triggers |
96
+
97
+ ## Shell And Platform
98
+
99
+ | You think you need | Check first |
100
+ |---|---|
101
+ | custom file finder | `rg --files`, `find`, or platform search |
102
+ | custom process runner | package scripts or existing task runner |
103
+ | generated config loader | existing env/config conventions |
104
+ | new project metadata format | existing `package.json`, manifest, TOML, YAML, or platform manifest |
105
+
106
+ ## Required Output
107
+
108
+ ```text
109
+ Native Check:checked <layer>; native option <used/not enough>; reason <why>
110
+ ```
111
+
112
+ If the native option is not enough, name the current limitation and the proof. Do not cite future flexibility as a reason.
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: devflow-docs-followup
3
+ description: "Use when the user explicitly asks to create or discuss completion documentation, or automatically only after a verified feature implementation with an actual source-behavior or interface-contract change. Do not automatically ask for documentation after validation-only, documentation-only, rule-only, skill-only, or no-diff PASS results. Ask the current Codex user which documents to create; never create any until explicitly confirmed."
4
+ ---
5
+
6
+ # DevFlow Docs Follow-Up
7
+
8
+ Ask the current Codex user whether a verified feature implementation needs follow-up documentation. Do not create any document until the user explicitly confirms it.
9
+
10
+ ## Entry Gate
11
+
12
+ 1. For a direct user request to create or discuss completion documentation, proceed with the requested documentation flow; a feature implementation diff is not required.
13
+ 2. For an automatic completion handoff, confirm both current `devflow-prove` `PASS` evidence and task evidence of an actual feature implementation that changes source behavior or an interface contract. Inspect the task diff, touched files, or equivalent user-provided baseline.
14
+ 3. Do not automatically ask about documentation for validation-only, documentation-only, rule-only, skill-only, or no-diff `PASS` results. Stop without an inquiry.
15
+ 4. If completion evidence is absent, stop and return to the appropriate proof route. Do not ask about documentation for an unverified feature.
16
+ 5. Address the current Codex user, not the feature's eventual end user.
17
+
18
+ ## Inquiry
19
+
20
+ Ask once, allowing one or more selections:
21
+
22
+ ```text
23
+ The feature is verified. Do you need any follow-up documentation?
24
+
25
+ 1. Technical solution document
26
+ 2. Frontend API handoff document
27
+ 3. Feature-flow troubleshooting document
28
+ 4. No documents
29
+
30
+ Reply with one or more numbers, or say none.
31
+ ```
32
+
33
+ Rules:
34
+
35
+ - Treat only an explicit selection as approval to create that document type.
36
+ - Treat silence, an ambiguous reply, or an unselected item as not approved.
37
+ - Treat `none` as a completed follow-up with no files written.
38
+ - If the user selects more than one type, create only those selected types.
39
+
40
+ ## Evidence And Landing
41
+
42
+ Before writing a selected document, read the current diff, implementation, tests, commands, and user-confirmed decisions. Use project documentation conventions and templates when they exist.
43
+
44
+ When the target project has no relevant convention, use these fallback locations:
45
+
46
+ | Document type | Fallback path |
47
+ |---|---|
48
+ | Technical solution | `docs/technical/YYYY-MM-DD-<short-kebab-name>.md` |
49
+ | Frontend API handoff | `docs/frontend-handoff/YYYY-MM-DD-<short-kebab-name>.md` |
50
+ | Feature-flow troubleshooting | `docs/troubleshooting/YYYY-MM-DD-<short-kebab-name>.md` |
51
+
52
+ Do not invent code paths, API contracts, payload fields, errors, or verification results. If the selected document lacks evidence, name the missing evidence and report that document as `BLOCKED`.
53
+
54
+ ## Document Templates
55
+
56
+ ### Technical Solution Document
57
+
58
+ Use these sections:
59
+
60
+ ```text
61
+ Goal:
62
+ Context:
63
+ Affected modules and data flow:
64
+ Key decisions and trade-offs:
65
+ Implementation summary:
66
+ Verification:
67
+ Limitations and follow-up:
68
+ ```
69
+
70
+ ### Frontend API Handoff Document
71
+
72
+ Use these sections only for actual interface changes:
73
+
74
+ ```text
75
+ Change summary:
76
+ Affected endpoint or event:
77
+ Authentication and authorization:
78
+ Request fields:
79
+ Response fields:
80
+ Errors and compatibility:
81
+ Frontend integration examples:
82
+ Verification:
83
+ ```
84
+
85
+ If the selected work has no interface contract evidence, do not manufacture a handoff document. State that it is not applicable or request the missing contract source.
86
+
87
+ ### Feature-Flow Troubleshooting Document
88
+
89
+ Use these sections:
90
+
91
+ ```text
92
+ Entry condition:
93
+ User and system flow:
94
+ Module, service, and data path:
95
+ State transitions and decision branches:
96
+ Failure symptoms and checks:
97
+ Troubleshooting steps:
98
+ Verification:
99
+ ```
100
+
101
+ ## Completion Output
102
+
103
+ Report the follow-up result without hiding unselected or blocked items:
104
+
105
+ ```text
106
+ Documentation follow-up:
107
+ - Completion evidence: <command or user-provided proof>
108
+ - Selected: <document types or none>
109
+ - Created: <paths or none>
110
+ - Blocked: <missing evidence or none>
111
+ - Not created: <unselected document types>
112
+ ```
113
+
114
+ ## Anti-Rationalization
115
+
116
+ | Excuse | Reality |
117
+ |---|---|
118
+ | "These documents are usually useful." | Useful is not approval. Ask the user first. |
119
+ | "The feature is almost complete." | Wait for completion evidence before asking. |
120
+ | "I can infer the API fields." | Only document contracts supported by current evidence. |
121
+ | "The user selected one document, so create all three." | Selection is per document type. |
122
+
123
+ ## Verification
124
+
125
+ Before leaving this skill, confirm:
126
+
127
+ - [ ] Completion evidence exists.
128
+ - [ ] The current Codex user received the four-option inquiry only after the automatic gate passed or for a direct documentation request.
129
+ - [ ] Every created document had explicit user approval.
130
+ - [ ] Every document statement is supported by current evidence.
131
+ - [ ] Unselected documents were not created.
132
+ - [ ] The completion output lists created, blocked, and unselected items.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Completion Document Follow-Up"
3
+ short_description: "Offer post-completion technical and handoff docs."
4
+ default_prompt: "Use $devflow-docs-followup to ask which completion documents to create."
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: devflow-find-fault
3
+ description: "Use when a user explicitly asks to find faults, identify the biggest omission, surface blind spots, name uncertainty, run an unease check, 不安感检查, 找茬, 最大遗漏是什么, 我没有意识到什么, 需求细节是否确认, or 眼下你最没有把握的事情是什么. It can run at any task stage and does not read, require, modify, or hand off to devflow-prove, PUA, Build, Learn, or any completion state."
4
+ ---
5
+
6
+ # DevFlow Find Fault
7
+
8
+ Run an independent, user-requested critique of the current task materials. This skill identifies gaps and uncertainty without declaring global task status.
9
+
10
+ ## Entry Gate
11
+
12
+ 1. Confirm the user explicitly requested find-fault review.
13
+ 2. Identify the target materials from the user's request, current files, diff, requirements, tests, or supplied evidence.
14
+ 3. Ask one smallest question when the target is unclear.
15
+ 4. As an independent manual review, do not read, require, or alter `devflow-prove`, PUA, Build, Learn, or any lifecycle state.
16
+
17
+ On DeepSeek Harness (DSH), run this review as a fresh `subagent` with no conversation seed so the critique is genuinely independent of the main agent's reasoning; the subagent returns findings only and never declares lifecycle status, edits files, or invokes another skill.
18
+
19
+ ## Post-Implementation Unease Check
20
+
21
+ When target materials include an implemented feature, diff, or completion-ready result, also inspect whether the implementation has silently decided business behavior the user never confirmed. This check is for requirement-confidence gaps, not code quality or test coverage.
22
+
23
+ 1. Compare explicit requirements, conversation evidence, acceptance criteria, and current behavior against the implementation.
24
+ 2. List every material decision with no direct confirmation, especially: ordering, filtering, defaults, empty states, pagination, permissions, state transitions, exceptions, retries, boundary inputs, and conflicting actor outcomes.
25
+ 3. For each decision, state the encoded behavior or implicit assumption, plausible alternative interpretations, impact if wrong, the confirmation question, and a temporary recommendation.
26
+ 4. Do not invent a missing requirement. Mark the item as an inference or unknown until the user confirms it.
27
+
28
+ ### Unease Risk Classification
29
+
30
+ | Level | Meaning | Typical signals | Completion constraint |
31
+ |---|---|---|---|
32
+ | **High** | A missing decision could materially change the business result, user rights, data correctness, security, money/inventory, irreversible state, or produce clearly different outcomes under reasonable interpretations. | Permission boundary, settlement rule, destructive transition, ownership, data visibility, compliance, or mutually exclusive workflow result. | Do not state that the feature fully meets requirements. Request user confirmation before that claim. |
33
+ | **Medium** | A missing decision changes primary-path experience or rule consistency, but is reversible and does not directly threaten protected rights or correctness. | Sort priority, filter composition, default value, pagination, empty state, retry, or normal error path. | Label the implementation `pending confirmation`; explicitly surface it before delivery. |
34
+ | **Low** | A missing decision does not change business semantics, is easy to reverse, and has a clear ordinary convention. | Non-core wording, visual spacing, or a presentational detail with no rule impact. | Record it; it does not block a completion claim. |
35
+
36
+ If context is too sparse to classify safely, use the highest plausible level and explain the missing evidence. Risk level expresses impact if the assumption is wrong, not confidence in the finding.
37
+
38
+ ### Unease Decision Format
39
+
40
+ ```text
41
+ - Decision: <unconfirmed business detail>
42
+ Current implementation / assumption: <observed behavior or inference>
43
+ Alternative interpretations: <plausible alternatives>
44
+ Risk: high / medium / low — <impact rationale>
45
+ Evidence: <explicit requirement, code/diff behavior, or none>
46
+ Confirmation needed: <one user-facing question>
47
+ Temporary recommendation: <reversible default, or do not proceed for high risk>
48
+ ```
49
+
50
+
51
+ Always answer these questions:
52
+
53
+ 1. What is the biggest omission in the current situation?
54
+ 2. What might the user or agent not have recognized?
55
+ 3. What is currently least certain?
56
+
57
+ Also answer every additional question the user explicitly supplies.
58
+
59
+ For each answer, distinguish:
60
+
61
+ - **Facts**: directly supported by inspected material.
62
+ - **Inference**: a reasoned conclusion that needs confirmation.
63
+ - **Unknowns**: missing material that prevents a reliable conclusion.
64
+ - **Next step**: the smallest manual action that would reduce the uncertainty.
65
+
66
+ ## Required Output
67
+
68
+ ```text
69
+ Find-fault target: <scope reviewed>
70
+ Questions and answers:
71
+ - Biggest omission: <answer>; facts: <facts>; inference: <inference or none>; unknowns: <unknowns or none>; confidence: high/medium/low; next step: <smallest manual action>
72
+ - Unrecognized blind spot: <answer>; facts: <facts>; inference: <inference or none>; unknowns: <unknowns or none>; confidence: high/medium/low; next step: <smallest manual action>
73
+ - Least certain point: <answer>; facts: <facts>; inference: <inference or none>; unknowns: <unknowns or none>; confidence: high/medium/low; next step: <smallest manual action>
74
+ - User question: <question>; answer: <answer>; facts: <facts>; inference: <inference or none>; unknowns: <unknowns or none>; confidence: high/medium/low; next step: <smallest manual action>
75
+ Unease check: run / not applicable — <why>
76
+ - Decision: <unconfirmed business detail>; current implementation / assumption: <observed behavior or inference>; alternative interpretations: <plausible alternatives>; risk: high/medium/low — <impact rationale>; evidence: <facts or none>; confirmation needed: <one user-facing question>; temporary recommendation: <reversible default, or do not proceed for high risk>
77
+ Findings:
78
+ - Critical: <finding or none>; evidence: <facts>; confidence: high/medium/low
79
+ - Important: <finding or none>; evidence: <facts>; confidence: high/medium/low
80
+ - Observation: <finding or none>; evidence: <facts>; confidence: high/medium/low
81
+ Context limitations: <unavailable material or none>
82
+ Suggested next action: <manual action for the user, or none>
83
+ ```
84
+
85
+ `Suggested next action` is advice only. Do not automatically edit files, create tasks, invoke another skill, or change lifecycle state.
86
+
87
+ ## Anti-Rationalization
88
+
89
+ | Excuse | Reality |
90
+ |---|---|
91
+ | "There is no proof of a problem." | Name the uncertainty instead of inventing certainty. |
92
+ | "A hypothesis is enough." | Label hypotheses as inference and show their evidence gap. |
93
+ | "The default questions are enough." | Answer each explicit user question too. |
94
+ | "Another skill has a status." | Do not read or change that status. |
95
+ | "The implementation is reasonable." | Reasonable defaults are still unconfirmed decisions; run the unease check. |
96
+ | "Tests pass, so requirements are met." | Tests prove encoded behavior, not that the user confirmed its business rule. |
97
+ | "It is only a UI detail." | Classify impact first; ordering, filters, defaults, and empty states can change user outcomes. |
98
+
99
+ ## Verification
100
+
101
+ Before leaving this skill, confirm:
102
+
103
+ - [ ] The user explicitly requested find-fault review.
104
+ - [ ] All three default questions were answered.
105
+ - [ ] Each user-supplied question was answered.
106
+ - [ ] Facts, inference, unknowns, confidence, next steps, and limitations are visible.
107
+ - [ ] For implemented targets, the unease check ran and every material unconfirmed decision has risk, rationale, confirmation question, and temporary recommendation.
108
+ - [ ] High-risk unease decisions are not presented as fully requirement-complete; medium-risk decisions are marked `pending confirmation`.
109
+ - [ ] No lifecycle state, code, or other skill was changed or invoked.
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: devflow-learn
3
+ description: "Use after every verified DevFlow PASS to proactively extract useful reusable knowledge, or when the user says wrong, not like that, changed wrong, remember, learn, 沉淀, 下次不要, 放错位置, 改歪了, 没改对, 不是我要的, 少了, 少个, 缺漏, 遗漏, or when a repeated user correction, reusable pitfall, project convention, or .copilot learning-card update appears."
4
+ ---
5
+
6
+ # DevFlow Learn
7
+
8
+ Turn verified work, corrections, and pitfalls into reusable intercept rules without bloating context.
9
+
10
+ ## Completion Review
11
+
12
+ Every `devflow-prove` judgment of `PASS` must enter this lightweight review before final completion reporting. Review both successful and failed paths from the completed task; do not wait for a correction or pitfall signal.
13
+
14
+ Extract only knowledge that can help a future task:
15
+
16
+ - a proven implementation or reuse pattern
17
+ - a decision tied to a constraint or tradeoff
18
+ - an effective validation method
19
+ - a non-obvious repository convention or invariant
20
+ - a costly, counterintuitive, repeated, or project-wide lesson
21
+ - a confirmed project-business fact that may require knowledge-package maintenance
22
+
23
+ `PASS` requires the review, not a new record. If no useful reusable knowledge remains after classification, report that result and create nothing.
24
+
25
+ | Review result | Action | Store |
26
+ |---|---|---|
27
+ | Reusable execution experience or proven work pattern | Create or update one focused card | `.copilot/cards/` |
28
+ | Confirmed business fact changed | Report a project-knowledge candidate and wait for user confirmation | `docs/project-knowledge/` after confirmation via `devflow-project-knowledge` |
29
+ | Ordinary detail, one-off fact, already-covered lesson, or pure refactor without insight | Report no useful record | none |
30
+
31
+ Project-knowledge candidates include changed domain semantics, rules, boundaries, entity/DTO/enum meaning, API or table boundaries, module responsibility, job behavior, and task entry points. `devflow-learn` must not update the package itself or infer business facts without evidence.
32
+
33
+ ## Process
34
+
35
+ 1. Detect the learning signal:
36
+ - `devflow-prove` `PASS` completion review, user correction, repeated user correction, repeated user challenge, repeated missing-piece complaint, changed-wrong result, wrong assumption, repeated failure, skipped validation, missed project convention, misplaced content, or non-obvious pitfall
37
+ 2. Probe `.copilot/LEARNING_INDEX.md`. Read `.copilot/LEARNING_INDEX.md` when it exists; otherwise record that learning recall is absent.
38
+ 3. Match the current task against card Trigger and Scope. Read only matched cards; do not load all `.copilot/cards/**`.
39
+ 4. Extract a candidate from the task's implementation, decisions, proof, and business impact.
40
+ 5. Decide whether to record:
41
+ - record if the candidate is cross-task reusable and proven useful, costly if missed, counterintuitive, non-obvious, repeated, or project-wide
42
+ - report a project-knowledge candidate if code-backed business semantics changed; wait for user confirmation before calling `devflow-project-knowledge`
43
+ - skip if it is ordinary narration, a one-off fact, already covered, or too context-specific
44
+ 6. Create `.copilot/LEARNING_INDEX.md`, `.copilot/cards/`, and one focused card only when the result belongs in project learning; do not create empty learning storage after a no-record review.
45
+ 7. Update `.copilot/LEARNING_INDEX.md` when a card changed.
46
+ 8. Report learning closure before completion.
47
+
48
+ ## Repeat Correction Gate
49
+
50
+ Repeated correction is not optional learning. If the user corrects the same boundary, placement, workflow, or wording rule twice in one task lifecycle, create or update a learning card before claiming completion.
51
+
52
+ Repeated challenge is also not optional learning. If the user says the result was wrong, changed wrong, missed the target, missing pieces, or not what they wanted twice in one task lifecycle, record the next-time intercept after `devflow-pua` identifies the reusable mistake pattern.
53
+
54
+ Repeated missing-piece feedback is also not optional learning when the same task already went through recovery. If the user says "少了这个/少个那个/缺漏/遗漏/漏了" after a prior attempt or after a method switch, record the missing coverage pattern and the next method switch rule.
55
+
56
+ Required pressure-recovery card action:
57
+
58
+ ```text
59
+ - Trigger: <task signal>, user challenge, changed wrong, repeated miss, repeated missing-piece complaint
60
+ - Lesson: <what goal/result was misunderstood>
61
+ - Next action: Next time encountering <X>, first stop the current path, classify the user-view miss, build a Coverage Map for missing pieces, restate the desired result, ask or infer the pointed result questions, then switch to a different/opposite method before editing.
62
+ ```
63
+
64
+ Misplaced content counts as a reusable pitfall when a rule, prompt, method detail, plan, or explanation was put in the wrong artifact, such as:
65
+
66
+ - README-style explanation inside `AGENTS.md`
67
+ - runtime method details under `docs/` instead of `skills/*/references/*`
68
+ - brand/project summaries inside skill `description`
69
+ - plan or audit material inside a runtime prompt
70
+
71
+ Required card action:
72
+
73
+ ```text
74
+ - Trigger: <artifact or task signal>, wrong place, misplaced content, repeated correction
75
+ - Lesson: <what was placed in the wrong artifact>
76
+ - Next action: Next time editing <artifact>, first check the target owner, then put <content type> in <correct place>, not <wrong place>.
77
+ ```
78
+
79
+ ## Storage Contract
80
+
81
+ Project learning lives in:
82
+
83
+ ```text
84
+ .copilot/
85
+ LEARNING_INDEX.md
86
+ cards/<short-kebab-name>.md
87
+ ```
88
+
89
+ Keep cards small. A card must answer what to do next time.
90
+
91
+ Learning storage is lazily created only by this skill after a qualifying reusable execution lesson. Recall does not create it.
92
+
93
+ ## Knowledge Boundaries
94
+
95
+ | Store | Owns | Does not own |
96
+ |---|---|---|
97
+ | `graphify-out/` | Structural code graph, communities, and dependency relationships | Execution lessons or curated business guidance |
98
+ | `.copilot/cards/` | Execution experience, intercept rules, and proven work patterns | Business reference documentation |
99
+ | `docs/project-knowledge/` | Curated, code-backed business facts, boundaries, and task entry points | Agent mistakes or raw implementation history |
100
+
101
+ Handoff: `devflow-prove PASS` -> `devflow-learn` review -> project-knowledge candidate -> user confirmation -> `devflow-project-knowledge` lazy maintenance of `docs/project-knowledge/`. Only after a verified feature implementation with an actual source-behavior or interface-contract change may `devflow-learn` hand off to `devflow-docs-followup` for an optional documentation inquiry. Do not automatically hand off validation-only, documentation-only, rule-only, skill-only, or no-diff `PASS` results.
102
+
103
+ ## Card Format
104
+
105
+ ```text
106
+ # <Short Name>
107
+
108
+ - Trigger: <next time signal>
109
+ - Lesson: <what this work taught>
110
+ - Next action: Next time encountering <X>, first do <Y>, do not do <Z>.
111
+ - Scope: session | project | global | skill | module
112
+ - Related: <files or commands>
113
+ - Evidence: <checked source, command, or verified correction that supports this card>
114
+ - Invalidation: <changed contract, failed proof, or review trigger that requires this card to be revised or retired>
115
+ ```
116
+
117
+ ## Index Format
118
+
119
+ ```text
120
+ # Learning Index
121
+
122
+ Read this index first. Only read a card when its trigger matches the current task.
123
+
124
+ | Card | Trigger | Scope | Confidence |
125
+ |---|---|---|---:|
126
+ | [Card Name](cards/card-name.md) | trigger words | project | 0.5 |
127
+ ```
128
+
129
+ ## Promotion Rules
130
+
131
+ | Signal count | Action |
132
+ |---:|---|
133
+ | 1 | Create/update card, confidence 0.3-0.5 |
134
+ | 2 | Raise confidence and force recall before acting |
135
+ | 3 | Propose `AGENTS.md` or platform rule update |
136
+ | 4+ | Propose skill or command automation |
137
+ | User explicitly says remember/learn/沉淀 | Promote immediately if scope is clear |
138
+
139
+ ## Completion Output
140
+
141
+ Always report:
142
+
143
+ ```text
144
+ Learning closure:
145
+ - Learning signal: PASS review/correction/pitfall/none
146
+ - Recall record: none/index/card
147
+ - Knowledge recall: none/learning index + matched card/project knowledge candidate
148
+ - Review result: learning card/project-knowledge candidate/no useful record
149
+ - New sediment: none/learning card/rule/skill
150
+ - Next intercept: next time <X>, first do <Y>, do not do <Z>
151
+ ```
152
+
153
+ ## Anti-Rationalization
154
+
155
+ | Excuse | Reality |
156
+ |---|---|
157
+ | "This was just a correction." | Corrections reveal future intercepts. Check if reusable. |
158
+ | "The task passed, so there is nothing to learn." | PASS proves the work; proactively review its implementation, decision, proof, and business impact. |
159
+ | "The user already told me where it goes." | Repeated placement corrections must become a card so the next run recalls them before acting. |
160
+ | "The user only complained about quality." | Repeated challenge is a reusable signal when the miss pattern can repeat. |
161
+ | "I'll remember it." | Memory without an index is not recallable. |
162
+ | "Let's store everything." | Too many cards become noise; record only repeatable or costly lessons. |
163
+ | "Read all cards just in case." | Index first, matched card only. |
164
+
165
+ ## Verification
166
+
167
+ Before leaving this skill, confirm:
168
+
169
+ - [ ] Learning signal was classified.
170
+ - [ ] Every `PASS` ran a proactive completion review before final completion reporting.
171
+ - [ ] `LEARNING_INDEX.md` was checked or created.
172
+ - [ ] Only matched cards were read.
173
+ - [ ] Repeated user corrections, repeated user challenges, and misplaced content were recorded or explicitly classified as already covered.
174
+ - [ ] New or updated card has trigger, lesson, next action, scope, related files, evidence, and invalidation condition.
175
+ - [ ] Business-semantic changes were reported as candidates and await user confirmation before knowledge-package maintenance.
176
+ - [ ] Completion output includes learning closure.