@ryuenn3123/agentic-senior-core 5.8.23 → 5.8.25

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.
@@ -36,6 +36,10 @@ const SOURCE_EXTENSIONS = new Set([
36
36
 
37
37
  const LOC_DELTA_THRESHOLD = 30;
38
38
  const NEW_FILE_LINE_THRESHOLD = 50;
39
+ const SESSION_DRIFT_THRESHOLD = 4;
40
+
41
+ // Module-level counter for Claude Code path (resets per process spawn)
42
+ let sourceEditCount = 0;
39
43
 
40
44
  let inputBuffer = '';
41
45
  process.stdin.setEncoding('utf8');
@@ -65,6 +69,8 @@ function handleAntigravityPostInvocation(data) {
65
69
  const lines = fs.readFileSync(data.transcriptPath, 'utf8').split('\n').filter(Boolean);
66
70
  const findings = [];
67
71
 
72
+ // Session drift check: count source file edits since initialNumSteps
73
+ let sourceEditsSinceStart = 0;
68
74
  for (let i = 0; i < lines.length; i++) {
69
75
  const step = JSON.parse(lines[i]);
70
76
  if (step.step_index >= data.initialNumSteps && step.type === 'PLANNER_RESPONSE' && step.tool_calls) {
@@ -89,6 +95,10 @@ function handleAntigravityPostInvocation(data) {
89
95
  }
90
96
 
91
97
  if (toolName) {
98
+ const fp = toolInput.file_path || '';
99
+ const ext = path.extname(fp).slice(1);
100
+ if (SOURCE_EXTENSIONS.has(ext)) sourceEditsSinceStart++;
101
+
92
102
  processSingleEdit(toolName, toolInput, function(nudge) {
93
103
  findings.push(nudge);
94
104
  }, true);
@@ -97,6 +107,13 @@ function handleAntigravityPostInvocation(data) {
97
107
  }
98
108
  }
99
109
 
110
+ // Inject drift nudge if 4+ source files modified this invocation
111
+ if (sourceEditsSinceStart >= SESSION_DRIFT_THRESHOLD) {
112
+ findings.push('[ASC Session Drift] ' + sourceEditsSinceStart + ' source file edits this invocation. '
113
+ + 'Re-read the decision ladder before continuing: (1) Does this need to be built? '
114
+ + '(2) Does the codebase already have this? (3) Stdlib/native? (4) Existing dependency?');
115
+ }
116
+
100
117
  if (findings.length > 0) {
101
118
  const injectSteps = findings.map(function(f) { return { ephemeralMessage: f }; });
102
119
  process.stdout.write(JSON.stringify({ injectSteps: injectSteps }) + '\n');
@@ -113,6 +130,17 @@ function processSingleEdit(toolName, toolInput, emitFn, skipArray) {
113
130
  if (!filePath) return;
114
131
  const findings = [];
115
132
 
133
+ // Increment per-process counter for Claude Code drift detection
134
+ const ext = path.extname(filePath).slice(1);
135
+ if (SOURCE_EXTENSIONS.has(ext)) {
136
+ sourceEditCount++;
137
+ if (sourceEditCount === SESSION_DRIFT_THRESHOLD) {
138
+ findings.push('[ASC Session Drift] ' + SESSION_DRIFT_THRESHOLD + '+ source file edits this session. '
139
+ + 'Re-read the decision ladder before continuing: (1) Does this need to be built? '
140
+ + '(2) Does the codebase already have this? (3) Stdlib/native? (4) Existing dependency?');
141
+ }
142
+ }
143
+
116
144
  if (filePath.endsWith('package.json')) {
117
145
  checkDependencyAddition(toolName, toolInput, findings);
118
146
  }
@@ -37,6 +37,29 @@ process.stdin.on('end', function () {
37
37
 
38
38
  if (isTerminal) {
39
39
  const command = toolInput.command || toolInput.CommandLine || toolInput.cmd || toolInput.commandLine || '';
40
+
41
+ // Hard-block git commit/push unless explicitly allowed
42
+ if (isGitCommitOrPush(command)) {
43
+ const reason = '[ASC Hard-Block] git commit/push detected. Never run git commit, git push, or git push --force unless the user explicitly requests it this turn.';
44
+ let output;
45
+ if (isAntigravity) {
46
+ output = { decision: "deny", reason: reason };
47
+ } else {
48
+ output = {
49
+ allow_tool: false,
50
+ deny_reason: reason,
51
+ hookSpecificOutput: {
52
+ hookEventName: 'PreToolUse',
53
+ permissionDecision: 'deny',
54
+ permissionDecisionReason: reason
55
+ }
56
+ };
57
+ }
58
+ process.stdout.write(JSON.stringify(output) + '\n');
59
+ process.exit(2);
60
+ return;
61
+ }
62
+
40
63
  added = extractCommandDeps(command);
41
64
  } else if (isFileEdit) {
42
65
  const filePath = toolInput.file_path || toolInput.TargetFile || toolInput.path || toolInput.target_file || '';
@@ -100,6 +123,12 @@ process.stdin.on('end', function () {
100
123
  process.exit(0);
101
124
  });
102
125
 
126
+ function isGitCommitOrPush(command) {
127
+ // Match: git commit, git push, git push --force, git push -f
128
+ // Also match chained commands: git add . ; git commit, etc.
129
+ return /\bgit\s+(commit|push)\b/i.test(command);
130
+ }
131
+
103
132
  function extractDeps(text, pattern) {
104
133
  const matches = [];
105
134
  let match;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.8.23",
3
+ "version": "5.8.25",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "contextFileName": "rules/agentic-senior-core.md",
6
6
  "rules": [
@@ -35,6 +35,8 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
35
35
  - Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
36
36
  - Design for current requirements. Defer speculative extensions until evidence shows near-term need.
37
37
  - Delete code that carries no behavior, safety, or test value.
38
+ - When brevity and readability conflict, readability wins.
39
+ - Prefer named functions over closures/inline lambdas once logic exceeds a trivial expression.
38
40
 
39
41
  ## Architecture
40
42
 
@@ -42,6 +44,7 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
42
44
  - No custom crypto, state management, or routing when standard libraries exist.
43
45
  - Controllers handle protocol translation only. Business logic belongs in services.
44
46
  - Default to modular monolith unless scale evidence demands microservices.
47
+ - Match existing project structure before introducing new folders. No new top-level directory without clear necessity.
45
48
  - Direction changes require explicit user confirmation.
46
49
 
47
50
  ## Security (never skip)
@@ -65,6 +68,9 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
65
68
 
66
69
  ## Workflow
67
70
 
71
+ - Prefix ALL terminal commands with `ascx` to compress output and save tokens (e.g., `ascx <your_command>`).
72
+ - Never run `git commit`, `git push`, or `git push --force` unless the user explicitly requests it this turn.
73
+
68
74
  Recognize the scenario and offer the matching command — user decides
69
75
  whether to invoke it. Skip this for trivial edits.
70
76
 
@@ -80,3 +86,4 @@ Lead with what the developer needs to act: the command, file path, code change,
80
86
  Format: direct statement, then evidence. Example — "Add `--strict` to tsconfig. Without it, nullable checks in `UserService.ts:42` are silently skipped."
81
87
 
82
88
  Preserve: exact commands, file paths, line numbers, error messages, exit codes, validation status, assumptions, blockers, risks, and next actions.
89
+ - Before confirming a non-trivial plan, state at least one trade-off or alternative.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc
3
3
  description: >
4
- Universal AI coding rules. Write code like a staff engineer. Use this skill when user asks for general coding guidelines, best practices, standard rules, code quality standards, or when acting as a senior/staff software engineer.
4
+ Trigger this skill when the user says: "what are the rules", "coding guidelines", "best practices", "code quality standards", "how should I write this", "staff engineer approach", "senior developer rules", "what does ASC say about". Also trigger for any general request about coding standards, quality guidelines, or when the user asks the agent to follow senior/staff engineering practices.
5
5
  ---
6
6
 
7
7
  # Agentic Senior Core
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-adapter
3
3
  description: >
4
- Detect installed AI coding hosts and generate adapter files for the current project. Use this skill when user asks to install, configure, setup, or initialize Agentic Senior Core rules, adapter files, or plugins for their IDE (Cursor, Windsurf, Devin, Copilot, Roo, Cline, Aider, Kiro).
4
+ Trigger this skill when the user says: "install ASC", "set up rules", "configure for Cursor", "add to Windsurf", "set up Copilot", "initialize plugin", "generate adapter", "install for my IDE", "set up Antigravity", "add to Kiro", "configure Roo". Also trigger for any request to install, configure, or initialize Agentic Senior Core rules or adapter files for an AI coding tool.
5
5
  ---
6
6
 
7
7
  # ASC Adapter
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-add-feature
3
3
  description: >
4
- Structured brownfield workflow. Adapted from QRSPI to prevent context rot and ensure alignment before building. Use this skill when user asks to add new features, build new endpoints, extend existing functionality, implement new UI components, modify an existing codebase, or work on brownfield development.
4
+ Trigger this skill when the user says: "add a feature", "build this endpoint", "implement this", "add this component", "extend this", "integrate this", "wire up", "add support for", "create a new route", "add a new page". Also trigger for any non-trivial addition to an existing codebase — new endpoints, UI components, services, or integrations.
5
5
  ---
6
6
 
7
7
  # Add Feature Workflow
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-audit
3
3
  description: >
4
- Security and architecture audit. Deeper than review, focused on finding vulnerabilities and structural anti-patterns. Use this skill for deep security audits, architecture reviews, vulnerability scanning, threat modeling, finding OWASP risks (XSS, SQLi), penetration testing, or identifying structural anti-patterns.
4
+ Trigger this skill when the user says: "audit this", "security check", "find vulnerabilities", "is this secure", "check for XSS", "check for SQL injection", "threat model", "penetration test", "OWASP check", "architecture review". Also trigger for any deep security audit, vulnerability scanning, or request to find structural anti-patterns in existing code.
5
5
  ---
6
6
 
7
7
  # Audit Skill
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-debt
3
3
  description: >
4
- Track deferred enforcement violations. When an ASC ladder nudge fires and the shortcut is accepted rather than fixed, log it here for later resolution. Use this skill when user wants to log technical debt, track skipped rules, defer a fix, note a code smell for later, or manage deferred violations.
4
+ Trigger this skill when the user says: "log this debt", "skip this for now", "defer this fix", "note this smell", "track this violation", "add to debt ledger", "we'll fix this later", "accept the shortcut". Also trigger when an ASC ladder nudge fires and the user accepts the shortcut rather than fixing it — log the deferred violation for later resolution.
5
5
  ---
6
6
 
7
7
  # Debt Ledger
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-new-project
3
3
  description: >
4
- Structured greenfield workflow. Prevents building before alignment on what to build. Use this skill for greenfield projects, scaffolding new repositories, bootstrapping apps, starting from scratch, planning new system architectures, or creating a new project.
4
+ Trigger this skill when the user says: "new project", "start from scratch", "scaffold this", "bootstrap", "create a new app", "init a project", "set up a new repo", "greenfield", "plan the architecture", "design the system". Also trigger for any request to create a new codebase, plan a new system architecture, or scaffold a new repository.
5
5
  ---
6
6
 
7
7
  # New Project Workflow
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-refactor
3
3
  description: >
4
- Structured refactoring workflow. Preserves existing behavior while improving structure. Use this skill when user asks to refactor code, clean up code, improve code structure, rewrite legacy code, extract components, reduce technical debt, apply SOLID/DRY principles, or migrate codebases.
4
+ Trigger this skill when the user says: "refactor this", "clean up this code", "improve this structure", "rewrite this", "extract this into", "reduce duplication", "apply DRY", "apply SOLID", "migrate this", "simplify this module", "split this file", "decompose this". Also trigger for any request to restructure, modernize, or improve code organization without changing behavior.
5
5
  ---
6
6
 
7
7
  # Refactor Skill
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-reference
3
3
  description: >
4
- 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. Use this skill for guidance on writing unit tests, designing REST/GraphQL APIs, optimizing SQL queries, writing React/frontend components, setting up Docker/CI/CD infrastructure, or improving backend service resilience.
4
+ Trigger this skill when the user is working on: unit tests, integration tests, REST APIs, GraphQL APIs, SQL queries, database migrations, React components, frontend layouts, Docker configs, CI/CD pipelines, Kubernetes manifests, or service resilience (retries, circuit breakers, rate limiting). Also trigger when the user says: "how should I test this", "design this API", "optimize this query", "set up Docker", "add retry logic".
5
5
  ---
6
6
 
7
7
  # ASC Domain Reference
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: asc-review
3
3
  description: >
4
- Production-risk code review. Prioritize findings by severity. Use this skill when user asks to review a pull request, perform code review, check for production risks, critique code, analyze recent changes, or provide feedback on code quality.
4
+ Trigger this skill when the user says: "review this code", "check this PR", "what's wrong with this", "look at my changes", "critique this", "is this production-ready", "review my pull request", "find bugs", "check for issues". Also trigger for any request to evaluate code quality, analyze recent commits, or assess production risks in existing code.
5
5
  ---
6
6
 
7
7
  # Review Skill
@@ -35,6 +35,8 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
35
35
  - Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
36
36
  - Design for current requirements. Defer speculative extensions until evidence shows near-term need.
37
37
  - Delete code that carries no behavior, safety, or test value.
38
+ - When brevity and readability conflict, readability wins.
39
+ - Prefer named functions over closures/inline lambdas once logic exceeds a trivial expression.
38
40
 
39
41
  ## Architecture
40
42
 
@@ -42,6 +44,7 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
42
44
  - No custom crypto, state management, or routing when standard libraries exist.
43
45
  - Controllers handle protocol translation only. Business logic belongs in services.
44
46
  - Default to modular monolith unless scale evidence demands microservices.
47
+ - Match existing project structure before introducing new folders. No new top-level directory without clear necessity.
45
48
  - Direction changes require explicit user confirmation.
46
49
 
47
50
  ## Security (never skip)
@@ -65,6 +68,9 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
65
68
 
66
69
  ## Workflow
67
70
 
71
+ - Prefix ALL terminal commands with `ascx` to compress output and save tokens (e.g., `ascx <your_command>`).
72
+ - Never run `git commit`, `git push`, or `git push --force` unless the user explicitly requests it this turn.
73
+
68
74
  Recognize the scenario and offer the matching command — user decides
69
75
  whether to invoke it. Skip this for trivial edits.
70
76
 
@@ -80,3 +86,4 @@ Lead with what the developer needs to act: the command, file path, code change,
80
86
  Format: direct statement, then evidence. Example — "Add `--strict` to tsconfig. Without it, nullable checks in `UserService.ts:42` are silently skipped."
81
87
 
82
88
  Preserve: exact commands, file paths, line numbers, error messages, exit codes, validation status, assumptions, blockers, risks, and next actions.
89
+ - Before confirming a non-trivial plan, state at least one trade-off or alternative.
package/AGENTS.md CHANGED
@@ -30,6 +30,8 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
30
30
  - Scope changes to what the task requires. Features, refactors, and abstractions beyond scope need explicit user confirmation.
31
31
  - Design for current requirements. Defer speculative extensions until evidence shows near-term need.
32
32
  - Delete code that carries no behavior, safety, or test value.
33
+ - When brevity and readability conflict, readability wins.
34
+ - Prefer named functions over closures/inline lambdas once logic exceeds a trivial expression.
33
35
 
34
36
  ## Architecture
35
37
 
@@ -37,6 +39,7 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
37
39
  - No custom crypto, state management, or routing when standard libraries exist.
38
40
  - Controllers handle protocol translation only. Business logic belongs in services.
39
41
  - Default to modular monolith unless scale evidence demands microservices.
42
+ - Match existing project structure before introducing new folders. No new top-level directory without clear necessity.
40
43
  - Direction changes require explicit user confirmation.
41
44
 
42
45
  ## Security (never skip)
@@ -60,6 +63,9 @@ When you pick the minimal option at step 5 or 6, and it isn't obviously trivial:
60
63
 
61
64
  ## Workflow
62
65
 
66
+ - Prefix ALL terminal commands with `ascx` to compress output and save tokens (e.g., `ascx <your_command>`).
67
+ - Never run `git commit`, `git push`, or `git push --force` unless the user explicitly requests it this turn.
68
+
63
69
  Recognize the scenario and offer the matching command — user decides
64
70
  whether to invoke it. Skip this for trivial edits.
65
71
 
@@ -75,3 +81,4 @@ Lead with what the developer needs to act: the command, file path, code change,
75
81
  Format: direct statement, then evidence. Example — "Add `--strict` to tsconfig. Without it, nullable checks in `UserService.ts:42` are silently skipped."
76
82
 
77
83
  Preserve: exact commands, file paths, line numbers, error messages, exit codes, validation status, assumptions, blockers, risks, and next actions.
84
+ - Before confirming a non-trivial plan, state at least one trade-off or alternative.
package/README.md CHANGED
@@ -13,6 +13,15 @@
13
13
 
14
14
  </div>
15
15
 
16
+ ## Project Status
17
+
18
+ | Component | Status | Notes |
19
+ |-----------|--------|-------|
20
+ | Rules & Skills (Instructional Layer) | Stable | Universal across 23+ AI tools |
21
+ | Hooks (Enforcement Layer) | Stable | Claude Code, Antigravity IDE, Copilot CLI, Cursor |
22
+ | `ascx` (Output Compression) | Beta | 7 adapters (git, npm, tsc, rg); unsupported commands pass through safely |
23
+ | CLI (`asc adapter`, `asc global`) | Stable | Install adapters for any supported host |
24
+
16
25
  ## How Skills & Hooks Work (Multi-Tier Architecture)
17
26
 
18
27
  Agentic Senior Core operates on a two-tier architecture:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-senior-core",
3
- "version": "5.8.23",
3
+ "version": "5.8.25",
4
4
  "description": "Universal AI coding rules. Write code like a staff engineer.",
5
5
  "author": "fatidaprilian",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "5.8.23",
3
+ "version": "5.8.25",
4
4
  "type": "module",
5
5
  "description": "Agentic Senior Core: Universal AI coding rules and workflows. 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.8.23
2
+ version: 5.8.25
3
3
  description: Universal AI coding rules. Write code like a staff engineer.
4
4
  author: fatidaprilian
5
5
  provides_hooks: