@relipa/ai-flow-kit 0.1.7 → 0.1.8-beta.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.
package/README.md CHANGED
@@ -459,7 +459,7 @@ ak validate src/Payment.java --ruleset strict
459
459
 
460
460
  ### `ak memory`
461
461
 
462
- Draft, submit, and remove entries in the `99.Memory/` Project Brain (`AK-Docs/99.Memory/`) — see [Memory-Architecture-v1.0.md](docs/internal/Memory-Architecture-v1.0.md). Drafts are local-only until submitted; PM reviews and merges the Merge Request before a memory becomes team-visible.
462
+ Draft, submit, and remove entries in the `99.Memory/` Project Brain (`AK-Docs/99.Memory/`) — see [Memory-Architecture-v1.0.md](docs/common/Memory-Architecture-v1.0.md). Drafts are local-only until submitted; PM reviews and merges the Merge Request before a memory becomes team-visible.
463
463
 
464
464
  ```bash
465
465
  ak memory draft --category 01.Lessons/dev --function-id F-003_Payment \
package/bin/aiflow.js CHANGED
@@ -14,6 +14,7 @@ const contextCommand = require('../scripts/context');
14
14
  const promptCommand = require('../scripts/prompt');
15
15
  const removeCommand = require('../scripts/remove');
16
16
  const guideCommand = require('../scripts/guide');
17
+ const askCommand = require('../scripts/ask');
17
18
  const telemetryCommand= require('../scripts/telemetry/cli');
18
19
  const taskCommand = require('../scripts/task');
19
20
  const checkpointCommand = require('../scripts/checkpoint');
@@ -349,7 +350,7 @@ program
349
350
  });
350
351
  });
351
352
 
352
- // ── memory (99.Memory/ Project Brain — see docs/internal/Memory-Architecture-v1.0.md) ──
353
+ // ── memory (99.Memory/ Project Brain — see docs/common/Memory-Architecture-v1.0.md) ──
353
354
  // Same "AI drafts — human approves via MR" pattern as `docs` below: drafts are local-only
354
355
  // (_pending/, gitignored) until `submit` opens a Merge Request for PM review.
355
356
  const memCmd = program.command('memory').alias('mem').description('Manage 99.Memory/ project knowledge (draft, list, submit, remove)');
@@ -396,7 +397,7 @@ memCmd
396
397
  .action((path, options) => { memoryCommand('remove', { ...options, _positional: [path] }); });
397
398
 
398
399
  // ── docs (branch + Merge Request workflow for AK-Docs/Shared-Docs) ─────
399
- // See docs/internal/Docs-Management-Flow.md — PM reviews & merges `main`;
400
+ // See docs/common/Docs-Management-Flow.md — PM reviews & merges `main`;
400
401
  // every other role updates docs on feature/<functionId>/<taskId> from main.
401
402
  const docsCmd = program.command('docs').description('Branch & Merge Request workflow for AK-Docs/Shared-Docs (see Docs-Management-Flow.md)');
402
403
 
@@ -439,6 +440,15 @@ program
439
440
  guideCommand(options);
440
441
  });
441
442
 
443
+ // ── ask ───────────────────────────────────────────────────────
444
+ program
445
+ .command('ask <question>')
446
+ .description('Search ai-flow-kit docs for an answer about the kit itself (install, roles, memory, CLI...)')
447
+ .option('-n, --limit <n>', 'max number of results to show', '3')
448
+ .action((question, options) => {
449
+ askCommand(question, { limit: options.limit });
450
+ });
451
+
442
452
  // ── telemetry feedback helper ─────────────────────────────────
443
453
  function showTelResult(result, label) {
444
454
  try {
@@ -80,4 +80,4 @@ Before saving any requirement, plan, TDD-notes, review, or PR file, verify:
80
80
  - **Review checklist:** `custom/rules/review-checklist.md`
81
81
  - **Code style:** `custom/rules/code-style.md`
82
82
  - **Naming:** `custom/rules/naming.md`
83
- - **Folder structure reference:** `docs/internal/Coding-Structure.md` · `docs/internal/Project-Structure.md`
83
+ - **Folder structure reference:** `docs/common/Coding-Structure.md` · `docs/common/Project-Structure.md`
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: aiflow-help
3
+ description: Answers questions about ai-flow-kit itself (install, roles, folder structure, CLI commands, memory draft/submit, troubleshooting) — trigger on install/setup/how-do-I-use-this/roles/folder-structure/memory-submit questions or an AKQ:/[AKQ]: prefix, even with no active ticket; skip for actual coding/ticket work. Read docs/common/INDEX.md first, cite the file used, and say plainly if a topic isn't documented instead of guessing.
4
+ keywords: aiflow, ai-flow-kit, ak, install, cai dat, huong dan, PM, role, folder structure, thu muc, memory, submit memory, cli, commands, AKQ, how to use, huong dan su dung
5
+ ---
6
+
7
+ # AI Flow Kit — Self-Help
8
+
9
+ Answers questions **about ai-flow-kit itself** — not about the ticket/feature the developer is currently building. Examples: "how do I install this", "I'm a PM, how do I use ai kit", "give me an overview of the folder flow", "how do I manually create and submit a memory".
10
+
11
+ ## When this applies
12
+
13
+ - The message is prefixed with `AKQ:` or `[AKQ]:` — always treat it as a self-help question, whatever else it contains.
14
+ - Or the message asks about install/setup, roles (PM/DEV/AI), folder/`AK-Docs` structure, CLI commands, the `99.Memory/` workflow, switching between Claude Code/Cursor/Gemini, or troubleshooting — **even when there is no active ticket** in `.aiflow/context/current.json`.
15
+ - Does **not** apply to requests to analyze, implement, fix, or review an actual ticket/feature — that's the Gate Workflow's job, not this skill's.
16
+
17
+ ## What to do
18
+
19
+ 1. Do **not** auto-start Gate 1 for this turn — this is a support question, not a coding task.
20
+ 2. Read `docs/common/INDEX.md` (in a scaffolded project this is copied to `.aiflow/docs/INDEX.md`; inside the ai-flow-kit repo itself it's `docs/common/INDEX.md`).
21
+ 3. Match the question against the "Ask about" table and read the linked doc file(s) — don't answer from memory of what ai-flow-kit "probably" does; the CLI's actual sub-commands and options change between versions (check `CHANGELOG.md` if anything looks stale).
22
+ 4. Answer directly and concisely, in whatever language the user asked in. Cite the file path you read from (e.g. "per `docs/common/cli-reference.md`").
23
+ 5. If the topic is listed under INDEX.md's "Unanswered topics", or isn't covered anywhere: say plainly it isn't documented yet, point to the closest related doc, and suggest `ak guide` (quickstart + command reference) or `ak ask "<question>"` (local keyword search across the docs) as a fallback. Never invent a command, flag, or file path that you haven't actually read.
24
+
25
+ ## After answering
26
+
27
+ Stay in this mode for follow-up questions in the same vein. Only return to the normal Gate Workflow once the developer starts talking about an actual ticket/feature again.
@@ -166,7 +166,7 @@ Create file `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`:
166
166
 
167
167
  ### Step 2.5: Retrospect + propose memory drafts
168
168
 
169
- Synthesize what was learned this task. **Priority order — human corrections first:** if this is a repeat pass through Gate 4 (the developer already sent "BUG: ..." at least once this task), the developer's own correction is the single highest-value lesson — scan back through this session for it and draft it even if you already drafted something for the earlier BUG at Step 4 (dedup will catch an exact repeat; don't skip capturing it out of caution). Only after that, add anything else genuinely new: architecture facts discovered, decisions made and why. For each candidate, create a **local draft** (no approval needed yet — `_pending/` is local-only, doc `docs/internal/Memory-Architecture-v1.0.md`):
169
+ Synthesize what was learned this task. **Priority order — human corrections first:** if this is a repeat pass through Gate 4 (the developer already sent "BUG: ..." at least once this task), the developer's own correction is the single highest-value lesson — scan back through this session for it and draft it even if you already drafted something for the earlier BUG at Step 4 (dedup will catch an exact repeat; don't skip capturing it out of caution). Only after that, add anything else genuinely new: architecture facts discovered, decisions made and why. For each candidate, create a **local draft** (no approval needed yet — `_pending/` is local-only, doc `docs/common/Memory-Architecture-v1.0.md`):
170
170
 
171
171
  ```
172
172
  ak memory draft --category 01.Lessons/dev --function-id [functionId] \
@@ -4,4 +4,4 @@
4
4
  > **Do not edit this file by hand** — it is rebuilt from the frontmatter of every `status: approved` file under `99.Memory/`.
5
5
  > One line per memory: `- [mem-id](path/to/file.md) — <hook ≤15 từ> (type, scope, workflows)`
6
6
 
7
- See `docs/internal/Memory-Architecture-v1.0.md` in ai-flow-kit for the full design.
7
+ See `.aiflow/docs/Memory-Architecture-v1.0.md` in this project (or `docs/common/Memory-Architecture-v1.0.md` in the ai-flow-kit repo) for the full design.
@@ -0,0 +1,15 @@
1
+ ## /ak-ask — Ask a Question About ai-flow-kit Itself
2
+
3
+ **Why this command exists:** the `aiflow-help` skill normally triggers on keyword match or an `AKQ:` / `[AKQ]:` prefix, but that detection can be missed or ambiguous — especially when a question about ai-flow-kit's own usage (install, roles, folder structure, CLI, memory workflow) is phrased in a way that overlaps with real ticket work. `/ak-ask` is an explicit, unambiguous trigger: whatever follows is a self-help question about the kit, not the developer's current ticket.
4
+
5
+ **Question:** $ARGUMENTS
6
+
7
+ **Steps — do these now, in order:**
8
+
9
+ 1. Do **not** treat this as ticket/coding work — do not touch `.aiflow/context/current.json` or start any Gate.
10
+ 2. Read the topic index — `docs/common/INDEX.md` (inside the ai-flow-kit repo itself) or `.aiflow/docs/INDEX.md` (in a scaffolded project).
11
+ 3. Match the question above against the "Ask about" table in that index, and read the linked doc file(s). Don't answer from memory of what ai-flow-kit "probably" does — CLI sub-commands and options change between versions (check `docs/common/CHANGELOG.md` if anything looks stale).
12
+ 4. Answer directly and concisely, in whatever language the question was asked in. Cite the file path you read from (e.g. "per `docs/common/cli-reference.md`").
13
+ 5. If the topic is listed under INDEX.md's "Unanswered topics", or isn't covered anywhere: say plainly it isn't documented yet, point to the closest related doc, and suggest `ak guide` (quickstart + command reference) or `ak ask "<question>"` (local keyword search across the docs, run from the terminal) as a fallback. Never invent a command, flag, or file path you haven't actually read.
14
+
15
+ Stay in this self-help mode for follow-up questions in the same vein; return to normal Gate Workflow once the developer starts talking about an actual ticket/feature.
@@ -443,7 +443,7 @@ File phân tích: [02.BA-Specs/01.Analysis/[functionId]/Analysis_v(n+1).md](02
443
443
 
444
444
  #### Bước 7.5: Retrospect + đề xuất memory draft
445
445
 
446
- Sau khi Gate 4 APPROVED, đúc kết những gì học được. **Ưu tiên feedback của BA trước:** nếu có vòng `REVISION` nào đã xảy ra, đảm bảo điều BA sửa đã có draft (thường đã tạo ngay lúc REVISION ở trên — kiểm tra lại, đừng bỏ sót). Sau đó mới thêm những gì mới khác: business rule mới confirm, thuật ngữ cần làm rõ, quyết định đặc tả và lý do. Tạo **draft local** cho từng candidate (chưa cần duyệt — `_pending/` chỉ ở local, xem `docs/internal/Memory-Architecture-v1.0.md`):
446
+ Sau khi Gate 4 APPROVED, đúc kết những gì học được. **Ưu tiên feedback của BA trước:** nếu có vòng `REVISION` nào đã xảy ra, đảm bảo điều BA sửa đã có draft (thường đã tạo ngay lúc REVISION ở trên — kiểm tra lại, đừng bỏ sót). Sau đó mới thêm những gì mới khác: business rule mới confirm, thuật ngữ cần làm rõ, quyết định đặc tả và lý do. Tạo **draft local** cho từng candidate (chưa cần duyệt — `_pending/` chỉ ở local, xem `docs/common/Memory-Architecture-v1.0.md`):
447
447
 
448
448
  ```
449
449
  ak memory draft --category 00.Shared/domain --function-id [functionId] \
@@ -487,7 +487,7 @@ Trước khi ghi bất kỳ file nào vào `03.Testing/`, đảm bảo AK-Docs
487
487
 
488
488
  #### Bước 7.5: Retrospect + đề xuất memory draft
489
489
 
490
- Sau khi Gate 4 APPROVED, đúc kết những gì học được. **Ưu tiên trước:** nếu review ở Bước 7 từng phát hiện Major/Critical issue phải sửa lại, đó là bài học giá trị nhất — đảm bảo có draft cho đúng issue đó. Sau đó mới thêm lỗi/bẫy môi trường gặp khi test, business rule cần làm rõ thêm. Tạo **draft local** cho từng candidate (chưa cần duyệt — `_pending/` chỉ ở local, xem `docs/internal/Memory-Architecture-v1.0.md`):
490
+ Sau khi Gate 4 APPROVED, đúc kết những gì học được. **Ưu tiên trước:** nếu review ở Bước 7 từng phát hiện Major/Critical issue phải sửa lại, đó là bài học giá trị nhất — đảm bảo có draft cho đúng issue đó. Sau đó mới thêm lỗi/bẫy môi trường gặp khi test, business rule cần làm rõ thêm. Tạo **draft local** cho từng candidate (chưa cần duyệt — `_pending/` chỉ ở local, xem `docs/common/Memory-Architecture-v1.0.md`):
491
491
 
492
492
  ```
493
493
  ak memory draft --category 01.Lessons/qa --function-id [functionId] \
@@ -655,7 +655,7 @@ Bugs logged: [N] | Skipped: [N]
655
655
  - **Markdown:** Save to `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md` (or the custom path/format noted in the requirement doc — e.g. Excel; still write a short pointer + summary into this file so the AK-Docs history stays complete)
656
656
  4. Self-review: verify content completeness against the approved requirement outline
657
657
  5. Create `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId]-summary.md` with a brief summary of what was generated
658
- 5.5. **Retrospect + propose memory drafts:** synthesize anything genuinely new learned while producing this document (architecture fact, business rule, decision) and create a **local draft** for each (no approval needed yet — `_pending/` is local-only, see `docs/internal/Memory-Architecture-v1.0.md`):
658
+ 5.5. **Retrospect + propose memory drafts:** synthesize anything genuinely new learned while producing this document (architecture fact, business rule, decision) and create a **local draft** for each (no approval needed yet — `_pending/` is local-only, see `docs/common/Memory-Architecture-v1.0.md`):
659
659
  ```
660
660
  ak memory draft --category 00.Shared/architecture --function-id [functionId] \
661
661
  --slug <short-kebab-slug> --content "<≤150 words, 1 fact>" \
@@ -11,3 +11,7 @@ If Gate 1 does not auto-start, wait for the developer to type **"start"**, **"Ga
11
11
  - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
12
12
  - **NEVER BATCH QUESTIONS:** Only ask one question per message.
13
13
  - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
14
+
15
+ ## Asking about ai-flow-kit itself
16
+
17
+ If the developer's message is prefixed with `AKQ:` or `[AKQ]:`, OR is a question about ai-flow-kit itself (install/setup, roles, folder structure, CLI commands, memory draft/submit, troubleshooting, switching AI tools) rather than the current ticket — even when no ticket context is loaded — do **not** auto-start Gate 1. Instead follow `.claude/skills/aiflow-help/SKILL.md`.
@@ -10,3 +10,7 @@ If Gate 1 doesn't auto-start, wait for the developer to type **"start"**, **"Gat
10
10
  - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
11
11
  - **NEVER BATCH QUESTIONS:** Only ask one question per message.
12
12
  - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
13
+
14
+ ## Asking about ai-flow-kit itself
15
+
16
+ If the developer's message is prefixed with `AKQ:` or `[AKQ]:`, OR is a question about ai-flow-kit itself (install/setup, roles, folder structure, CLI commands, memory draft/submit, troubleshooting, switching AI tools) rather than the current ticket — even when no ticket context is loaded — do **not** auto-start Gate 1. Instead follow `.claude/skills/aiflow-help/SKILL.md`.
@@ -12,6 +12,10 @@ If no instructions are automatically followed, wait for the developer to type **
12
12
  - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
13
13
  - **PROJECT CONVENTIONS:** Before writing any output file (plan, requirement, summary), read `custom/rules/project-conventions.md`. These rules override upstream skill defaults.
14
14
 
15
+ ## Asking about ai-flow-kit itself
16
+
17
+ If the developer's message is prefixed with `AKQ:` or `[AKQ]:`, OR is a question about ai-flow-kit itself (install/setup, roles, folder structure, CLI commands, memory draft/submit, troubleshooting, switching AI tools) rather than the current ticket — even when no ticket context is loaded — do **not** wait for "start"/"Gate 1". Instead follow `.claude/skills/aiflow-help/SKILL.md`.
18
+
15
19
  ## Telemetry Command (detect once, use everywhere)
16
20
 
17
21
  Before the first gate, run this to detect the correct `ak` command for your environment:
@@ -0,0 +1,86 @@
1
+ # BA-Specs — Folder Structure
2
+
3
+ > **Managed by:** BA
4
+ > **Organized by:** Output Type → Function-ID → Version
5
+ > **Naming:** Function-ID format `F-001_User-Login`
6
+ > **Note:** Templates are managed in a separate shared repo.
7
+
8
+ ---
9
+
10
+ ## Folder Tree
11
+
12
+ ```
13
+ 02.BA-Specs/
14
+
15
+ ├── 00.Requirements/ # Requirements Gathering
16
+ │ └── F-001_User-Login/
17
+ │ ├── Raw-Requirements_v1.md # Raw input: ticket, meeting note, email
18
+ │ └── assets/ # Images, attachments, recordings
19
+
20
+ ├── 01.Analysis/ # Gate 1: Business Analysis
21
+ │ └── F-001_User-Login/
22
+ │ ├── Analysis_v1.md # Current version
23
+ │ └── Analysis_v2.md # Updated when requirements change
24
+
25
+ ├── 02.QnA/ # Gate 2: Q&A nội bộ với stakeholder
26
+ │ └── F-001_User-Login/
27
+ │ └── QnA-Log_v1.md # Q&A loop until all Confirmed
28
+
29
+ ├── 03.UI-Prototypes/ # Gate 3: UI/UX Design
30
+ │ └── F-001_User-Login/
31
+ │ └── UI-Prototype_v1.html # Static HTML/CSS prototype
32
+
33
+ └── 04.UC-Specs/ # Gate 4: Final UC Specification
34
+ └── F-001_User-Login/
35
+ ├── UC-Spec_v2.md # Current version (BA sign-off)
36
+ └── _archive/
37
+ └── UC-Spec_v1.md # Previous versions
38
+ ```
39
+
40
+ ---
41
+
42
+ ## File Naming Convention
43
+
44
+ | Element | Convention | Example |
45
+ |---|---|---|
46
+ | Section folder | `{N}.{Pascal-Case}/` | `00.Requirements/`, `03.UI-Prototypes/` |
47
+ | Feature folder | `F-{3-digit}_{Pascal-Case}/` | `F-001_User-Login/` |
48
+ | Requirements file | `Raw-Requirements_v{N}.md` | `Raw-Requirements_v1.md` |
49
+ | Analysis file | `Analysis_v{N}.md` | `Analysis_v2.md` |
50
+ | QnA file | `QnA-Log_v{N}.md` | `QnA-Log_v1.md` |
51
+ | Prototype file | `UI-Prototype_v{N}.html` | `UI-Prototype_v1.html` |
52
+ | Spec file | `UC-Spec_v{N}.md` | `UC-Spec_v2.md` |
53
+ | Archive folder | `_archive/` | `04.UC-Specs/F-001-User-Login/_archive/` |
54
+
55
+ ---
56
+
57
+ ## Gate → Folder Mapping
58
+
59
+ | Gate | Output | Folder |
60
+ |---|---|---|
61
+ | Gate 1 | Phân tích sơ bộ + Q&A clarify | `00.Requirements/` + `01.Analysis/` |
62
+ | Gate 2 | Q&A loop → Confirmed | `02.QnA/` |
63
+ | Gate 3 | UI Prototype | `03.UI-Prototypes/` |
64
+ | Gate 4 | UC Spec hoàn chỉnh (BA ký off) | `04.UC-Specs/` |
65
+
66
+ ---
67
+
68
+ ## Function-List.md Template
69
+
70
+ ```markdown
71
+ | F-ID | Feature Name | BA | Status | Tickets | Link Spec |
72
+ |-------|-------------|--------|-------------|-------------------|-----------|
73
+ | F-001 | User Login | AnhNH | Done | #100, #145, #167 | [link]() |
74
+ | F-002 | Dashboard | LyLT | In Progress | #110, #178 | [link]() |
75
+ | F-003 | ... | ... | Not Started | - | - |
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Rules
81
+
82
+ - Không tự sửa template — template nằm trong shared repo riêng
83
+ - Lưu tài liệu lên GitLab **sau khi Gate 4 được APPROVED**
84
+ - Thông báo cho Dev + Tester sau khi UC Spec sẵn sàng
85
+ - Không xóa file cũ — move vào `_archive/` khi có version mới
86
+ - `02.QnA/` là Q&A nội bộ với stakeholder — khác với `01.QnA/` ngoài dự án (dành cho khách hàng)
@@ -7,12 +7,13 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ---
9
9
 
10
- ## [Unreleased]
11
-
12
10
  ## [0.1.7] - 2026-07-20
13
11
 
14
12
  ### Added
15
13
 
14
+ - **`/ak-ask "<question>"` slash command** — new `.claude/commands/ak-ask.md`, installed alongside `/create-spec`, `/create-testcase`, and `/coding` (via `scripts/init.js`'s `setupClaudeCommands`, also refreshed by `ak update`). Explicit, unambiguous trigger for the `aiflow-help` self-help skill: whatever follows `/ak-ask` is treated as a question about ai-flow-kit itself (install, roles, folder structure, CLI, memory workflow), not the developer's active ticket — no `AKQ:` prefix or keyword match needed. Reuses the same doc lookup as `aiflow-help`/`ak ask`: reads `docs/common/INDEX.md`, cites the file it answered from, and says plainly when a topic isn't documented instead of guessing.
15
+ - **`Docs-Management-Flow.md` promoted from `docs/internal/` to `docs/common/`** — the `AK-Docs`/`Shared-Docs` branch + Merge Request workflow doc (who can merge to `main`, which steps are self-review vs. PM-review) now ships to every project too, cross-linked from `INDEX.md`. Its own header still says `Trạng thái: Draft — chờ PM review`, so `ak-ask`/`aiflow-help` should flag that status rather than presenting it as finalized policy. Repointed `bin/aiflow.js`'s `docs` command and `scripts/docs-branch.js` from `docs/internal/...` to `docs/common/...`.
16
+ - **`Project-Structure.md`, `BA-Specs-Structure.md`, `Coding-Structure.md`, `Testing-Structure.md`, and `Memory-Architecture-v1.0.md` promoted from `docs/internal/` to `docs/common/`** — these now ship to every project (`.aiflow/docs/`, via `copyDocsToProject`) instead of staying npm-package-only, so `aiflow-help`/`ak ask`/`/ak-ask` can actually answer the "full `AK-Docs/` folder-structure reference" question that `docs/common/INDEX.md` previously listed as undocumented. `INDEX.md` gained a topic-map row for each file; all in-repo references (`README.md`, `custom/rules/project-conventions.md`, the DEV/BA/QA gate workflow templates, `review-plan`, the memory CLI/hook source comments, the `99.Memory/MEMORY.md` skeleton) were repointed from `docs/internal/...` to `docs/common/...`. `Memory-Architecture-v1.0.md` is a v1.1 architecture doc describing 4 operating flows end-to-end — only Phase 1 (`ak memory draft/list/submit/remove`) is actually implemented; the rest is roadmap, not shipped behavior, so `ak-ask`/`aiflow-help` must say so rather than imply the full doc is live. Historical release notes (`docs/internal/releases/`) and past changelog entries still say `docs/internal/...` and were intentionally left as-is (accurate at time of writing).
16
17
  - **`99.Memory/` Project Brain — Phase 1** (`docs/internal/Memory-Architecture-v1.0.md`, v1.1). A git-based, human-approved team knowledge base living inside `AK-Docs/99.Memory/`, replacing the legacy `.aiflow/memory/` JSON store whose only "auto-load" function was dead code no hook ever called. AI now accumulates lessons/facts/decisions across tasks, scored and recalled automatically at session start.
17
18
  - **`scripts/memory-store.js`** — new engine: `99.Memory/` skeleton bootstrap; `mem-<functionId>-<slug>` id scheme with folder-per-functionId layout (`_global/` for cross-project facts, flat for `glossary`/`decisions`); hand-rolled frontmatter parse/serialize (no new YAML dependency); dedup-aware draft creation (a repeated slug in the same folder surfaces as a conflict instead of silently duplicating); the §5.2 scoring formula (folder/workflow/tag match, confidence, staleness decay, pending penalty); the Layer-2 relevant-set loader (top-N within a token budget); a local hit-count ledger. Deliberately **dependency-free** (no `fs-extra`/`chalk`) — this file is copied standalone into `.claude/lib/memory-store.js` in every project so the session-start hook can `require()` it without the kit's own `node_modules`.
18
19
  - **`scripts/memory.js`** — full rewrite: `ak memory draft|list|submit|remove`, replacing the old `save/get/list/search/delete/clear`. `submit`/`remove` reuse `scripts/docs-branch.js`'s existing branch-then-MR mechanism — same "AI drafts, human approves via Merge Request" model already used by `ak docs branch`/`ak docs submit`.
@@ -0,0 +1,179 @@
1
+ # Coding — Folder Structure
2
+
3
+ > **Managed by:** Dev
4
+ > **Organized by:** Output Type → Function-ID → Ticket-ID
5
+ > **Naming:** Function-ID `F-001_User-Login`, file by `TICKET-ID.md`
6
+ > **Location:** `AK-Docs/04.Coding/` — tách khỏi source repo
7
+ > **Note:** Templates are managed in a separate shared repo.
8
+
9
+ ---
10
+
11
+ ## Folder Tree
12
+
13
+ ```
14
+ 04.Coding/
15
+
16
+ ├── 00.Overview/
17
+ │ └── _Index.md # Tracker: F-ID | Ticket | Dev | Gate | PR
18
+
19
+ ├── 01.Requirements/ # Gate 1: AI phân tích ticket + source code
20
+ │ └── F-001_User-Login/
21
+ │ ├── TICKET-100.md # Initial implementation
22
+ │ └── TICKET-145.md # Enhancement (remember me)
23
+
24
+ ├── 02.Plans/ # Gate 2: TDD implementation plan chi tiết
25
+ │ └── F-001_User-Login/
26
+ │ ├── TICKET-100.md
27
+ │ └── TICKET-145.md
28
+
29
+ ├── 03.TDD-Notes/ # Gate 3: Test list viết trước + implementation notes
30
+ │ └── F-001_User-Login/
31
+ │ ├── TICKET-100.md
32
+ │ └── TICKET-145.md
33
+
34
+ ├── 04.Reviews/ # Gate 4: Self-review + impact analysis
35
+ │ └── F-001_User-Login/
36
+ │ ├── TICKET-100.md
37
+ │ └── TICKET-145.md
38
+
39
+ └── 05.Pull-Requests/ # Gate 5: PR content + review checklist
40
+ └── F-001_User-Login/
41
+ ├── TICKET-100.md
42
+ └── TICKET-145.md
43
+ ```
44
+
45
+ ---
46
+
47
+ ## File Naming Convention
48
+
49
+ | Element | Convention | Example |
50
+ |---|---|---|
51
+ | Section folder | `{N}.{Pascal-Case}/` | `01.Requirements/`, `03.TDD-Notes/` |
52
+ | Feature folder | `F-{3-digit}_{Pascal-Case}/` | `F-001_User-Login/` |
53
+ | Document file | `TICKET-{ID}.md` | `TICKET-100.md` |
54
+
55
+ ---
56
+
57
+ ## Gate → Folder Mapping
58
+
59
+ | Gate | Output | Folder |
60
+ |---|---|---|
61
+ | Gate 1 | Requirement analysis + source code analysis + proposed solution | `01.Requirements/F-001/TICKET-100.md` |
62
+ | Gate 2 | TDD implementation plan: step-by-step, file list, test-first | `02.Plans/F-001/TICKET-100.md` |
63
+ | Gate 3 | Test list (written before code) + notes during implementation | `03.TDD-Notes/F-001/TICKET-100.md` |
64
+ | Gate 4 | Self-review: test results, impact analysis, review checklist | `04.Reviews/F-001/TICKET-100.md` |
65
+ | Gate 5 | PR description + reviewer checklist + related doc links | `05.Pull-Requests/F-001/TICKET-100.md` |
66
+
67
+ ---
68
+
69
+ ## File Content Templates
70
+
71
+ ### `01.Requirements` — TICKET-100.md
72
+ ```markdown
73
+ ## Ticket Summary
74
+ [title, description, AC từ Backlog/Jira]
75
+
76
+ ## Source Code Analysis
77
+ - Files liên quan:
78
+ - Luồng hiện tại:
79
+ - Điểm cần thay đổi:
80
+
81
+ ## Proposed Solution
82
+ - Hướng tiếp cận:
83
+ - Rủi ro:
84
+
85
+ ## Estimate
86
+ - Effort: X giờ
87
+ - Scope ảnh hưởng: [low / medium / high]
88
+ ```
89
+
90
+ ### `02.Plans` — TICKET-100.md
91
+ ```markdown
92
+ ## TDD Implementation Plan
93
+
94
+ ### Step 1: Viết test cho [case A]
95
+ - File: tests/unit/service/UserServiceTest.java
96
+ - Test method: `create_shouldThrow_whenEmailDuplicated()`
97
+
98
+ ### Step 2: Implement [logic A]
99
+ - File: src/service/impl/UserServiceImpl.java
100
+ - Thay đổi: ...
101
+ ```
102
+
103
+ ### `03.TDD-Notes` — TICKET-100.md
104
+ ```markdown
105
+ ## Test List (viết trước khi implement)
106
+ - [ ] TC-01: happy path — tạo user thành công
107
+ - [ ] TC-02: email trùng → throw DuplicateEmailException
108
+ - [ ] TC-03: input null → throw ValidationException
109
+
110
+ ## Implementation Notes
111
+ [ghi chú phát sinh trong quá trình code]
112
+ ```
113
+
114
+ ### `04.Reviews` — TICKET-100.md
115
+ ```markdown
116
+ ## Test Results
117
+ - Unit tests: 12/12 PASS
118
+ - Integration tests: 3/3 PASS
119
+
120
+ ## Impact Analysis
121
+ - Files thay đổi: 5 files
122
+ - Chức năng ảnh hưởng: [danh sách]
123
+ - Breaking changes: Không / Có → [mô tả]
124
+
125
+ ## Review Checklist
126
+ - [ ] Không có business logic trong Controller
127
+ - [ ] Dùng DTO, không expose Entity trực tiếp
128
+ - [ ] @Transactional đúng chỗ (Service, không phải Controller)
129
+ - [ ] Custom exception, không dùng RuntimeException chung
130
+ - [ ] Không log sensitive data
131
+ - [ ] Unit test + Integration test đều pass
132
+ ```
133
+
134
+ ### `05.Pull-Requests` — TICKET-100.md
135
+ ```markdown
136
+ ## PR: [TICKET-100] Tên feature
137
+
138
+ ### Ticket
139
+ [link Backlog/Jira]
140
+
141
+ ### Changes
142
+ - [danh sách thay đổi chính]
143
+
144
+ ### Related Docs
145
+ - UC Spec: [link 02.BA-Specs/04.UC-Specs/F-001_User-Login/]
146
+ - Test Case: [link 03.Testing/01.Testcases/F-001_User-Login/]
147
+ - Dev Plan: [link 04.Coding/02.Plans/F-001_User-Login/TICKET-100.md]
148
+
149
+ ### How to Test
150
+ 1. ...
151
+
152
+ ### Checklist for Reviewer
153
+ - [ ] Logic đúng với UC Spec
154
+ - [ ] Test coverage đủ
155
+ - [ ] Không có code smell
156
+ - [ ] Migration (nếu có) an toàn
157
+ ```
158
+
159
+ ---
160
+
161
+ ## `_Index.md` — Tracker cho TechLead / PM
162
+
163
+ ```markdown
164
+ | F-ID | Ticket | Feature Name | Dev | Gate | PR |
165
+ |-------|------------|-------------|---------|-------------------|------|
166
+ | F-001 | TICKET-100 | User Login | KhanhNV | ✅✅✅✅⬜ Gate 4 | - |
167
+ | F-001 | TICKET-145 | Remember Me | AnhNH | ✅✅✅✅✅ Done | #42 |
168
+ | F-002 | TICKET-110 | Dashboard | LyLT | ✅✅⬜⬜⬜ Gate 2 | - |
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Rules
174
+
175
+ - Không tự sửa template — template nằm trong shared repo riêng
176
+ - Không code trước Gate 2 được APPROVED
177
+ - Gate 3 bắt buộc TDD: viết test trước → implement → test PASS
178
+ - Lưu tài liệu lên GitLab **trước khi tạo Pull Request**
179
+ - PR description phải đính kèm link: UC Spec + Test Case + Dev Plan