@ryuenn3123/agentic-senior-core 5.3.0 → 5.5.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/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +12 -77
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +11 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-debt/SKILL.md +64 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-reference/SKILL.md +51 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +4 -3
- package/.agents/rules/agentic-senior-core.md +12 -77
- package/.claude-plugin/plugin.json +1 -1
- package/.clinerules/agentic-senior-core.md +9 -12
- package/.codex-plugin/plugin.json +1 -1
- package/.continue/rules/agentic-senior-core.md +9 -12
- package/.cursor/rules/agentic-senior-core.mdc +9 -12
- package/.devin/rules/agentic-senior-core.md +9 -12
- package/.devin-plugin/plugin.json +1 -1
- package/.github/copilot-instructions.md +9 -12
- package/.github/plugin/plugin.json +1 -1
- package/.kilocode/rules/agentic-senior-core.md +9 -12
- package/.kiro/steering/agentic-senior-core.md +9 -12
- package/.openclaw/skills/asc/SKILL.md +11 -0
- package/.openclaw/skills/asc-debt/SKILL.md +71 -0
- package/.openclaw/skills/asc-reference/SKILL.md +58 -0
- package/.openclaw/skills/asc-review/SKILL.md +4 -3
- package/.openhands/microagents/agentic-senior-core.md +9 -12
- package/.roo/rules/agentic-senior-core.md +9 -12
- package/.windsurf/rules/agentic-senior-core.md +9 -12
- package/.zed/rules/agentic-senior-core.md +9 -12
- package/AGENTS.md +12 -77
- package/CONVENTIONS.md +9 -12
- package/README.md +27 -4
- package/gemini-extension.json +1 -1
- package/hooks/copilot-hooks.json +9 -0
- package/hooks/hooks.json +14 -0
- package/hooks/post-edit-enforce.js +134 -0
- package/package.json +1 -1
- package/plugin.yaml +3 -1
- package/scripts/mcp-server/constants.mjs +2 -9
- package/skills/asc/SKILL.md +11 -0
- package/skills/asc-debt/SKILL.md +64 -0
- package/skills/asc-refactor/SKILL.md +1 -1
- package/skills/asc-reference/SKILL.md +51 -0
- package/skills/asc-review/SKILL.md +4 -3
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
4
4
|
The best code is the code never written. Write only what the task needs.
|
|
5
5
|
|
|
6
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
7
|
+
|
|
6
8
|
Before writing any code, stop at the first step that holds:
|
|
7
9
|
|
|
8
10
|
1. Does this need to be built at all?
|
|
@@ -16,8 +18,9 @@ Before writing any code, stop at the first step that holds:
|
|
|
16
18
|
|
|
17
19
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
18
20
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
+
- Three similar lines is better than a premature abstraction.
|
|
22
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
23
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
21
24
|
- Delete code that carries no behavior, safety, or test value.
|
|
22
25
|
|
|
23
26
|
## Architecture
|
|
@@ -26,7 +29,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
26
29
|
- No custom crypto, state management, or routing when standard libraries exist.
|
|
27
30
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
28
31
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
29
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
30
32
|
|
|
31
33
|
## Security (never skip)
|
|
32
34
|
|
|
@@ -40,9 +42,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
40
42
|
## Error Handling
|
|
41
43
|
|
|
42
44
|
- Fail fast on invalid input.
|
|
45
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
43
46
|
- Structured error responses with safe details only.
|
|
44
47
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
45
|
-
-
|
|
48
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
46
49
|
|
|
47
50
|
## Testing
|
|
48
51
|
|
|
@@ -60,7 +63,7 @@ Before writing any code, stop at the first step that holds:
|
|
|
60
63
|
|
|
61
64
|
## Database
|
|
62
65
|
|
|
63
|
-
-
|
|
66
|
+
- Use eager loading or batching to eliminate N+1 queries. Paginate all growable datasets.
|
|
64
67
|
- Multi-table mutations run inside transactions.
|
|
65
68
|
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
66
69
|
- Schema changes require versioned, reversible migrations.
|
|
@@ -83,12 +86,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
83
86
|
- Retries use exponential backoff with jitter. Only retry idempotent operations.
|
|
84
87
|
- Circuit breakers for unhealthy dependencies.
|
|
85
88
|
|
|
86
|
-
## Async and Events
|
|
87
|
-
|
|
88
|
-
- Events are immutable. Consumers are idempotent.
|
|
89
|
-
- Dead-letter queues for failed messages.
|
|
90
|
-
- Background jobs have timeouts and retry limits.
|
|
91
|
-
|
|
92
89
|
## Response Style
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Format: direct statement, then evidence. Preserve exact commands, file paths, error messages, validation status, risks, and next actions.
|
package/AGENTS.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
4
4
|
The best code is the code never written. Write only what the task needs.
|
|
5
5
|
|
|
6
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
7
|
+
|
|
6
8
|
Before writing any code, stop at the first step that holds:
|
|
7
9
|
|
|
8
10
|
1. Does this need to be built at all?
|
|
@@ -16,10 +18,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
16
18
|
|
|
17
19
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
18
20
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
+
- Three similar lines is better than a premature abstraction.
|
|
22
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
23
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
21
24
|
- Delete code that carries no behavior, safety, or test value.
|
|
22
|
-
- Plain English in documentation. No emoji in formal docs or review summaries.
|
|
23
25
|
|
|
24
26
|
## Architecture
|
|
25
27
|
|
|
@@ -28,7 +30,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
28
30
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
29
31
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
30
32
|
- Direction changes require explicit user confirmation.
|
|
31
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
32
33
|
|
|
33
34
|
## Security (never skip)
|
|
34
35
|
|
|
@@ -44,83 +45,17 @@ Before writing any code, stop at the first step that holds:
|
|
|
44
45
|
## Error Handling
|
|
45
46
|
|
|
46
47
|
- Fail fast on invalid input.
|
|
48
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
47
49
|
- Structured error responses with safe details only. Use standard error codes (RFC 9457 when applicable).
|
|
48
50
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- Write tests for business logic and boundary failures, not implementation details.
|
|
54
|
-
- Cover happy path, error paths, edge cases, and empty states.
|
|
55
|
-
- Tests must be fast, isolated, deterministic.
|
|
56
|
-
- Integration tests for critical data paths.
|
|
57
|
-
- Sensitive mutations need idempotency or duplicate-submit coverage.
|
|
58
|
-
- CI pipelines block on test failures.
|
|
59
|
-
|
|
60
|
-
## API Design
|
|
61
|
-
|
|
62
|
-
- Consistent resource naming and HTTP semantics.
|
|
63
|
-
- Bounded list reads: always paginate or set explicit limits.
|
|
64
|
-
- Idempotent for side-effect mutations. Document retry behavior.
|
|
65
|
-
- Backward-compatible by default. Version breaking changes explicitly.
|
|
66
|
-
- Sync docs in the same commit when changing API, CLI, or schema.
|
|
67
|
-
- Use OpenAPI 3.1 for HTTP APIs where applicable.
|
|
68
|
-
- Document deprecation windows before sunsetting endpoints.
|
|
69
|
-
|
|
70
|
-
## Database
|
|
71
|
-
|
|
72
|
-
- Avoid N+1 queries. Use eager loading or batching.
|
|
73
|
-
- Paginate all growable datasets. No unbounded queries.
|
|
74
|
-
- Multi-table mutations run inside transactions.
|
|
75
|
-
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
76
|
-
- Timestamps in UTC. No naive timestamps.
|
|
77
|
-
- Use optimistic concurrency tokens for shared mutable resources.
|
|
78
|
-
- Schema changes require versioned, reversible migrations.
|
|
79
|
-
- Never modify merged migrations. Create new ones.
|
|
80
|
-
- Use concurrent index builds in production.
|
|
81
|
-
|
|
82
|
-
## Frontend
|
|
83
|
-
|
|
84
|
-
- Semantic HTML before custom components.
|
|
85
|
-
- WCAG 2.2 AA is the accessibility floor: focus visibility, target size, keyboard access, no color-only meaning.
|
|
86
|
-
- Responsive by default. Recompose content for breakpoints, not just shrink.
|
|
87
|
-
- Explicitly handle empty, loading, error, and offline states.
|
|
88
|
-
- CSS logical properties for direction-sensitive layout.
|
|
89
|
-
- Plan overflow, wrapping, truncation, and motion fallbacks.
|
|
90
|
-
- No placeholder, lorem, or TODO content in production UI.
|
|
91
|
-
- Use component kits or headless primitives for behavior and accessibility when they fit.
|
|
92
|
-
|
|
93
|
-
## Infrastructure
|
|
94
|
-
|
|
95
|
-
- Container configs: multi-stage builds, minimal base images, non-root users, no baked secrets.
|
|
96
|
-
- Explicit healthchecks in production.
|
|
97
|
-
- Configuration from environment, validated at startup. Fail fast if invalid.
|
|
98
|
-
- Feature flags for incremental rollouts.
|
|
99
|
-
- Structured logging with correlation IDs. No PII in logs.
|
|
100
|
-
- Measure latency, traffic, errors, saturation.
|
|
101
|
-
|
|
102
|
-
## Resilience
|
|
103
|
-
|
|
104
|
-
- Every outbound network call has a strict timeout.
|
|
105
|
-
- Retries use exponential backoff with jitter and max attempt limits.
|
|
106
|
-
- Only retry idempotent operations.
|
|
107
|
-
- Circuit breakers for unhealthy dependencies.
|
|
108
|
-
- Graceful degradation on non-critical dependency failures.
|
|
109
|
-
- Cross-service calls must have timeouts and retries. Independent services own their data.
|
|
110
|
-
|
|
111
|
-
## Async and Events
|
|
112
|
-
|
|
113
|
-
- Events are immutable. Consumers are idempotent.
|
|
114
|
-
- Dead-letter queues for failed or poison messages.
|
|
115
|
-
- Handle out-of-order events.
|
|
116
|
-
- Background jobs: offload heavy processing (>500ms) to queues. Jobs have timeouts and retry limits.
|
|
117
|
-
- SSE for one-way server-to-client. WebSockets only for true bidirectional.
|
|
118
|
-
- Realtime connections degrade gracefully to polling.
|
|
51
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
52
|
+
|
|
53
|
+
For domain-specific rules (Testing, API Design, Database, Frontend, Infrastructure, Resilience), use `/asc-reference`.
|
|
119
54
|
|
|
120
55
|
## Response Style
|
|
121
56
|
|
|
122
|
-
|
|
57
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Follow with context only when the action depends on it.
|
|
123
58
|
|
|
124
|
-
|
|
59
|
+
Format: direct statement, then evidence. Example — "Add `--strict` to tsconfig. Without it, nullable checks in `UserService.ts:42` are silently skipped."
|
|
125
60
|
|
|
126
|
-
|
|
61
|
+
Preserve: exact commands, file paths, line numbers, error messages, exit codes, validation status, assumptions, blockers, risks, and next actions.
|
package/CONVENTIONS.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
You write code like a staff engineer. Efficient, safe, maintainable.
|
|
4
4
|
The best code is the code never written. Write only what the task needs.
|
|
5
5
|
|
|
6
|
+
When you see a 50-line function that does what a stdlib one-liner does — replace it. When asked to add a dependency that duplicates a built-in — push back.
|
|
7
|
+
|
|
6
8
|
Before writing any code, stop at the first step that holds:
|
|
7
9
|
|
|
8
10
|
1. Does this need to be built at all?
|
|
@@ -16,8 +18,9 @@ Before writing any code, stop at the first step that holds:
|
|
|
16
18
|
|
|
17
19
|
- Descriptive variable and function names. No cryptic abbreviations.
|
|
18
20
|
- Early returns over deep nesting. Keep the main flow traceable.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
+
- Three similar lines is better than a premature abstraction.
|
|
22
|
+
- Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
|
|
23
|
+
- Design for current requirements. Defer speculative extensions until evidence shows near-term need.
|
|
21
24
|
- Delete code that carries no behavior, safety, or test value.
|
|
22
25
|
|
|
23
26
|
## Architecture
|
|
@@ -26,7 +29,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
26
29
|
- No custom crypto, state management, or routing when standard libraries exist.
|
|
27
30
|
- Controllers handle protocol translation only. Business logic belongs in services.
|
|
28
31
|
- Default to modular monolith unless scale evidence demands microservices.
|
|
29
|
-
- Do not choose framework by habit. Match project evidence and needs.
|
|
30
32
|
|
|
31
33
|
## Security (never skip)
|
|
32
34
|
|
|
@@ -40,9 +42,10 @@ Before writing any code, stop at the first step that holds:
|
|
|
40
42
|
## Error Handling
|
|
41
43
|
|
|
42
44
|
- Fail fast on invalid input.
|
|
45
|
+
- Handle only errors that can actually occur. Validate at system boundaries where untrusted input enters.
|
|
43
46
|
- Structured error responses with safe details only.
|
|
44
47
|
- Distinguish client errors (4xx) from server errors (5xx).
|
|
45
|
-
-
|
|
48
|
+
- Surface every operational error with context. Empty catch blocks mask production issues.
|
|
46
49
|
|
|
47
50
|
## Testing
|
|
48
51
|
|
|
@@ -60,7 +63,7 @@ Before writing any code, stop at the first step that holds:
|
|
|
60
63
|
|
|
61
64
|
## Database
|
|
62
65
|
|
|
63
|
-
-
|
|
66
|
+
- Use eager loading or batching to eliminate N+1 queries. Paginate all growable datasets.
|
|
64
67
|
- Multi-table mutations run inside transactions.
|
|
65
68
|
- Monetary amounts: integer minor units or exact decimal. Never floats.
|
|
66
69
|
- Schema changes require versioned, reversible migrations.
|
|
@@ -83,12 +86,6 @@ Before writing any code, stop at the first step that holds:
|
|
|
83
86
|
- Retries use exponential backoff with jitter. Only retry idempotent operations.
|
|
84
87
|
- Circuit breakers for unhealthy dependencies.
|
|
85
88
|
|
|
86
|
-
## Async and Events
|
|
87
|
-
|
|
88
|
-
- Events are immutable. Consumers are idempotent.
|
|
89
|
-
- Dead-letter queues for failed messages.
|
|
90
|
-
- Background jobs have timeouts and retry limits.
|
|
91
|
-
|
|
92
89
|
## Response Style
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
Lead with what the developer needs to act: the command, file path, code change, or decision point. Format: direct statement, then evidence. Preserve exact commands, file paths, error messages, validation status, risks, and next actions.
|
package/README.md
CHANGED
|
@@ -28,8 +28,18 @@ npm install -g @ryuenn3123/agentic-senior-core
|
|
|
28
28
|
|
|
29
29
|
Rules load automatically via plugin hooks. No per-project files needed.
|
|
30
30
|
|
|
31
|
+
From inside Claude Code, add the marketplace then install:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
/plugin marketplace add fatidaprilian/Agentic-Senior-Core
|
|
35
|
+
/plugin install agentic-senior-core@agentic-senior-core
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or from your terminal shell:
|
|
39
|
+
|
|
31
40
|
```bash
|
|
32
|
-
claude plugin add fatidaprilian/Agentic-Senior-Core
|
|
41
|
+
claude plugin marketplace add fatidaprilian/Agentic-Senior-Core
|
|
42
|
+
claude plugin install agentic-senior-core@agentic-senior-core
|
|
33
43
|
```
|
|
34
44
|
|
|
35
45
|
After install, every Claude Code session injects the rules on startup -- including subagents.
|
|
@@ -200,25 +210,36 @@ Copies one file to `.openhands/microagents/agentic-senior-core.md`. Repeat per p
|
|
|
200
210
|
Copy the rules file into your project's `.agents/rules/` directory:
|
|
201
211
|
|
|
202
212
|
```bash
|
|
213
|
+
# Create the directory first, then copy
|
|
214
|
+
mkdir -p .agents/rules
|
|
215
|
+
|
|
203
216
|
# From the npm package (after Step 1)
|
|
204
217
|
cp "$(npm root -g)/@ryuenn3123/agentic-senior-core/.agents/rules/agentic-senior-core.md" .agents/rules/
|
|
205
218
|
```
|
|
206
219
|
|
|
220
|
+
PowerShell (Windows):
|
|
221
|
+
```powershell
|
|
222
|
+
mkdir .agents\rules -Force
|
|
223
|
+
cp "$(npm root -g)/@ryuenn3123/agentic-senior-core/.agents/rules/agentic-senior-core.md" .agents\rules\
|
|
224
|
+
```
|
|
225
|
+
|
|
207
226
|
Antigravity IDE reads it automatically with `trigger: always_on`.
|
|
208
227
|
|
|
209
228
|
**Option B -- global plugin (all projects):**
|
|
210
229
|
|
|
211
230
|
Copy the plugin bundle to Antigravity's global plugin directory:
|
|
212
231
|
|
|
213
|
-
```
|
|
232
|
+
```powershell
|
|
214
233
|
# Windows
|
|
215
234
|
xcopy /E /I "%APPDATA%\npm\node_modules\@ryuenn3123\agentic-senior-core\.agents\plugins\agentic-senior-core" "%USERPROFILE%\.gemini\config\plugins\agentic-senior-core"
|
|
235
|
+
```
|
|
216
236
|
|
|
237
|
+
```bash
|
|
217
238
|
# macOS / Linux
|
|
218
239
|
cp -r "$(npm root -g)/@ryuenn3123/agentic-senior-core/.agents/plugins/agentic-senior-core" ~/.gemini/config/plugins/
|
|
219
240
|
```
|
|
220
241
|
|
|
221
|
-
The plugin bundle includes rules, skills (`/asc-review`, `/asc-audit`, `/asc-refactor`), and `plugin.json`.
|
|
242
|
+
The plugin bundle includes rules, skills (`/asc-review`, `/asc-audit`, `/asc-refactor`, `/asc-reference`, `/asc-debt`), and `plugin.json`.
|
|
222
243
|
|
|
223
244
|
</details>
|
|
224
245
|
|
|
@@ -291,7 +312,7 @@ Input validation at trust boundaries, parameterized queries, auth checks, error
|
|
|
291
312
|
|
|
292
313
|
| Host | Type | Install | Per-project files? |
|
|
293
314
|
|------|------|---------|-------------------|
|
|
294
|
-
| Claude Code | Terminal agent |
|
|
315
|
+
| Claude Code | Terminal agent | `/plugin install` | No |
|
|
295
316
|
| Codex CLI | Terminal agent | `codex plugins install` | No |
|
|
296
317
|
| Gemini CLI | Terminal agent | Auto-detected | No |
|
|
297
318
|
| Copilot CLI | Terminal agent | Plugin registration | No |
|
|
@@ -325,6 +346,8 @@ Available on plugin hosts (Claude Code, Codex, Gemini CLI):
|
|
|
325
346
|
| `/asc-refactor` | Structured refactoring workflow |
|
|
326
347
|
| `/asc-review` | Production-risk code review with severity-ordered findings |
|
|
327
348
|
| `/asc-audit` | Security and architecture audit |
|
|
349
|
+
| `/asc-reference` | Domain-specific rules (testing, API, database, frontend, infra, resilience) |
|
|
350
|
+
| `/asc-debt` | Track deferred enforcement violations (add, list, resolve, summary) |
|
|
328
351
|
| `/asc-help` | Show available commands |
|
|
329
352
|
|
|
330
353
|
---
|
package/gemini-extension.json
CHANGED
package/hooks/copilot-hooks.json
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
"powershell": "node \"${PLUGIN_ROOT}\\hooks\\subagent-start.js\"",
|
|
17
17
|
"timeoutSec": 5
|
|
18
18
|
}
|
|
19
|
+
],
|
|
20
|
+
"postToolUse": [
|
|
21
|
+
{
|
|
22
|
+
"type": "command",
|
|
23
|
+
"matcher": "Edit|Write",
|
|
24
|
+
"bash": "node \"${PLUGIN_ROOT}/hooks/post-edit-enforce.js\"",
|
|
25
|
+
"powershell": "node \"${PLUGIN_ROOT}\\hooks\\post-edit-enforce.js\"",
|
|
26
|
+
"timeoutSec": 5
|
|
27
|
+
}
|
|
19
28
|
]
|
|
20
29
|
}
|
|
21
30
|
}
|
package/hooks/hooks.json
CHANGED
|
@@ -26,6 +26,20 @@
|
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
|
+
],
|
|
30
|
+
"PostToolUse": [
|
|
31
|
+
{
|
|
32
|
+
"matcher": "Edit|Write",
|
|
33
|
+
"hooks": [
|
|
34
|
+
{
|
|
35
|
+
"type": "command",
|
|
36
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/post-edit-enforce.js\"; exit 0",
|
|
37
|
+
"commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\post-edit-enforce.js\" }",
|
|
38
|
+
"timeout": 5,
|
|
39
|
+
"statusMessage": "ASC ladder check..."
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
29
43
|
]
|
|
30
44
|
}
|
|
31
45
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Agentic Senior Core — PostToolUse enforcement hook
|
|
3
|
+
// Fires after Edit/Write. Checks for ladder violations and injects a nudge.
|
|
4
|
+
// Supports Claude Code, Codex CLI, and GitHub Copilot CLI.
|
|
5
|
+
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
const STDLIB_DUPLICATES = new Set([
|
|
9
|
+
'lodash', 'lodash-es', 'underscore',
|
|
10
|
+
'moment', 'dayjs',
|
|
11
|
+
'uuid', 'nanoid',
|
|
12
|
+
'chalk', 'kleur', 'colorette',
|
|
13
|
+
'axios', 'got', 'node-fetch', 'superagent',
|
|
14
|
+
'mkdirp', 'rimraf', 'del',
|
|
15
|
+
'glob', 'globby',
|
|
16
|
+
'left-pad', 'pad-left',
|
|
17
|
+
'is-odd', 'is-even', 'is-number', 'is-string',
|
|
18
|
+
'path-exists', 'fs-extra',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const SOURCE_EXTENSIONS = new Set([
|
|
22
|
+
'js', 'ts', 'mjs', 'cjs', 'jsx', 'tsx',
|
|
23
|
+
'py', 'rb', 'go', 'rs', 'java', 'kt', 'swift', 'cs',
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
const LOC_DELTA_THRESHOLD = 30;
|
|
27
|
+
const NEW_FILE_LINE_THRESHOLD = 50;
|
|
28
|
+
|
|
29
|
+
let inputBuffer = '';
|
|
30
|
+
process.stdin.setEncoding('utf8');
|
|
31
|
+
process.stdin.on('data', function (chunk) { inputBuffer += chunk; });
|
|
32
|
+
process.stdin.on('end', function () {
|
|
33
|
+
try {
|
|
34
|
+
const data = JSON.parse(inputBuffer);
|
|
35
|
+
const toolName = data.tool_name || '';
|
|
36
|
+
const toolInput = data.tool_input || {};
|
|
37
|
+
const filePath = toolInput.file_path || '';
|
|
38
|
+
const findings = [];
|
|
39
|
+
|
|
40
|
+
if (filePath.endsWith('package.json') || filePath.endsWith('package.json5')) {
|
|
41
|
+
checkDependencyAddition(toolName, toolInput, findings);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ext = path.extname(filePath).slice(1);
|
|
45
|
+
if (SOURCE_EXTENSIONS.has(ext)) {
|
|
46
|
+
if (toolName === 'Edit') {
|
|
47
|
+
checkLocDelta(toolInput, filePath, findings);
|
|
48
|
+
} else if (toolName === 'Write') {
|
|
49
|
+
checkNewFileSize(toolInput, filePath, findings);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (findings.length === 0) return;
|
|
54
|
+
|
|
55
|
+
const nudge = '[ASC enforcement] ' + findings.join(' ') + ' Review the decision ladder before continuing.';
|
|
56
|
+
emit(nudge);
|
|
57
|
+
} catch (_) {
|
|
58
|
+
// Silent fail — enforcement must not break the session
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function checkDependencyAddition(toolName, toolInput, findings) {
|
|
63
|
+
var target = toolName === 'Edit' ? (toolInput.new_string || '') : (toolInput.content || '');
|
|
64
|
+
var baseline = toolName === 'Edit' ? (toolInput.old_string || '') : '';
|
|
65
|
+
|
|
66
|
+
var depPattern = /"([^"]+)"\s*:\s*"[~^>=<*]?\d/g;
|
|
67
|
+
var newDeps = extractDeps(target, depPattern);
|
|
68
|
+
var oldDeps = extractDeps(baseline, depPattern);
|
|
69
|
+
|
|
70
|
+
var added = newDeps.filter(function (d) { return oldDeps.indexOf(d) === -1; });
|
|
71
|
+
if (added.length === 0) return;
|
|
72
|
+
|
|
73
|
+
var stdlibDupes = added.filter(function (d) { return STDLIB_DUPLICATES.has(d); });
|
|
74
|
+
if (stdlibDupes.length > 0) {
|
|
75
|
+
findings.push(
|
|
76
|
+
'Dependency ' + stdlibDupes.join(', ') + ' may duplicate stdlib/platform features. '
|
|
77
|
+
+ 'Ladder step 3: does the standard library cover this?'
|
|
78
|
+
);
|
|
79
|
+
} else {
|
|
80
|
+
findings.push(
|
|
81
|
+
'New dependency added: ' + added.join(', ') + '. '
|
|
82
|
+
+ 'Ladder step 3-4: stdlib or already-installed alternative?'
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function extractDeps(text, pattern) {
|
|
88
|
+
var matches = [];
|
|
89
|
+
var match;
|
|
90
|
+
while ((match = pattern.exec(text)) !== null) {
|
|
91
|
+
matches.push(match[1]);
|
|
92
|
+
}
|
|
93
|
+
return matches;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function checkLocDelta(toolInput, filePath, findings) {
|
|
97
|
+
var newLines = (toolInput.new_string || '').split('\n').length;
|
|
98
|
+
var oldLines = (toolInput.old_string || '').split('\n').length;
|
|
99
|
+
var delta = newLines - oldLines;
|
|
100
|
+
if (delta > LOC_DELTA_THRESHOLD) {
|
|
101
|
+
findings.push(
|
|
102
|
+
'Edit added ' + delta + ' net lines to ' + path.basename(filePath) + '. '
|
|
103
|
+
+ 'Ladder step 5: can this be one straightforward function?'
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function checkNewFileSize(toolInput, filePath, findings) {
|
|
109
|
+
var lines = (toolInput.content || '').split('\n').length;
|
|
110
|
+
if (lines > NEW_FILE_LINE_THRESHOLD) {
|
|
111
|
+
findings.push(
|
|
112
|
+
'New file ' + path.basename(filePath) + ' created with ' + lines + ' lines. '
|
|
113
|
+
+ 'Ladder step 1-2: does this need to be built? Does the codebase already have this?'
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function emit(nudge) {
|
|
119
|
+
try {
|
|
120
|
+
var isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
|
|
121
|
+
var output = {
|
|
122
|
+
hookSpecificOutput: {
|
|
123
|
+
hookEventName: 'PostToolUse',
|
|
124
|
+
additionalContext: nudge,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
if (isCopilot) {
|
|
128
|
+
output = { additionalContext: nudge };
|
|
129
|
+
}
|
|
130
|
+
process.stdout.write(JSON.stringify(output));
|
|
131
|
+
} catch (_) {
|
|
132
|
+
// EPIPE — silent
|
|
133
|
+
}
|
|
134
|
+
}
|
package/package.json
CHANGED
package/plugin.yaml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: agentic-senior-core
|
|
2
|
-
version: 5.
|
|
2
|
+
version: 5.5.0
|
|
3
3
|
description: Universal AI coding rules. Write code like a staff engineer.
|
|
4
4
|
author: fatidaprilian
|
|
5
5
|
provides_hooks:
|
|
@@ -14,3 +14,5 @@ provides_skills:
|
|
|
14
14
|
- asc-refactor
|
|
15
15
|
- asc-review
|
|
16
16
|
- asc-audit
|
|
17
|
+
- asc-debt
|
|
18
|
+
- asc-reference
|
|
@@ -37,17 +37,10 @@ function resolvePackageVersion() {
|
|
|
37
37
|
export const PACKAGE_VERSION = resolvePackageVersion();
|
|
38
38
|
|
|
39
39
|
export const TEST_SUITE_ARGS = {
|
|
40
|
-
|
|
41
|
-
cli: ['--test', './tests/cli-smoke.test.mjs'],
|
|
42
|
-
operations: ['--test', './tests/operations.test.mjs'],
|
|
43
|
-
'llm-judge': ['--test', './tests/llm-judge.test.mjs'],
|
|
40
|
+
adapter: ['--test', './tests/adapter.test.mjs'],
|
|
44
41
|
};
|
|
45
42
|
|
|
46
|
-
export const INTERNAL_SCRIPT_PATHS = {
|
|
47
|
-
validate: resolve(REPOSITORY_ROOT, 'scripts', 'validate.mjs'),
|
|
48
|
-
release_gate: resolve(REPOSITORY_ROOT, 'scripts', 'release-gate.mjs'),
|
|
49
|
-
forbidden_content_check: resolve(REPOSITORY_ROOT, 'scripts', 'forbidden-content-check.mjs'),
|
|
50
|
-
};
|
|
43
|
+
export const INTERNAL_SCRIPT_PATHS = {};
|
|
51
44
|
|
|
52
45
|
function getAvailableTestSuites() {
|
|
53
46
|
return Object.entries(TEST_SUITE_ARGS)
|
package/skills/asc/SKILL.md
CHANGED
|
@@ -7,8 +7,19 @@ Universal AI coding rules. Write code like a staff engineer.
|
|
|
7
7
|
- `/asc-refactor` -- Structured refactoring workflow with pre-checks and validation
|
|
8
8
|
- `/asc-review` -- Production-risk code review with severity-ordered findings
|
|
9
9
|
- `/asc-audit` -- Security and architecture audit
|
|
10
|
+
- `/asc-reference` -- Domain-specific rules (testing, API, database, frontend, infra, resilience)
|
|
11
|
+
- `/asc-debt` -- Track deferred enforcement violations (add, list, resolve, summary)
|
|
10
12
|
- `/asc-help` -- Show this help
|
|
11
13
|
|
|
14
|
+
## Enforcement
|
|
15
|
+
|
|
16
|
+
On plugin-tier hosts (Claude Code, Codex CLI, Copilot CLI), a PostToolUse hook fires after every Edit/Write and checks:
|
|
17
|
+
- New dependencies against stdlib duplicates (decision ladder step 3)
|
|
18
|
+
- LOC delta > 30 lines on edits (step 5)
|
|
19
|
+
- New files > 50 lines (steps 1–2)
|
|
20
|
+
|
|
21
|
+
Violations inject a nudge referencing the specific ladder step. The hook is silent when no issues are found.
|
|
22
|
+
|
|
12
23
|
## What It Does
|
|
13
24
|
|
|
14
25
|
Loads universal engineering rules on every session: code quality, architecture, security, error handling, testing, API design, database, frontend, infrastructure, resilience, and async patterns.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Debt Ledger
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
## Storage
|
|
6
|
+
|
|
7
|
+
Entries persist in `.agent-context/state/debt-ledger.json` via MCP `state_read`/`state_write`. The ledger is a JSON array of entry objects.
|
|
8
|
+
|
|
9
|
+
## Entry Format
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "sequential integer",
|
|
14
|
+
"file": "path/to/file.ts",
|
|
15
|
+
"ladderStep": "3",
|
|
16
|
+
"violation": "Added axios — stdlib fetch covers this",
|
|
17
|
+
"addedAt": "ISO-8601 timestamp",
|
|
18
|
+
"status": "open | resolved",
|
|
19
|
+
"resolvedAt": "ISO-8601 timestamp or null"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Operations
|
|
24
|
+
|
|
25
|
+
### Add Entry
|
|
26
|
+
|
|
27
|
+
When an enforcement nudge fires and the violation is deferred:
|
|
28
|
+
|
|
29
|
+
1. Read the current ledger via `state_read` (path: `debt-ledger.json`). If missing, start with `[]`.
|
|
30
|
+
2. Append a new entry with the next sequential `id`, the file path, ladder step, and a one-line violation summary.
|
|
31
|
+
3. Write the updated ledger via `state_write` (path: `debt-ledger.json`, mode: `overwrite`).
|
|
32
|
+
4. Confirm: "Logged to debt ledger: [violation summary]"
|
|
33
|
+
|
|
34
|
+
### List Open Debt
|
|
35
|
+
|
|
36
|
+
1. Read the ledger via `state_read`.
|
|
37
|
+
2. Filter to entries where `status` is `"open"`.
|
|
38
|
+
3. Display as a table: ID, file, ladder step, violation, age.
|
|
39
|
+
4. If no open entries, say so explicitly.
|
|
40
|
+
|
|
41
|
+
### Resolve Entry
|
|
42
|
+
|
|
43
|
+
When a deferred violation has been addressed:
|
|
44
|
+
|
|
45
|
+
1. Read the ledger.
|
|
46
|
+
2. Set the matching entry's `status` to `"resolved"` and `resolvedAt` to the current timestamp.
|
|
47
|
+
3. Write the updated ledger.
|
|
48
|
+
4. Confirm: "Resolved debt #[id]: [violation summary]"
|
|
49
|
+
|
|
50
|
+
### Summary
|
|
51
|
+
|
|
52
|
+
1. Read the ledger.
|
|
53
|
+
2. Report: total entries, open count, resolved count, oldest open entry age.
|
|
54
|
+
|
|
55
|
+
## When to Log
|
|
56
|
+
|
|
57
|
+
Log a debt entry when ALL of these are true:
|
|
58
|
+
- The PostToolUse enforcement hook fired a nudge
|
|
59
|
+
- The agent acknowledged the nudge but proceeded without fixing the violation
|
|
60
|
+
- The violation is deferrable (not a security issue — security violations must be fixed immediately)
|
|
61
|
+
|
|
62
|
+
## Integration
|
|
63
|
+
|
|
64
|
+
The `/asc` skill documents the enforcement loop. This ledger captures what enforcement flags but the session defers. Use `/asc-debt` at session end or before commits to review outstanding shortcuts.
|
|
@@ -14,7 +14,7 @@ Structured refactoring workflow. Preserves existing behavior while improving str
|
|
|
14
14
|
- Improve clarity, boundaries, naming, validation, error handling, and tests.
|
|
15
15
|
- Prioritize maintainability over compressed one-liners.
|
|
16
16
|
- Keep the main flow traceable. Use early returns where they reduce nesting.
|
|
17
|
-
-
|
|
17
|
+
- Introduce abstractions only when the repeated pattern is real and visible.
|
|
18
18
|
- Split large files when the split makes the flow easier to understand.
|
|
19
19
|
- Remove code that does not carry behavior, safety, clarity, maintainability, or test value.
|
|
20
20
|
- Prefer the shorter implementation only when it keeps the same guarantees.
|