@ryuenn3123/agentic-senior-core 5.7.0 → 5.8.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 (42) hide show
  1. package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +4 -1
  2. package/.agents/plugins/agentic-senior-core/skills/asc-add-feature/SKILL.md +46 -0
  3. package/.agents/plugins/agentic-senior-core/skills/asc-audit/SKILL.md +2 -0
  4. package/.agents/plugins/agentic-senior-core/skills/asc-debt/SKILL.md +2 -0
  5. package/.agents/plugins/agentic-senior-core/skills/asc-new-project/SKILL.md +49 -0
  6. package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +23 -2
  7. package/.agents/plugins/agentic-senior-core/skills/asc-reference/SKILL.md +2 -0
  8. package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +2 -0
  9. package/.claude-plugin/plugin.json +1 -1
  10. package/.codex-plugin/plugin.json +1 -1
  11. package/.devin-plugin/plugin.json +1 -1
  12. package/.github/plugin/plugin.json +1 -1
  13. package/.openclaw/skills/asc/SKILL.md +4 -8
  14. package/.openclaw/skills/asc-adapter/SKILL.md +37 -0
  15. package/.openclaw/skills/asc-add-feature/SKILL.md +46 -0
  16. package/.openclaw/skills/asc-audit/SKILL.md +2 -0
  17. package/.openclaw/skills/asc-debt/SKILL.md +2 -7
  18. package/.openclaw/skills/asc-new-project/SKILL.md +49 -0
  19. package/.openclaw/skills/asc-refactor/SKILL.md +56 -0
  20. package/.openclaw/skills/asc-reference/SKILL.md +2 -7
  21. package/.openclaw/skills/asc-review/SKILL.md +2 -0
  22. package/README.md +80 -6
  23. package/commands/asc-add-feature.md +1 -0
  24. package/commands/asc-add-feature.toml +6 -0
  25. package/commands/asc-help.md +2 -0
  26. package/commands/asc-help.toml +11 -1
  27. package/commands/asc-new-project.md +1 -0
  28. package/commands/asc-new-project.toml +6 -0
  29. package/gemini-extension.json +1 -1
  30. package/hooks/path-util.cjs +23 -0
  31. package/hooks/post-edit-enforce.js +34 -0
  32. package/package.json +2 -2
  33. package/plugin.yaml +1 -1
  34. package/scripts/mcp-server/tools.mjs +10 -0
  35. package/skills/asc/SKILL.md +4 -1
  36. package/skills/asc-add-feature/SKILL.md +46 -0
  37. package/skills/asc-audit/SKILL.md +2 -0
  38. package/skills/asc-debt/SKILL.md +2 -0
  39. package/skills/asc-new-project/SKILL.md +49 -0
  40. package/skills/asc-refactor/SKILL.md +23 -2
  41. package/skills/asc-reference/SKILL.md +2 -0
  42. package/skills/asc-review/SKILL.md +2 -0
@@ -4,6 +4,8 @@ Universal AI coding rules. Write code like a staff engineer.
4
4
 
5
5
  ## Available Commands
6
6
 
7
+ - `/asc-new-project` -- Greenfield workflow (Define -> Spec -> Implement -> Validate)
8
+ - `/asc-add-feature` -- Brownfield workflow (Research -> Plan -> Implement)
7
9
  - `/asc-refactor` -- Structured refactoring workflow with pre-checks and validation
8
10
  - `/asc-review` -- Production-risk code review with severity-ordered findings
9
11
  - `/asc-audit` -- Security and architecture audit
@@ -17,8 +19,9 @@ On plugin-tier hosts (Claude Code, Codex CLI, Copilot CLI), a PostToolUse hook f
17
19
  - New dependencies against stdlib duplicates (decision ladder step 3)
18
20
  - LOC delta > 30 lines on edits (step 5)
19
21
  - New files > 50 lines (steps 1–2)
22
+ - Workflow gate violations: source/config edits during research or plan phases
20
23
 
21
- Violations inject a nudge referencing the specific ladder step. The hook is silent when no issues are found.
24
+ Violations inject a nudge referencing the specific ladder step or workflow phase. The hook is silent when no issues are found. All enforcement is advisory — nudges, not hard blocks.
22
25
 
23
26
  ## What It Does
24
27
 
@@ -0,0 +1,46 @@
1
+ # Add Feature Workflow
2
+
3
+ Structured brownfield workflow. Adapted from QRSPI to prevent context rot and ensure alignment before building.
4
+
5
+ Grounded in: RPI (Dex Horthy, HumanLayer 2025) with corrections from QRSPI 8-stage evolution (Coding Agents Conference, March 2026). Plan-reading illusion fix and instruction budget constraint applied. Stages 2/5/7 adapted; stages 1/3/4/6/8 skipped as too heavyweight for individual-developer workflow.
6
+
7
+ ## Gate Mechanism
8
+
9
+ This workflow nudges the agent to stop at each phase boundary, same enforcement tier as the existing decision ladder — not a hard block. Bypasses are logged to the debt ledger.
10
+
11
+ **Known limitation:** Bypass-to-debt-ledger logging is self-reported by the agent, not enforced by the hook. The PostToolUse hook has no MCP access — it nudges the agent to log, but cannot write the debt entry itself.
12
+
13
+ To track phase, write to `workflow-gate.json` via the `state_write` MCP tool.
14
+ Format:
15
+ ```json
16
+ {
17
+ "workflow": "asc-add-feature",
18
+ "phase": "<current_phase>",
19
+ "updatedAt": "<ISO-timestamp>"
20
+ }
21
+ ```
22
+
23
+ ## Phase 1: Research (No Code Changes)
24
+
25
+ 1. Write `workflow-gate.json` with phase `research`.
26
+ 2. Map existing code: patterns, utilities, dependencies already in use.
27
+ 3. Identify what must NOT be rebuilt (e.g., existing validation helpers).
28
+ 4. Output a factual research summary.
29
+ 5. **STOP and wait for user approval.** Do not plan or implement.
30
+
31
+ ## Phase 2: Plan
32
+
33
+ 1. On approval of Phase 1, update `workflow-gate.json` phase to `plan`.
34
+ 2. Create a numbered, step-by-step implementation plan with specific files, functions, and line references.
35
+ 3. Include a "Don't Build" list from the research phase.
36
+ 4. **Callout: Plan-Reading Illusion.** Ask the user to explicitly verify the plan against the codebase, not just skim it.
37
+ 5. Output the plan.
38
+ 6. **STOP and wait for user approval.** Do not implement.
39
+
40
+ ## Phase 3: Implement
41
+
42
+ 1. On approval of Phase 2, update `workflow-gate.json` phase to `implement`.
43
+ 2. Recommend a fresh context (intentional compaction) if the context window is getting full.
44
+ 3. Execute the approved plan.
45
+ 4. Validate: tests pass, no duplicate code introduced, plan items checked off.
46
+ 5. On completion, clear the state in `workflow-gate.json` by overwriting it with `{}`.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Security and architecture audit. Deeper than review, focused on finding vulnerabilities and structural anti-patterns.
4
4
 
5
+ Grounded in: OWASP Top 10 (2021), OWASP ASVS v4, CVSS vulnerability report structure, CWE classification.
6
+
5
7
  ## Audit Scope
6
8
 
7
9
  1. **Trust boundaries**: Every point where external input enters the system. Validate that inputs are sanitized, normalized, and rejected when invalid.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Track deferred enforcement violations. When an ASC ladder nudge fires and the shortcut is accepted rather than fixed, log it here for later resolution.
4
4
 
5
+ Grounded in: Cunningham's technical debt metaphor (1992). Entry format (ladder step + violation + status lifecycle) is an ASC-specific implementation.
6
+
5
7
  ## Storage
6
8
 
7
9
  Entries persist in `.agent-context/state/debt-ledger.json` via MCP `state_read`/`state_write`. The ledger is a JSON array of entry objects.
@@ -0,0 +1,49 @@
1
+ # New Project Workflow
2
+
3
+ Structured greenfield workflow. Prevents building before alignment on what to build.
4
+
5
+ Grounded in: Spec-Driven Development (SDD) with scaffolding-spec approach. Specs guide implementation, then the code becomes the source of truth — specs are not maintained as living documents unless the team explicitly opts in.
6
+
7
+ ## Gate Mechanism
8
+
9
+ This workflow nudges the agent to stop at each phase boundary, same enforcement tier as the existing decision ladder — not a hard block. Bypasses are logged to the debt ledger.
10
+
11
+ **Known limitation:** Bypass-to-debt-ledger logging is self-reported by the agent, not enforced by the hook. The PostToolUse hook has no MCP access — it nudges the agent to log, but cannot write the debt entry itself.
12
+
13
+ To track phase, write to `workflow-gate.json` via the `state_write` MCP tool.
14
+ Format:
15
+ ```json
16
+ {
17
+ "workflow": "asc-new-project",
18
+ "phase": "<current_phase>",
19
+ "updatedAt": "<ISO-timestamp>"
20
+ }
21
+ ```
22
+
23
+ ## Phase 1: Define (No Code)
24
+
25
+ 1. Write `workflow-gate.json` with phase `research`.
26
+ 2. Clarify with the user: tech stack, target platform, constraints, non-goals.
27
+ 3. Propose a directory structure and module boundaries.
28
+ 4. Output a project brief summarizing decisions.
29
+ 5. **STOP and wait for user approval.** Do not write specs or code.
30
+
31
+ ## Phase 2: Spec (No Implementation Code)
32
+
33
+ 1. On approval of Phase 1, update `workflow-gate.json` phase to `plan`.
34
+ 2. Write per-feature specs with acceptance criteria and edge cases.
35
+ 3. Specs are scaffolding — they guide the build, then the code is the source of truth.
36
+ 4. Output specs for review.
37
+ 5. **STOP and wait for user approval.** Do not implement.
38
+
39
+ ## Phase 3: Implement
40
+
41
+ 1. On approval of Phase 2, update `workflow-gate.json` phase to `implement`.
42
+ 2. Build against the approved specs. Apply the ASC decision ladder on every file.
43
+ 3. Run the decision ladder: does this need to exist? Does stdlib cover it? One function or full module?
44
+
45
+ ## Phase 4: Validate
46
+
47
+ 1. Run tests. Check each spec's acceptance criteria.
48
+ 2. Confirm nothing was over-built beyond what the specs required.
49
+ 3. On completion, clear the state in `workflow-gate.json` by overwriting it with `{}`.
@@ -2,12 +2,33 @@
2
2
 
3
3
  Structured refactoring workflow. Preserves existing behavior while improving structure.
4
4
 
5
+ Grounded in: Fowler's Refactoring (read-understand-smallest scope-preserve behavior), Rule of Three (abstraction threshold), YAGNI principle (XP/Kent Beck). Empirical evidence: agents dominate low-level refactors (rename, extract, type changes) but struggle with multi-file architectural changes (arXiv, 15k+ instance study).
6
+
7
+ ## YAGNI Scan (Before Any Restructuring)
8
+
9
+ Before changing structure, scan for speculative code to remove:
10
+ - "Just in case" logic, unused feature flags, dead branches behind config toggles.
11
+ - Abstractions wrapping a single implementation with no second consumer.
12
+ - Premature extension points (plugin hooks, strategy patterns) with one concrete path.
13
+
14
+ Removing speculative code is the highest-value, lowest-risk refactor type.
15
+
16
+ ## Classify Before Proceeding
17
+
18
+ After reading the target code, classify the refactor:
19
+
20
+ - **Low-level** (rename, extract method, type safety, dead code removal): proceed after explaining the change. No approval gate needed.
21
+ - **High-level** (move module, change architecture, redesign abstractions, multi-file structural changes): output a plan with specific files and rationale, then **stop and wait for user approval** before implementing.
22
+
23
+ **Known limitation:** The high-level refactor gate is a skill-text instruction — the agent self-classifies and self-stops. Unlike `/asc-add-feature` and `/asc-new-project`, this gate is not backed by the PostToolUse hook or workflow-gate.json. If the agent bypasses the gate, there is no automated nudge.
24
+
5
25
  ## Before Editing
6
26
 
7
27
  1. Read the target code and understand existing patterns.
8
28
  2. Identify the smallest relevant scope for the refactor.
9
- 3. If the change touches UI, check accessibility and responsive behavior.
10
- 4. If the change touches dependencies, verify current official docs.
29
+ 3. Classify the refactor (see above). If high-level, stop and present a plan.
30
+ 4. If the change touches UI, check accessibility and responsive behavior.
31
+ 5. If the change touches dependencies, verify current official docs.
11
32
 
12
33
  ## Refactor Rules
13
34
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  Domain-specific coding rules for testing, API design, database queries, frontend components, infrastructure configs, and service resilience. Load this skill when working on any of these domains.
4
4
 
5
+ Grounded in: WCAG 2.2 AA (accessibility), Fowler's Money Pattern (monetary types), Nygard's Release It! (resilience patterns), AWS Well-Architected Reliability Pillar (backoff/circuit breakers), OWASP Secure Coding Practices (input validation, logging).
6
+
5
7
  ## Testing
6
8
 
7
9
  - Write tests for business logic and boundary failures, not implementation details.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Production-risk code review. Prioritize findings by severity.
4
4
 
5
+ Grounded in: OWASP Risk Rating Methodology, Google Engineering Practices (code review guide), Clean Architecture (transport vs business layer separation).
6
+
5
7
  ## Before Reviewing
6
8
 
7
9
  1. Read the changed files and understand the scope.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "displayName": "Agentic Senior Core",
5
5
  "description": "Universal AI coding rules. Write code like a staff engineer.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "author": {
6
6
  "name": "fatidaprilian",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "author": {
6
6
  "name": "fatidaprilian",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
3
  "description": "Universal AI coding rules. Write code like a staff engineer.",
4
- "version": "5.7.0",
4
+ "version": "5.8.0",
5
5
  "author": {
6
6
  "name": "fatidaprilian",
7
7
  "url": "https://github.com/fatidaprilian"
@@ -1,16 +1,11 @@
1
- ---
2
- name: asc
3
- description: "Universal AI coding rules. Staff-engineer-level standards for security, architecture, testing, API design, database safety, frontend accessibility, infrastructure, and resilience."
4
- homepage: https://github.com/fatidaprilian/Agentic-Senior-Core
5
- license: MIT
6
- ---
7
-
8
1
  # Agentic Senior Core
9
2
 
10
3
  Universal AI coding rules. Write code like a staff engineer.
11
4
 
12
5
  ## Available Commands
13
6
 
7
+ - `/asc-new-project` -- Greenfield workflow (Define -> Spec -> Implement -> Validate)
8
+ - `/asc-add-feature` -- Brownfield workflow (Research -> Plan -> Implement)
14
9
  - `/asc-refactor` -- Structured refactoring workflow with pre-checks and validation
15
10
  - `/asc-review` -- Production-risk code review with severity-ordered findings
16
11
  - `/asc-audit` -- Security and architecture audit
@@ -24,8 +19,9 @@ On plugin-tier hosts (Claude Code, Codex CLI, Copilot CLI), a PostToolUse hook f
24
19
  - New dependencies against stdlib duplicates (decision ladder step 3)
25
20
  - LOC delta > 30 lines on edits (step 5)
26
21
  - New files > 50 lines (steps 1–2)
22
+ - Workflow gate violations: source/config edits during research or plan phases
27
23
 
28
- Violations inject a nudge referencing the specific ladder step. The hook is silent when no issues are found.
24
+ Violations inject a nudge referencing the specific ladder step or workflow phase. The hook is silent when no issues are found. All enforcement is advisory — nudges, not hard blocks.
29
25
 
30
26
  ## What It Does
31
27
 
@@ -0,0 +1,37 @@
1
+ # ASC Adapter
2
+
3
+ Detect installed AI coding hosts and generate adapter files for the current project.
4
+
5
+ ## When to use
6
+
7
+ Run this when setting up a new project or when a developer wants ASC rules active across all their AI coding tools.
8
+
9
+ ## Steps
10
+
11
+ 1. Run `asc status` to detect which AI coding hosts are installed on this system.
12
+ 2. Check which adapter files already exist in the current project directory.
13
+ 3. For any detected host that is missing an adapter, run `asc adapter --<host>` to generate it.
14
+ 4. Use `asc adapter --all` to generate adapters for all supported hosts at once.
15
+
16
+ ## Supported hosts
17
+
18
+ Plugin hosts (always-on, no adapter needed): Claude Code, Codex CLI, Gemini CLI, Antigravity CLI, Copilot CLI, Devin CLI, Hermes, OpenCode, OpenClaw.
19
+
20
+ Adapter hosts (one file per project): Cursor, Devin Desktop, Cline, GitHub Copilot, Kiro, Continue, Zed, Aider, Kilo Code, Roo Code, OpenHands.
21
+
22
+ ## Commands
23
+
24
+ ```bash
25
+ asc status # Show detected hosts
26
+ asc adapter --all # Generate all adapters
27
+ asc adapter --cursor # Generate for specific host
28
+ asc uninstall # Remove all ASC adapter files
29
+ asc uninstall --dry-run # Preview what would be removed
30
+ ```
31
+
32
+ ## Notes
33
+
34
+ - Adapter files contain the ASC universal coding rules, compressed to fit within each host's size limits.
35
+ - Cursor uses `.mdc` format with `alwaysApply: true` frontmatter.
36
+ - Windsurf is now Devin Desktop. Use `--devin` for the preferred path, `--windsurf` for legacy.
37
+ - Zed also reads `AGENTS.md` natively, so the adapter is optional.
@@ -0,0 +1,46 @@
1
+ # Add Feature Workflow
2
+
3
+ Structured brownfield workflow. Adapted from QRSPI to prevent context rot and ensure alignment before building.
4
+
5
+ Grounded in: RPI (Dex Horthy, HumanLayer 2025) with corrections from QRSPI 8-stage evolution (Coding Agents Conference, March 2026). Plan-reading illusion fix and instruction budget constraint applied. Stages 2/5/7 adapted; stages 1/3/4/6/8 skipped as too heavyweight for individual-developer workflow.
6
+
7
+ ## Gate Mechanism
8
+
9
+ This workflow nudges the agent to stop at each phase boundary, same enforcement tier as the existing decision ladder — not a hard block. Bypasses are logged to the debt ledger.
10
+
11
+ **Known limitation:** Bypass-to-debt-ledger logging is self-reported by the agent, not enforced by the hook. The PostToolUse hook has no MCP access — it nudges the agent to log, but cannot write the debt entry itself.
12
+
13
+ To track phase, write to `workflow-gate.json` via the `state_write` MCP tool.
14
+ Format:
15
+ ```json
16
+ {
17
+ "workflow": "asc-add-feature",
18
+ "phase": "<current_phase>",
19
+ "updatedAt": "<ISO-timestamp>"
20
+ }
21
+ ```
22
+
23
+ ## Phase 1: Research (No Code Changes)
24
+
25
+ 1. Write `workflow-gate.json` with phase `research`.
26
+ 2. Map existing code: patterns, utilities, dependencies already in use.
27
+ 3. Identify what must NOT be rebuilt (e.g., existing validation helpers).
28
+ 4. Output a factual research summary.
29
+ 5. **STOP and wait for user approval.** Do not plan or implement.
30
+
31
+ ## Phase 2: Plan
32
+
33
+ 1. On approval of Phase 1, update `workflow-gate.json` phase to `plan`.
34
+ 2. Create a numbered, step-by-step implementation plan with specific files, functions, and line references.
35
+ 3. Include a "Don't Build" list from the research phase.
36
+ 4. **Callout: Plan-Reading Illusion.** Ask the user to explicitly verify the plan against the codebase, not just skim it.
37
+ 5. Output the plan.
38
+ 6. **STOP and wait for user approval.** Do not implement.
39
+
40
+ ## Phase 3: Implement
41
+
42
+ 1. On approval of Phase 2, update `workflow-gate.json` phase to `implement`.
43
+ 2. Recommend a fresh context (intentional compaction) if the context window is getting full.
44
+ 3. Execute the approved plan.
45
+ 4. Validate: tests pass, no duplicate code introduced, plan items checked off.
46
+ 5. On completion, clear the state in `workflow-gate.json` by overwriting it with `{}`.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Security and architecture audit. Deeper than review, focused on finding vulnerabilities and structural anti-patterns.
4
4
 
5
+ Grounded in: OWASP Top 10 (2021), OWASP ASVS v4, CVSS vulnerability report structure, CWE classification.
6
+
5
7
  ## Audit Scope
6
8
 
7
9
  1. **Trust boundaries**: Every point where external input enters the system. Validate that inputs are sanitized, normalized, and rejected when invalid.
@@ -1,14 +1,9 @@
1
- ---
2
- name: asc-debt
3
- description: "Track deferred enforcement violations. Log, list, resolve, and summarize shortcuts deferred during ASC ladder enforcement."
4
- homepage: https://github.com/fatidaprilian/Agentic-Senior-Core
5
- license: MIT
6
- ---
7
-
8
1
  # Debt Ledger
9
2
 
10
3
  Track deferred enforcement violations. When an ASC ladder nudge fires and the shortcut is accepted rather than fixed, log it here for later resolution.
11
4
 
5
+ Grounded in: Cunningham's technical debt metaphor (1992). Entry format (ladder step + violation + status lifecycle) is an ASC-specific implementation.
6
+
12
7
  ## Storage
13
8
 
14
9
  Entries persist in `.agent-context/state/debt-ledger.json` via MCP `state_read`/`state_write`. The ledger is a JSON array of entry objects.
@@ -0,0 +1,49 @@
1
+ # New Project Workflow
2
+
3
+ Structured greenfield workflow. Prevents building before alignment on what to build.
4
+
5
+ Grounded in: Spec-Driven Development (SDD) with scaffolding-spec approach. Specs guide implementation, then the code becomes the source of truth — specs are not maintained as living documents unless the team explicitly opts in.
6
+
7
+ ## Gate Mechanism
8
+
9
+ This workflow nudges the agent to stop at each phase boundary, same enforcement tier as the existing decision ladder — not a hard block. Bypasses are logged to the debt ledger.
10
+
11
+ **Known limitation:** Bypass-to-debt-ledger logging is self-reported by the agent, not enforced by the hook. The PostToolUse hook has no MCP access — it nudges the agent to log, but cannot write the debt entry itself.
12
+
13
+ To track phase, write to `workflow-gate.json` via the `state_write` MCP tool.
14
+ Format:
15
+ ```json
16
+ {
17
+ "workflow": "asc-new-project",
18
+ "phase": "<current_phase>",
19
+ "updatedAt": "<ISO-timestamp>"
20
+ }
21
+ ```
22
+
23
+ ## Phase 1: Define (No Code)
24
+
25
+ 1. Write `workflow-gate.json` with phase `research`.
26
+ 2. Clarify with the user: tech stack, target platform, constraints, non-goals.
27
+ 3. Propose a directory structure and module boundaries.
28
+ 4. Output a project brief summarizing decisions.
29
+ 5. **STOP and wait for user approval.** Do not write specs or code.
30
+
31
+ ## Phase 2: Spec (No Implementation Code)
32
+
33
+ 1. On approval of Phase 1, update `workflow-gate.json` phase to `plan`.
34
+ 2. Write per-feature specs with acceptance criteria and edge cases.
35
+ 3. Specs are scaffolding — they guide the build, then the code is the source of truth.
36
+ 4. Output specs for review.
37
+ 5. **STOP and wait for user approval.** Do not implement.
38
+
39
+ ## Phase 3: Implement
40
+
41
+ 1. On approval of Phase 2, update `workflow-gate.json` phase to `implement`.
42
+ 2. Build against the approved specs. Apply the ASC decision ladder on every file.
43
+ 3. Run the decision ladder: does this need to exist? Does stdlib cover it? One function or full module?
44
+
45
+ ## Phase 4: Validate
46
+
47
+ 1. Run tests. Check each spec's acceptance criteria.
48
+ 2. Confirm nothing was over-built beyond what the specs required.
49
+ 3. On completion, clear the state in `workflow-gate.json` by overwriting it with `{}`.
@@ -0,0 +1,56 @@
1
+ # Refactor Skill
2
+
3
+ Structured refactoring workflow. Preserves existing behavior while improving structure.
4
+
5
+ Grounded in: Fowler's Refactoring (read-understand-smallest scope-preserve behavior), Rule of Three (abstraction threshold), YAGNI principle (XP/Kent Beck). Empirical evidence: agents dominate low-level refactors (rename, extract, type changes) but struggle with multi-file architectural changes (arXiv, 15k+ instance study).
6
+
7
+ ## YAGNI Scan (Before Any Restructuring)
8
+
9
+ Before changing structure, scan for speculative code to remove:
10
+ - "Just in case" logic, unused feature flags, dead branches behind config toggles.
11
+ - Abstractions wrapping a single implementation with no second consumer.
12
+ - Premature extension points (plugin hooks, strategy patterns) with one concrete path.
13
+
14
+ Removing speculative code is the highest-value, lowest-risk refactor type.
15
+
16
+ ## Classify Before Proceeding
17
+
18
+ After reading the target code, classify the refactor:
19
+
20
+ - **Low-level** (rename, extract method, type safety, dead code removal): proceed after explaining the change. No approval gate needed.
21
+ - **High-level** (move module, change architecture, redesign abstractions, multi-file structural changes): output a plan with specific files and rationale, then **stop and wait for user approval** before implementing.
22
+
23
+ **Known limitation:** The high-level refactor gate is a skill-text instruction — the agent self-classifies and self-stops. Unlike `/asc-add-feature` and `/asc-new-project`, this gate is not backed by the PostToolUse hook or workflow-gate.json. If the agent bypasses the gate, there is no automated nudge.
24
+
25
+ ## Before Editing
26
+
27
+ 1. Read the target code and understand existing patterns.
28
+ 2. Identify the smallest relevant scope for the refactor.
29
+ 3. Classify the refactor (see above). If high-level, stop and present a plan.
30
+ 4. If the change touches UI, check accessibility and responsive behavior.
31
+ 5. If the change touches dependencies, verify current official docs.
32
+
33
+ ## Refactor Rules
34
+
35
+ - Improve clarity, boundaries, naming, validation, error handling, and tests.
36
+ - Prioritize maintainability over compressed one-liners.
37
+ - Keep the main flow traceable. Use early returns where they reduce nesting.
38
+ - Introduce abstractions only when the repeated pattern is real and visible.
39
+ - Split large files when the split makes the flow easier to understand.
40
+ - Remove code that does not carry behavior, safety, clarity, maintainability, or test value.
41
+ - Prefer the shorter implementation only when it keeps the same guarantees.
42
+ - Run a final simplification pass before completion.
43
+ - Update tests and docs whenever behavior contracts, public APIs, data shape, or UI contracts change.
44
+
45
+ ## For Every Change, Explain
46
+
47
+ - What risk or friction existed.
48
+ - What changed.
49
+ - Why the new shape is safer or easier to maintain.
50
+
51
+ ## Validation
52
+
53
+ - Existing behavior is preserved unless the user approved a change.
54
+ - Edge cases, empty states, error paths, and rollback paths are handled.
55
+ - Public contracts remain stable or are versioned.
56
+ - Tests pass.
@@ -1,14 +1,9 @@
1
- ---
2
- name: asc-reference
3
- description: "Domain-specific coding rules for testing, API design, database queries, frontend components, infrastructure configs, and service resilience."
4
- homepage: https://github.com/fatidaprilian/Agentic-Senior-Core
5
- license: MIT
6
- ---
7
-
8
1
  # ASC Domain Reference
9
2
 
10
3
  Domain-specific coding rules for testing, API design, database queries, frontend components, infrastructure configs, and service resilience. Load this skill when working on any of these domains.
11
4
 
5
+ Grounded in: WCAG 2.2 AA (accessibility), Fowler's Money Pattern (monetary types), Nygard's Release It! (resilience patterns), AWS Well-Architected Reliability Pillar (backoff/circuit breakers), OWASP Secure Coding Practices (input validation, logging).
6
+
12
7
  ## Testing
13
8
 
14
9
  - Write tests for business logic and boundary failures, not implementation details.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Production-risk code review. Prioritize findings by severity.
4
4
 
5
+ Grounded in: OWASP Risk Rating Methodology, Google Engineering Practices (code review guide), Clean Architecture (transport vs business layer separation).
6
+
5
7
  ## Before Reviewing
6
8
 
7
9
  1. Read the changed files and understand the scope.
package/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
8
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
9
9
 
10
+ **Minimalism plugins cut the code. This plugin makes sure what remains is production-safe.**
11
+
10
12
  **Install once. Works across all projects. Supports 23+ AI coding agents.**
11
13
 
12
14
  </div>
@@ -330,7 +332,9 @@ Terminal agent plugins pick up the new version automatically on next session. Gl
330
332
 
331
333
  ## What It Does
332
334
 
333
- AI coding agents over-build by default. Ask for a date picker, the agent installs a library, writes a wrapper component, adds a stylesheet, and opens a timezone discussion.
335
+ AI coding agents over-build by default. Ask for a date picker, the agent installs a library, writes a wrapper component, adds a stylesheet, and opens a timezone discussion. Worse — they silently skip input validation, concatenate SQL strings, commit secrets, and return stack traces to clients.
336
+
337
+ Code reduction plugins solve the first problem. ASC solves both.
334
338
 
335
339
  This plugin loads universal engineering rules on every session. Before writing any code, the agent runs a decision ladder:
336
340
 
@@ -343,6 +347,56 @@ This plugin loads universal engineering rules on every session. Before writing a
343
347
 
344
348
  The rules also cover security, architecture, testing, error handling, API design, database safety, frontend accessibility, infrastructure, resilience, and async patterns. All universal invariants -- no project-specific configuration needed.
345
349
 
350
+ ### Before / After
351
+
352
+ <details>
353
+ <summary><b>Without ASC</b> — AI-generated endpoint (common output)</summary>
354
+
355
+ ```javascript
356
+ app.post('/users', (req, res) => {
357
+ const { name, email, password } = req.body;
358
+ // No input validation
359
+ // SQL injection via string concatenation
360
+ const query = `INSERT INTO users (name, email, password)
361
+ VALUES ('${name}', '${email}', '${password}')`;
362
+ db.run(query, (err) => {
363
+ if (err) {
364
+ // Stack trace leaked to client
365
+ res.status(500).json({ error: err.message, stack: err.stack });
366
+ } else {
367
+ // Password returned in response
368
+ res.json({ name, email, password, message: 'User created' });
369
+ }
370
+ });
371
+ });
372
+ ```
373
+
374
+ Issues: no input validation, SQL injection, plaintext password stored and returned, internal error details leaked, no auth check.
375
+
376
+ </details>
377
+
378
+ <details>
379
+ <summary><b>With ASC</b> — same prompt, rules active</summary>
380
+
381
+ ```javascript
382
+ app.post('/users', authenticate, async (req, res) => {
383
+ const { name, email, password } = req.body;
384
+ if (!name || !email || !password) {
385
+ return res.status(400).json({ error: 'Missing required fields' });
386
+ }
387
+ const hash = await bcrypt.hash(password, 12);
388
+ const stmt = db.prepare(
389
+ 'INSERT INTO users (name, email, password) VALUES (?, ?, ?)'
390
+ );
391
+ stmt.run(name, email, hash);
392
+ res.status(201).json({ name, email });
393
+ });
394
+ ```
395
+
396
+ Validated input, parameterized query, hashed password, safe error response, auth middleware, no sensitive data in response.
397
+
398
+ </details>
399
+
346
400
  ### Not lazy about
347
401
 
348
402
  Input validation at trust boundaries, parameterized queries, auth checks, error handling that prevents data loss, accessibility, anything explicitly requested. These are never skipped.
@@ -384,6 +438,8 @@ Available on plugin hosts (Claude Code, Codex, Gemini CLI):
384
438
 
385
439
  | Command | Purpose |
386
440
  |---------|---------|
441
+ | `/asc-new-project` | Greenfield workflow (Define -> Spec -> Implement -> Validate) |
442
+ | `/asc-add-feature` | Brownfield workflow (Research -> Plan -> Implement) |
387
443
  | `/asc-refactor` | Structured refactoring workflow |
388
444
  | `/asc-review` | Production-risk code review with severity-ordered findings |
389
445
  | `/asc-audit` | Security and architecture audit |
@@ -412,12 +468,9 @@ asc --help
412
468
 
413
469
  ## Works With Other Plugins
414
470
 
415
- ASC covers universal engineering standards (security, architecture, testing, API design, database safety). It is complementary to:
416
-
417
- - **ponytail** -- YAGNI minimalism and code reduction
418
- - **awesome-cursorrules** -- Framework-specific context and stack declarations
471
+ ASC covers security, architecture, testing, API design, database safety, accessibility, infrastructure, and resilience — domains that code-reduction and minimalism plugins explicitly leave out of scope. They reduce volume; ASC enforces safety on what remains.
419
472
 
420
- Use them together. No conflicts.
473
+ Use them together. No conflicts — ASC is designed to be complementary.
421
474
 
422
475
  ---
423
476
 
@@ -467,3 +520,24 @@ This removes `.agent-context/`, `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, and other
467
520
  | Commands | 0 | Metadata only |
468
521
 
469
522
  Total always-on cost: ~1,200 tokens per session.
523
+
524
+ ---
525
+
526
+ ## Grounded In
527
+
528
+ Every rule and skill workflow is derived from established engineering standards, not invented conventions.
529
+
530
+ | Domain | Standards |
531
+ |--------|-----------|
532
+ | Security & audit | OWASP Top 10, OWASP ASVS v4, CWE classification, CVSS report structure |
533
+ | Code review | OWASP Risk Rating Methodology, Google Engineering Practices |
534
+ | Architecture | Clean Architecture, Hexagonal Architecture |
535
+ | Workflows | RPI & QRSPI (Dex Horthy/HumanLayer), SDD (GitHub Spec Kit) |
536
+ | Refactoring | Fowler's Refactoring, Rule of Three, YAGNI (XP/Kent Beck) |
537
+ | Database | Fowler's Money Pattern, UTC timestamp convention, migration versioning |
538
+ | Accessibility | WCAG 2.2 AA |
539
+ | Resilience | Nygard's Release It!, AWS Well-Architected Reliability Pillar |
540
+ | Technical debt | Cunningham's debt metaphor (1992) |
541
+ | Instruction design | Low instruction density for higher LLM compliance — supported by IFScale (arXiv:2507.11538) and RECAST (arXiv:2505.19030) |
542
+
543
+ The decision ladder (check before building) and debt ledger format are ASC-specific implementations grounded in these principles.
@@ -0,0 +1 @@
1
+ Run the brownfield feature workflow from skills/asc-add-feature/SKILL.md. Follow the Research -> Plan -> Implement phases with explicit human gates to prevent context rot.
@@ -0,0 +1,6 @@
1
+ name = "asc-add-feature"
2
+ description = "Structured brownfield workflow. Research -> Plan -> Implement with human gates."
3
+
4
+ [[instructions]]
5
+ type = "context"
6
+ content = "Run the brownfield feature workflow from skills/asc-add-feature/SKILL.md. Stop and wait for user approval at the end of each phase (Research, Plan) before proceeding. Update the gate state as instructed."
@@ -1,6 +1,8 @@
1
1
  Show available Agentic Senior Core commands and skills.
2
2
 
3
3
  Available commands:
4
+ - /asc-new-project -- Greenfield workflow (Define -> Spec -> Implement -> Validate)
5
+ - /asc-add-feature -- Brownfield workflow (Research -> Plan -> Implement)
4
6
  - /asc-refactor -- Structured refactoring workflow
5
7
  - /asc-review -- Production-risk code review
6
8
  - /asc-audit -- Security and architecture audit
@@ -1,2 +1,12 @@
1
1
  description = "Show available Agentic Senior Core commands"
2
- prompt = "Show the Agentic Senior Core command reference: /asc-refactor (structured refactoring workflow), /asc-review (production-risk code review with severity-ordered findings), /asc-audit (security and architecture audit), /asc-help (this help). ASC loads universal engineering rules covering code quality, architecture, security, error handling, testing, API design, database, frontend, infrastructure, resilience, and async patterns."
2
+ prompt = '''
3
+ Show available Agentic Senior Core commands and skills.
4
+
5
+ Available commands:
6
+ - /asc-new-project -- Greenfield workflow (Define -> Spec -> Implement -> Validate)
7
+ - /asc-add-feature -- Brownfield workflow (Research -> Plan -> Implement)
8
+ - /asc-refactor -- Structured refactoring workflow
9
+ - /asc-review -- Production-risk code review
10
+ - /asc-audit -- Security and architecture audit
11
+ - /asc-help -- This help. ASC loads universal engineering rules covering code quality, architecture, security, error handling, testing, API design, database, frontend, infrastructure, resilience, and async patterns.
12
+ '''
@@ -0,0 +1 @@
1
+ Run the greenfield project workflow from skills/asc-new-project/SKILL.md. Follow the Define -> Spec -> Implement -> Validate phases with explicit human gates before building.
@@ -0,0 +1,6 @@
1
+ name = "asc-new-project"
2
+ description = "Structured greenfield workflow. Define -> Spec -> Implement -> Validate with human gates."
3
+
4
+ [[instructions]]
5
+ type = "context"
6
+ content = "Run the greenfield project workflow from skills/asc-new-project/SKILL.md. Stop and wait for user approval at the end of each phase (Define, Spec) before proceeding. Update the gate state as instructed."
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "author": "fatidaprilian",
6
6
  "license": "MIT",
@@ -0,0 +1,23 @@
1
+ const crypto = require('crypto');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ /**
6
+ * Computes a stable path for the workflow gate file based on the project path.
7
+ * Normalizes the path (resolves absolute, lowercase, forward slashes, no trailing slash)
8
+ * to ensure identical hashes regardless of OS path separator or drive letter casing.
9
+ * Note: .toLowerCase() deliberately treats Linux/Mac paths case-insensitively,
10
+ * accepting the negligible risk of collisions for the benefit of Windows stability.
11
+ *
12
+ * @param {string} projectPath - The root path of the project.
13
+ * @returns {string} Absolute path to the global workflow gate JSON file.
14
+ */
15
+ function getWorkflowGatePath(projectPath) {
16
+ const normalizedPath = path.resolve(projectPath).replace(/\\/g, '/').toLowerCase().replace(/\/$/, '');
17
+ const projectHash = crypto.createHash('sha256').update(normalizedPath).digest('hex').substring(0, 16);
18
+ return path.join(os.homedir(), '.config', 'agentic-senior-core', 'gates', `${projectHash}.json`);
19
+ }
20
+
21
+ module.exports = {
22
+ getWorkflowGatePath
23
+ };
@@ -3,6 +3,7 @@
3
3
  // Fires after Edit/Write. Checks for ladder violations and injects a nudge.
4
4
  // Supports Claude Code, Codex CLI, and GitHub Copilot CLI.
5
5
 
6
+ const fs = require('fs');
6
7
  const path = require('path');
7
8
 
8
9
  const STDLIB_DUPLICATES = new Set([
@@ -50,6 +51,10 @@ process.stdin.on('end', function () {
50
51
  }
51
52
  }
52
53
 
54
+ if (ext !== 'md') {
55
+ checkWorkflowGate(toolName, filePath, ext, findings);
56
+ }
57
+
53
58
  if (findings.length === 0) return;
54
59
 
55
60
  const nudge = '[ASC enforcement] ' + findings.join(' ') + ' Review the decision ladder before continuing.';
@@ -115,6 +120,35 @@ function checkNewFileSize(toolInput, filePath, findings) {
115
120
  }
116
121
  }
117
122
 
123
+ function checkWorkflowGate(toolName, filePath, ext, findings) {
124
+ try {
125
+ var pathUtil = require('./path-util.cjs');
126
+ var gatePath = pathUtil.getWorkflowGatePath(process.cwd());
127
+ if (!fs.existsSync(gatePath)) return;
128
+
129
+ var gateStr = fs.readFileSync(gatePath, 'utf8');
130
+ var gate = JSON.parse(gateStr);
131
+
132
+ if (gate.updatedAt) {
133
+ var ageHours = (Date.now() - new Date(gate.updatedAt).getTime()) / (1000 * 60 * 60);
134
+ if (ageHours > 4) {
135
+ fs.unlinkSync(gatePath);
136
+ findings.push('Cleared stale workflow gate (' + gate.workflow + ').');
137
+ return;
138
+ }
139
+ }
140
+
141
+ if (gate.phase === 'research' || gate.phase === 'plan') {
142
+ findings.push(
143
+ 'Workflow gate bypass: ' + gate.workflow + ' is in ' + gate.phase + ' phase but source code was edited. '
144
+ + 'Stop and wait for phase approval. If you must proceed, log this bypass to the debt ledger.'
145
+ );
146
+ }
147
+ } catch (_) {
148
+ // Silent fail
149
+ }
150
+ }
151
+
118
152
  function emit(nudge) {
119
153
  try {
120
154
  var isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "type": "module",
5
5
  "description": "Universal AI coding rules. Write code like a staff engineer, not a junior.",
6
6
  "bin": {
@@ -88,6 +88,6 @@
88
88
  "agentic"
89
89
  ],
90
90
  "scripts": {
91
- "test": "node --test ./tests/adapter.test.mjs"
91
+ "test": "node --test ./tests/adapter.test.mjs ./tests/path-hash.test.mjs"
92
92
  }
93
93
  }
package/plugin.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: agentic-senior-core
2
- version: 5.7.0
2
+ version: 5.8.0
3
3
  description: Universal AI coding rules. Write code like a staff engineer.
4
4
  author: fatidaprilian
5
5
  provides_hooks:
@@ -5,6 +5,9 @@ import { existsSync } from 'node:fs';
5
5
  import { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
6
6
  import { spawn } from 'node:child_process';
7
7
  import { dirname, resolve, sep } from 'node:path';
8
+ import { createRequire } from 'node:module';
9
+ const requireCJS = createRequire(import.meta.url);
10
+ const pathUtil = requireCJS('../../hooks/path-util.cjs');
8
11
  import {
9
12
  AVAILABLE_TEST_SUITES,
10
13
  DEFAULT_FETCH_MAX_CHARS,
@@ -377,6 +380,13 @@ function resolveStatePath(relativeStatePath) {
377
380
  throw new Error('path is required and must be relative to .agent-context/state');
378
381
  }
379
382
 
383
+ if (normalizedRelativePath === 'workflow-gate.json') {
384
+ return {
385
+ normalizedRelativePath,
386
+ resolvedStatePath: pathUtil.getWorkflowGatePath(REPOSITORY_ROOT),
387
+ };
388
+ }
389
+
380
390
  const resolvedStatePath = resolve(STATE_DIRECTORY, normalizedRelativePath);
381
391
  const stateRootPrefix = `${STATE_DIRECTORY}${sep}`;
382
392
  if (resolvedStatePath !== STATE_DIRECTORY && !resolvedStatePath.startsWith(stateRootPrefix)) {
@@ -4,6 +4,8 @@ Universal AI coding rules. Write code like a staff engineer.
4
4
 
5
5
  ## Available Commands
6
6
 
7
+ - `/asc-new-project` -- Greenfield workflow (Define -> Spec -> Implement -> Validate)
8
+ - `/asc-add-feature` -- Brownfield workflow (Research -> Plan -> Implement)
7
9
  - `/asc-refactor` -- Structured refactoring workflow with pre-checks and validation
8
10
  - `/asc-review` -- Production-risk code review with severity-ordered findings
9
11
  - `/asc-audit` -- Security and architecture audit
@@ -17,8 +19,9 @@ On plugin-tier hosts (Claude Code, Codex CLI, Copilot CLI), a PostToolUse hook f
17
19
  - New dependencies against stdlib duplicates (decision ladder step 3)
18
20
  - LOC delta > 30 lines on edits (step 5)
19
21
  - New files > 50 lines (steps 1–2)
22
+ - Workflow gate violations: source/config edits during research or plan phases
20
23
 
21
- Violations inject a nudge referencing the specific ladder step. The hook is silent when no issues are found.
24
+ Violations inject a nudge referencing the specific ladder step or workflow phase. The hook is silent when no issues are found. All enforcement is advisory — nudges, not hard blocks.
22
25
 
23
26
  ## What It Does
24
27
 
@@ -0,0 +1,46 @@
1
+ # Add Feature Workflow
2
+
3
+ Structured brownfield workflow. Adapted from QRSPI to prevent context rot and ensure alignment before building.
4
+
5
+ Grounded in: RPI (Dex Horthy, HumanLayer 2025) with corrections from QRSPI 8-stage evolution (Coding Agents Conference, March 2026). Plan-reading illusion fix and instruction budget constraint applied. Stages 2/5/7 adapted; stages 1/3/4/6/8 skipped as too heavyweight for individual-developer workflow.
6
+
7
+ ## Gate Mechanism
8
+
9
+ This workflow nudges the agent to stop at each phase boundary, same enforcement tier as the existing decision ladder — not a hard block. Bypasses are logged to the debt ledger.
10
+
11
+ **Known limitation:** Bypass-to-debt-ledger logging is self-reported by the agent, not enforced by the hook. The PostToolUse hook has no MCP access — it nudges the agent to log, but cannot write the debt entry itself.
12
+
13
+ To track phase, write to `workflow-gate.json` via the `state_write` MCP tool.
14
+ Format:
15
+ ```json
16
+ {
17
+ "workflow": "asc-add-feature",
18
+ "phase": "<current_phase>",
19
+ "updatedAt": "<ISO-timestamp>"
20
+ }
21
+ ```
22
+
23
+ ## Phase 1: Research (No Code Changes)
24
+
25
+ 1. Write `workflow-gate.json` with phase `research`.
26
+ 2. Map existing code: patterns, utilities, dependencies already in use.
27
+ 3. Identify what must NOT be rebuilt (e.g., existing validation helpers).
28
+ 4. Output a factual research summary.
29
+ 5. **STOP and wait for user approval.** Do not plan or implement.
30
+
31
+ ## Phase 2: Plan
32
+
33
+ 1. On approval of Phase 1, update `workflow-gate.json` phase to `plan`.
34
+ 2. Create a numbered, step-by-step implementation plan with specific files, functions, and line references.
35
+ 3. Include a "Don't Build" list from the research phase.
36
+ 4. **Callout: Plan-Reading Illusion.** Ask the user to explicitly verify the plan against the codebase, not just skim it.
37
+ 5. Output the plan.
38
+ 6. **STOP and wait for user approval.** Do not implement.
39
+
40
+ ## Phase 3: Implement
41
+
42
+ 1. On approval of Phase 2, update `workflow-gate.json` phase to `implement`.
43
+ 2. Recommend a fresh context (intentional compaction) if the context window is getting full.
44
+ 3. Execute the approved plan.
45
+ 4. Validate: tests pass, no duplicate code introduced, plan items checked off.
46
+ 5. On completion, clear the state in `workflow-gate.json` by overwriting it with `{}`.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Security and architecture audit. Deeper than review, focused on finding vulnerabilities and structural anti-patterns.
4
4
 
5
+ Grounded in: OWASP Top 10 (2021), OWASP ASVS v4, CVSS vulnerability report structure, CWE classification.
6
+
5
7
  ## Audit Scope
6
8
 
7
9
  1. **Trust boundaries**: Every point where external input enters the system. Validate that inputs are sanitized, normalized, and rejected when invalid.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Track deferred enforcement violations. When an ASC ladder nudge fires and the shortcut is accepted rather than fixed, log it here for later resolution.
4
4
 
5
+ Grounded in: Cunningham's technical debt metaphor (1992). Entry format (ladder step + violation + status lifecycle) is an ASC-specific implementation.
6
+
5
7
  ## Storage
6
8
 
7
9
  Entries persist in `.agent-context/state/debt-ledger.json` via MCP `state_read`/`state_write`. The ledger is a JSON array of entry objects.
@@ -0,0 +1,49 @@
1
+ # New Project Workflow
2
+
3
+ Structured greenfield workflow. Prevents building before alignment on what to build.
4
+
5
+ Grounded in: Spec-Driven Development (SDD) with scaffolding-spec approach. Specs guide implementation, then the code becomes the source of truth — specs are not maintained as living documents unless the team explicitly opts in.
6
+
7
+ ## Gate Mechanism
8
+
9
+ This workflow nudges the agent to stop at each phase boundary, same enforcement tier as the existing decision ladder — not a hard block. Bypasses are logged to the debt ledger.
10
+
11
+ **Known limitation:** Bypass-to-debt-ledger logging is self-reported by the agent, not enforced by the hook. The PostToolUse hook has no MCP access — it nudges the agent to log, but cannot write the debt entry itself.
12
+
13
+ To track phase, write to `workflow-gate.json` via the `state_write` MCP tool.
14
+ Format:
15
+ ```json
16
+ {
17
+ "workflow": "asc-new-project",
18
+ "phase": "<current_phase>",
19
+ "updatedAt": "<ISO-timestamp>"
20
+ }
21
+ ```
22
+
23
+ ## Phase 1: Define (No Code)
24
+
25
+ 1. Write `workflow-gate.json` with phase `research`.
26
+ 2. Clarify with the user: tech stack, target platform, constraints, non-goals.
27
+ 3. Propose a directory structure and module boundaries.
28
+ 4. Output a project brief summarizing decisions.
29
+ 5. **STOP and wait for user approval.** Do not write specs or code.
30
+
31
+ ## Phase 2: Spec (No Implementation Code)
32
+
33
+ 1. On approval of Phase 1, update `workflow-gate.json` phase to `plan`.
34
+ 2. Write per-feature specs with acceptance criteria and edge cases.
35
+ 3. Specs are scaffolding — they guide the build, then the code is the source of truth.
36
+ 4. Output specs for review.
37
+ 5. **STOP and wait for user approval.** Do not implement.
38
+
39
+ ## Phase 3: Implement
40
+
41
+ 1. On approval of Phase 2, update `workflow-gate.json` phase to `implement`.
42
+ 2. Build against the approved specs. Apply the ASC decision ladder on every file.
43
+ 3. Run the decision ladder: does this need to exist? Does stdlib cover it? One function or full module?
44
+
45
+ ## Phase 4: Validate
46
+
47
+ 1. Run tests. Check each spec's acceptance criteria.
48
+ 2. Confirm nothing was over-built beyond what the specs required.
49
+ 3. On completion, clear the state in `workflow-gate.json` by overwriting it with `{}`.
@@ -2,12 +2,33 @@
2
2
 
3
3
  Structured refactoring workflow. Preserves existing behavior while improving structure.
4
4
 
5
+ Grounded in: Fowler's Refactoring (read-understand-smallest scope-preserve behavior), Rule of Three (abstraction threshold), YAGNI principle (XP/Kent Beck). Empirical evidence: agents dominate low-level refactors (rename, extract, type changes) but struggle with multi-file architectural changes (arXiv, 15k+ instance study).
6
+
7
+ ## YAGNI Scan (Before Any Restructuring)
8
+
9
+ Before changing structure, scan for speculative code to remove:
10
+ - "Just in case" logic, unused feature flags, dead branches behind config toggles.
11
+ - Abstractions wrapping a single implementation with no second consumer.
12
+ - Premature extension points (plugin hooks, strategy patterns) with one concrete path.
13
+
14
+ Removing speculative code is the highest-value, lowest-risk refactor type.
15
+
16
+ ## Classify Before Proceeding
17
+
18
+ After reading the target code, classify the refactor:
19
+
20
+ - **Low-level** (rename, extract method, type safety, dead code removal): proceed after explaining the change. No approval gate needed.
21
+ - **High-level** (move module, change architecture, redesign abstractions, multi-file structural changes): output a plan with specific files and rationale, then **stop and wait for user approval** before implementing.
22
+
23
+ **Known limitation:** The high-level refactor gate is a skill-text instruction — the agent self-classifies and self-stops. Unlike `/asc-add-feature` and `/asc-new-project`, this gate is not backed by the PostToolUse hook or workflow-gate.json. If the agent bypasses the gate, there is no automated nudge.
24
+
5
25
  ## Before Editing
6
26
 
7
27
  1. Read the target code and understand existing patterns.
8
28
  2. Identify the smallest relevant scope for the refactor.
9
- 3. If the change touches UI, check accessibility and responsive behavior.
10
- 4. If the change touches dependencies, verify current official docs.
29
+ 3. Classify the refactor (see above). If high-level, stop and present a plan.
30
+ 4. If the change touches UI, check accessibility and responsive behavior.
31
+ 5. If the change touches dependencies, verify current official docs.
11
32
 
12
33
  ## Refactor Rules
13
34
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  Domain-specific coding rules for testing, API design, database queries, frontend components, infrastructure configs, and service resilience. Load this skill when working on any of these domains.
4
4
 
5
+ Grounded in: WCAG 2.2 AA (accessibility), Fowler's Money Pattern (monetary types), Nygard's Release It! (resilience patterns), AWS Well-Architected Reliability Pillar (backoff/circuit breakers), OWASP Secure Coding Practices (input validation, logging).
6
+
5
7
  ## Testing
6
8
 
7
9
  - Write tests for business logic and boundary failures, not implementation details.
@@ -2,6 +2,8 @@
2
2
 
3
3
  Production-risk code review. Prioritize findings by severity.
4
4
 
5
+ Grounded in: OWASP Risk Rating Methodology, Google Engineering Practices (code review guide), Clean Architecture (transport vs business layer separation).
6
+
5
7
  ## Before Reviewing
6
8
 
7
9
  1. Read the changed files and understand the scope.