@ryuenn3123/agentic-senior-core 5.4.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.
Files changed (41) hide show
  1. package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +10 -54
  2. package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +11 -0
  3. package/.agents/plugins/agentic-senior-core/skills/asc-debt/SKILL.md +64 -0
  4. package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +1 -1
  5. package/.agents/plugins/agentic-senior-core/skills/asc-reference/SKILL.md +51 -0
  6. package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +4 -3
  7. package/.agents/rules/agentic-senior-core.md +10 -54
  8. package/.claude-plugin/plugin.json +1 -1
  9. package/.clinerules/agentic-senior-core.md +8 -6
  10. package/.codex-plugin/plugin.json +1 -1
  11. package/.continue/rules/agentic-senior-core.md +8 -6
  12. package/.cursor/rules/agentic-senior-core.mdc +8 -6
  13. package/.devin/rules/agentic-senior-core.md +8 -6
  14. package/.devin-plugin/plugin.json +1 -1
  15. package/.github/copilot-instructions.md +8 -6
  16. package/.github/plugin/plugin.json +1 -1
  17. package/.kilocode/rules/agentic-senior-core.md +8 -6
  18. package/.kiro/steering/agentic-senior-core.md +8 -6
  19. package/.openclaw/skills/asc/SKILL.md +11 -0
  20. package/.openclaw/skills/asc-debt/SKILL.md +71 -0
  21. package/.openclaw/skills/asc-reference/SKILL.md +58 -0
  22. package/.openclaw/skills/asc-review/SKILL.md +4 -3
  23. package/.openhands/microagents/agentic-senior-core.md +8 -6
  24. package/.roo/rules/agentic-senior-core.md +8 -6
  25. package/.windsurf/rules/agentic-senior-core.md +8 -6
  26. package/.zed/rules/agentic-senior-core.md +8 -6
  27. package/AGENTS.md +10 -54
  28. package/CONVENTIONS.md +8 -6
  29. package/README.md +15 -3
  30. package/gemini-extension.json +1 -1
  31. package/hooks/copilot-hooks.json +9 -0
  32. package/hooks/hooks.json +14 -0
  33. package/hooks/post-edit-enforce.js +134 -0
  34. package/package.json +1 -1
  35. package/plugin.yaml +3 -1
  36. package/scripts/mcp-server/constants.mjs +2 -9
  37. package/skills/asc/SKILL.md +11 -0
  38. package/skills/asc-debt/SKILL.md +64 -0
  39. package/skills/asc-refactor/SKILL.md +1 -1
  40. package/skills/asc-reference/SKILL.md +51 -0
  41. package/skills/asc-review/SKILL.md +4 -3
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "author": "fatidaprilian",
6
6
  "license": "MIT",
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "type": "module",
5
5
  "description": "Universal AI coding rules. Write code like a staff engineer, not a junior.",
6
6
  "bin": {
package/plugin.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: agentic-senior-core
2
- version: 5.1.0
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
- full: ['--test', './tests/cli-smoke.test.mjs', './tests/mcp-server.test.mjs', './tests/llm-judge.test.mjs', './tests/operations.test.mjs'],
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)
@@ -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
- - Do not introduce abstractions before the repeated pattern is real.
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.
@@ -0,0 +1,51 @@
1
+ # ASC Domain Reference
2
+
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
+
5
+ ## Testing
6
+
7
+ - Write tests for business logic and boundary failures, not implementation details.
8
+ - Cover happy path, error paths, edge cases, and empty states.
9
+ - Tests must be fast, isolated, deterministic.
10
+ - Integration tests for critical data paths.
11
+ - Sensitive mutations need idempotency or duplicate-submit coverage.
12
+ - CI pipelines block on test failures.
13
+
14
+ ## API Design
15
+
16
+ - Consistent resource naming and HTTP semantics.
17
+ - Bounded list reads: always paginate or set explicit limits.
18
+ - Idempotent for side-effect mutations. Document retry behavior.
19
+ - Backward-compatible by default. Version breaking changes explicitly.
20
+ - Sync docs in the same commit when changing API, CLI, or schema.
21
+
22
+ ## Database
23
+
24
+ - Use eager loading or batching to eliminate N+1 queries.
25
+ - Paginate all growable datasets. No unbounded queries.
26
+ - Multi-table mutations run inside transactions.
27
+ - Monetary amounts: integer minor units or exact decimal. Never floats.
28
+ - Timestamps in UTC. No naive timestamps.
29
+ - Schema changes require versioned, reversible migrations.
30
+ - Never modify merged migrations. Create new ones.
31
+
32
+ ## Frontend
33
+
34
+ - Semantic HTML before custom components.
35
+ - WCAG 2.2 AA is the accessibility floor.
36
+ - Responsive by default. Handle empty, loading, error, and offline states.
37
+ - No placeholder, lorem, or TODO content in production UI.
38
+
39
+ ## Infrastructure
40
+
41
+ - Container configs: multi-stage builds, minimal base images, non-root users, no baked secrets.
42
+ - Configuration from environment, validated at startup. Fail fast if invalid.
43
+ - Structured logging with correlation IDs. No PII in logs.
44
+
45
+ ## Resilience
46
+
47
+ - Every outbound network call has a strict timeout.
48
+ - Retries use exponential backoff with jitter and max attempt limits.
49
+ - Only retry idempotent operations.
50
+ - Circuit breakers for unhealthy dependencies.
51
+ - Graceful degradation on non-critical dependency failure.
@@ -7,6 +7,7 @@ Production-risk code review. Prioritize findings by severity.
7
7
  1. Read the changed files and understand the scope.
8
8
  2. For UI changes, check accessibility and design consistency.
9
9
  3. For API changes, check contract stability and documentation sync.
10
+ 4. Walk the decision ladder for each new file or dependency: does this need to exist, could the stdlib or an existing dependency handle it?
10
11
 
11
12
  ## Finding Priority Order
12
13
 
@@ -33,11 +34,11 @@ Production-risk code review. Prioritize findings by severity.
33
34
  - External input validated at trust boundaries.
34
35
  - Secrets, tokens, credentials not committed or logged.
35
36
  - Authorization enforced at a trusted boundary.
36
- - Error responses do not leak internals.
37
+ - Error responses keep internal details out of client responses.
37
38
 
38
39
  ### Architecture
39
- - Layer boundaries clear. Controllers do not hold business logic.
40
- - No premature abstraction. No clever hacks.
40
+ - Layer boundaries clear. Controllers handle protocol translation only; business logic stays in services.
41
+ - Abstractions backed by real duplication, not prediction. Straightforward code over clever solutions.
41
42
  - Complexity budget applied: fewer moving parts without losing safety.
42
43
 
43
44
  ### Testing