@ryuenn3123/agentic-senior-core 4.0.3 → 4.2.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/.agent-context/prompts/compact-natural-mode.md +100 -0
- package/.agent-context/prompts/init-project.md +1 -0
- package/.agent-context/prompts/refactor.md +1 -0
- package/.agent-context/review-checklists/pr-checklist.md +1 -0
- package/.agent-context/rules/api-docs.md +14 -0
- package/.agent-context/rules/api-versioning.md +93 -0
- package/.agent-context/rules/architecture.md +10 -0
- package/.agent-context/rules/background-jobs.md +93 -0
- package/.agent-context/rules/config-and-flags.md +79 -0
- package/.agent-context/rules/database-design.md +32 -0
- package/.agent-context/rules/frontend-architecture.md +35 -0
- package/.agent-context/rules/migrations.md +84 -0
- package/.agent-context/rules/naming-conv.md +6 -3
- package/.agent-context/rules/observability.md +69 -0
- package/.agent-context/rules/resilience.md +78 -0
- package/.agent-context/rules/security.md +28 -0
- package/AGENTS.md +13 -15
- package/README.md +102 -91
- package/benchmarks/README.md +40 -0
- package/benchmarks/compact-natural-mode/fixtures.mjs +359 -0
- package/benchmarks/compact-natural-mode/scorer.mjs +331 -0
- package/benchmarks/runtime-token-saver/fixtures.mjs +613 -0
- package/bin/agentic-senior-core.js +6 -0
- package/bin/ascx.js +23 -0
- package/lib/cli/adaptive-context/catalog.mjs +428 -0
- package/lib/cli/adaptive-context/file-signals.mjs +100 -0
- package/lib/cli/adaptive-context/implications.mjs +44 -0
- package/lib/cli/adaptive-context.mjs +365 -0
- package/lib/cli/ascx/adapters/git-diff.mjs +223 -0
- package/lib/cli/ascx/adapters/git-status.mjs +145 -0
- package/lib/cli/ascx/adapters/npm-test.mjs +120 -0
- package/lib/cli/ascx/fixture-evaluator.mjs +180 -0
- package/lib/cli/ascx/formatter.mjs +46 -0
- package/lib/cli/ascx/lexer.mjs +113 -0
- package/lib/cli/ascx/runtime.mjs +188 -0
- package/lib/cli/ascx/tee-writer.mjs +38 -0
- package/lib/cli/ascx/token-estimate.mjs +15 -0
- package/lib/cli/commands/context.mjs +140 -0
- package/lib/cli/commands/init.mjs +2 -1
- package/lib/cli/commands/optimize.mjs +143 -2
- package/lib/cli/commands/upgrade.mjs +2 -0
- package/lib/cli/compiler.mjs +9 -0
- package/lib/cli/token-optimization.mjs +161 -6
- package/lib/cli/utils.mjs +15 -1
- package/package.json +11 -5
- package/scripts/adaptive-context/fixtures.mjs +188 -0
- package/scripts/adaptive-context-benchmark.mjs +9 -0
- package/scripts/ascx-runtime-token-saver-benchmark.mjs +9 -0
- package/scripts/audit-cache-layer-contract.mjs +5 -0
- package/scripts/audit-caching-scope-hygiene.mjs +5 -0
- package/scripts/clean-local-artifacts.mjs +0 -1
- package/scripts/compact-natural-mode-benchmark.mjs +9 -0
- package/scripts/frontend-usability-audit.mjs +5 -8
- package/scripts/release-gate/static-checks.mjs +7 -7
- package/scripts/validate/config.mjs +1 -2
- package/scripts/validate/coverage-checks.mjs +1 -42
- package/scripts/validate.mjs +11 -7
- package/scripts/migrate-rule-format/id-prefix-table.mjs +0 -37
- package/scripts/migrate-rule-format/parse-legacy.mjs +0 -180
- package/scripts/migrate-rule-format/render-new.mjs +0 -169
- package/scripts/migrate-rule-format/roundtrip-validate.mjs +0 -89
- package/scripts/migrate-rule-format.mjs +0 -192
- package/scripts/v3-purge-audit.mjs +0 -236
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import fs from 'node:fs/promises';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { spawnSync } from 'node:child_process';
|
|
4
5
|
import { platform } from 'node:process';
|
|
5
6
|
|
|
7
|
+
import { REPOSITORY_ROOT } from './constants.mjs';
|
|
6
8
|
import { pathExists } from './utils.mjs';
|
|
7
9
|
|
|
8
10
|
export const TOKEN_OPTIMIZATION_STATE_FILE_NAME = 'token-optimization.json';
|
|
@@ -44,13 +46,13 @@ const COMMAND_REWRITE_MAPPINGS = [
|
|
|
44
46
|
},
|
|
45
47
|
{
|
|
46
48
|
rawCommand: 'git status',
|
|
47
|
-
optimizedCommand: '
|
|
48
|
-
reason: '
|
|
49
|
+
optimizedCommand: 'ascx git status',
|
|
50
|
+
reason: 'ASCX condenses status output while preserving changed-file evidence and raw tee safety.',
|
|
49
51
|
},
|
|
50
52
|
{
|
|
51
53
|
rawCommand: 'git diff',
|
|
52
|
-
optimizedCommand: '
|
|
53
|
-
reason: '
|
|
54
|
+
optimizedCommand: 'ascx git diff',
|
|
55
|
+
reason: 'ASCX preserves changed files, hunk anchors, binary/deleted markers, truncation notes, and raw tee safety.',
|
|
54
56
|
},
|
|
55
57
|
{
|
|
56
58
|
rawCommand: 'git log -n 10',
|
|
@@ -59,8 +61,8 @@ const COMMAND_REWRITE_MAPPINGS = [
|
|
|
59
61
|
},
|
|
60
62
|
{
|
|
61
63
|
rawCommand: 'npm test',
|
|
62
|
-
optimizedCommand: '
|
|
63
|
-
reason: '
|
|
64
|
+
optimizedCommand: 'ascx npm test',
|
|
65
|
+
reason: 'ASCX preserves exit code, failing tests, assertions, file paths, and raw tee safety.',
|
|
64
66
|
},
|
|
65
67
|
{
|
|
66
68
|
rawCommand: 'npm run build',
|
|
@@ -179,6 +181,157 @@ export function detectRtkBinary() {
|
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
|
|
184
|
+
export function detectAscxRuntime() {
|
|
185
|
+
const localBinPath = path.join(REPOSITORY_ROOT, 'bin', 'ascx.js');
|
|
186
|
+
const pathDetection = spawnSync('ascx', [], {
|
|
187
|
+
encoding: 'utf8',
|
|
188
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
189
|
+
});
|
|
190
|
+
const pathBinaryLooksAvailable = pathDetection.error == null
|
|
191
|
+
&& typeof pathDetection.status === 'number'
|
|
192
|
+
&& /command is required/i.test(`${pathDetection.stdout || ''}\n${pathDetection.stderr || ''}`);
|
|
193
|
+
|
|
194
|
+
if (pathBinaryLooksAvailable) {
|
|
195
|
+
return {
|
|
196
|
+
isAvailable: true,
|
|
197
|
+
source: 'path',
|
|
198
|
+
command: 'ascx',
|
|
199
|
+
localBinPath,
|
|
200
|
+
detectionError: null,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (existsSync(localBinPath)) {
|
|
205
|
+
return {
|
|
206
|
+
isAvailable: true,
|
|
207
|
+
source: 'package-bin',
|
|
208
|
+
command: `node ${localBinPath}`,
|
|
209
|
+
localBinPath,
|
|
210
|
+
detectionError: pathDetection.error ? pathDetection.error.message : null,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
isAvailable: false,
|
|
216
|
+
source: 'missing',
|
|
217
|
+
command: null,
|
|
218
|
+
localBinPath,
|
|
219
|
+
detectionError: pathDetection.error
|
|
220
|
+
? pathDetection.error.message
|
|
221
|
+
: (pathDetection.stderr || pathDetection.stdout || 'ascx binary was not detected').trim(),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export async function checkAscxTeeReadiness(targetDirectoryPath, options = {}) {
|
|
226
|
+
const shouldWriteProbe = options.writeProbe === true;
|
|
227
|
+
const stateDirectoryPath = path.join(targetDirectoryPath, '.agent-context', 'state');
|
|
228
|
+
const teeDirectoryPath = path.join(stateDirectoryPath, 'token-saver', 'tee');
|
|
229
|
+
|
|
230
|
+
try {
|
|
231
|
+
if (shouldWriteProbe) {
|
|
232
|
+
await fs.mkdir(teeDirectoryPath, { recursive: true });
|
|
233
|
+
const probeFilePath = path.join(teeDirectoryPath, `.ascx-probe-${process.pid}.tmp`);
|
|
234
|
+
await fs.writeFile(probeFilePath, 'ascx tee probe\n', 'utf8');
|
|
235
|
+
await fs.rm(probeFilePath, { force: true });
|
|
236
|
+
} else {
|
|
237
|
+
await fs.access(stateDirectoryPath);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
status: 'writable',
|
|
242
|
+
path: teeDirectoryPath,
|
|
243
|
+
error: null,
|
|
244
|
+
};
|
|
245
|
+
} catch (readinessError) {
|
|
246
|
+
return {
|
|
247
|
+
status: 'not-writable',
|
|
248
|
+
path: teeDirectoryPath,
|
|
249
|
+
error: readinessError instanceof Error ? readinessError.message : String(readinessError),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function resolveRuntimeTokenSaverMode({
|
|
255
|
+
tokenOptimizationState,
|
|
256
|
+
ascxDetection,
|
|
257
|
+
rtkDetection,
|
|
258
|
+
}) {
|
|
259
|
+
const stateEnabled = tokenOptimizationState?.enabled === true;
|
|
260
|
+
const rtkDetected = rtkDetection?.isAvailable === true;
|
|
261
|
+
|
|
262
|
+
if (stateEnabled && ascxDetection?.isAvailable && rtkDetected) {
|
|
263
|
+
return 'conflict-risk';
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (stateEnabled && ascxDetection?.isAvailable) {
|
|
267
|
+
return 'runtime-on';
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (stateEnabled) {
|
|
271
|
+
return 'policy-only';
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (rtkDetected) {
|
|
275
|
+
return 'external-runtime-detected';
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return 'runtime-off';
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export function buildRuntimeTokenSaverWarnings({
|
|
282
|
+
mode,
|
|
283
|
+
onboardingReport,
|
|
284
|
+
ascxDetection,
|
|
285
|
+
teeReadiness,
|
|
286
|
+
rtkDetection,
|
|
287
|
+
}) {
|
|
288
|
+
const warnings = [];
|
|
289
|
+
|
|
290
|
+
if (!onboardingReport) {
|
|
291
|
+
warnings.push('project is not initialized; run init before enabling runtime token saving');
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (!ascxDetection?.isAvailable) {
|
|
295
|
+
warnings.push('ascx binary is missing; supported commands will not be compressed');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (teeReadiness?.status !== 'writable') {
|
|
299
|
+
warnings.push('raw tee folder is not writable; failing commands may lose safety logs');
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (mode === 'conflict-risk') {
|
|
303
|
+
warnings.push('ASCX and an external runtime compressor both appear active; avoid double compression');
|
|
304
|
+
} else if (rtkDetection?.isAvailable) {
|
|
305
|
+
warnings.push('external runtime compressor detected; keep only one runtime compressor enabled by default');
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return warnings;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export function buildRuntimeTokenSaverNextAction({ mode, warnings }) {
|
|
312
|
+
if (warnings.some((warning) => warning.includes('not initialized'))) {
|
|
313
|
+
return 'Run agentic-senior-core init before enabling ASCX runtime saving.';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (warnings.some((warning) => warning.includes('tee folder'))) {
|
|
317
|
+
return 'Fix .agent-context/state write access, then rerun optimize doctor.';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (mode === 'conflict-risk') {
|
|
321
|
+
return 'Disable either ASCX runtime saving or the external compressor before using compressed command output.';
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (mode === 'runtime-on') {
|
|
325
|
+
return 'Use ascx git status, ascx git diff, and ascx npm test for supported high-volume command output.';
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (mode === 'policy-only') {
|
|
329
|
+
return 'Install or expose the ascx binary, then rerun optimize doctor.';
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return 'Run agentic-senior-core optimize install to enable ASCX guidance for this repository.';
|
|
333
|
+
}
|
|
334
|
+
|
|
182
335
|
export function buildRtkInstallHint() {
|
|
183
336
|
if (platform === 'win32') {
|
|
184
337
|
return 'Install the external token optimizer binary for Windows, extract it, and ensure the executable is on PATH.';
|
|
@@ -298,6 +451,7 @@ export function buildTokenOptimizationGuidanceBlock(tokenOptimizationState) {
|
|
|
298
451
|
);
|
|
299
452
|
|
|
300
453
|
const fallbackGuidance = [
|
|
454
|
+
'- Use ascx git status, ascx git diff, and ascx npm test when the ascx binary is available.',
|
|
301
455
|
'- Use command variants with bounded output such as git diff --stat, rg --max-count, and npm test -- --reporter=dot.',
|
|
302
456
|
'- Request only the lines or sections required for the current decision.',
|
|
303
457
|
'- If shell output is still large, summarize and continue iteratively instead of dumping full logs.',
|
|
@@ -319,6 +473,7 @@ export function buildTokenOptimizationGuidanceBlock(tokenOptimizationState) {
|
|
|
319
473
|
...rewriteLines,
|
|
320
474
|
'',
|
|
321
475
|
'Important scope note:',
|
|
476
|
+
'- ASCX wrappers are explicit local command wrappers, not provider gateways.',
|
|
322
477
|
'- Shell rewrite hooks affect shell tool calls only.',
|
|
323
478
|
'- Built-in read/grep/glob style tools may bypass shell rewrites, so explicit compact shell commands should be preferred in high-volume sessions.',
|
|
324
479
|
'',
|
package/lib/cli/utils.mjs
CHANGED
|
@@ -55,7 +55,13 @@ export function printUsage() {
|
|
|
55
55
|
console.log(' agentic-senior-core launch');
|
|
56
56
|
console.log(' agentic-senior-core init [target-directory] [--preset <name>] [--stack <name>] [--blueprint <name>] [--project-description <text>] [--ci <true|false>] [--token-optimize] [--no-token-optimize] [--token-agent <name>] [--memory-continuity] [--no-memory-continuity] [--scaffold-docs] [--no-scaffold-docs] [--docs-lang <en|id>] [--project-config <path>] [--runtime-env <auto|linux-wsl|linux|windows|macos>]');
|
|
57
57
|
console.log(' agentic-senior-core upgrade [target-directory] [--dry-run] [--yes] [--mcp-template] [--no-mcp-template] [--prune] [--no-prune]');
|
|
58
|
-
console.log(' agentic-senior-core optimize [target-directory] [--agent <copilot|claude|cursor|windsurf|gemini|codex|cline>] [--enable|--disable] [--show]');
|
|
58
|
+
console.log(' agentic-senior-core optimize [install|off|status|doctor] [target-directory] [--agent <copilot|claude|cursor|windsurf|gemini|codex|cline>] [--enable|--disable] [--show]');
|
|
59
|
+
console.log(' asc optimize status [target-directory]');
|
|
60
|
+
console.log(' asc optimize doctor [target-directory]');
|
|
61
|
+
console.log(' agentic-senior-core context "<request>" [--json] [--request-id <id>] [--file <path>] [--files <paths>]');
|
|
62
|
+
console.log(' ascx git status');
|
|
63
|
+
console.log(' ascx git diff');
|
|
64
|
+
console.log(' ascx npm test');
|
|
59
65
|
console.log(' agentic-senior-core mcp');
|
|
60
66
|
console.log(' agentic-senior-core rollback [target-directory]');
|
|
61
67
|
console.log(' agentic-senior-core audit:design-anti-repeat [target-directory] [--json] [--palette-advisory] [--threshold <number>]');
|
|
@@ -89,6 +95,14 @@ export function printUsage() {
|
|
|
89
95
|
console.log(' --enable Enable token optimization policy state');
|
|
90
96
|
console.log(' --disable Disable token optimization policy state');
|
|
91
97
|
console.log(' --show Print current token optimization state as JSON');
|
|
98
|
+
console.log(' status Show ASCX runtime token saver readiness');
|
|
99
|
+
console.log(' doctor Diagnose ASCX runtime token saver readiness and tee write safety');
|
|
100
|
+
console.log(' --json Print context manifest as JSON');
|
|
101
|
+
console.log(' --stdin Read context request text from stdin');
|
|
102
|
+
console.log(' --request-id Set the context manifest request id');
|
|
103
|
+
console.log(' --file Add a context file path signal for adaptive rule selection');
|
|
104
|
+
console.log(' --files Add comma-separated context file path signals');
|
|
105
|
+
console.log(' ascx Execute a supported command with evidence-preserving output compression');
|
|
92
106
|
}
|
|
93
107
|
|
|
94
108
|
/**
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryuenn3123/agentic-senior-core",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Change your AI Agent to code like a Staff Engineer, not a Junior.",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"asc": "bin/agentic-senior-core.js",
|
|
8
|
+
"agentic-senior-core": "bin/agentic-senior-core.js",
|
|
9
|
+
"ascx": "bin/ascx.js"
|
|
8
10
|
},
|
|
9
11
|
"files": [
|
|
10
12
|
"bin/",
|
|
13
|
+
"benchmarks/compact-natural-mode/",
|
|
14
|
+
"benchmarks/runtime-token-saver/",
|
|
11
15
|
"lib/",
|
|
12
16
|
"scripts/",
|
|
13
17
|
".agent-context/policies/",
|
|
@@ -63,7 +67,6 @@
|
|
|
63
67
|
"audit:release-bundle": "node ./scripts/audit-release-bundle.mjs",
|
|
64
68
|
"audit:file-size": "node ./scripts/audit-file-size.mjs",
|
|
65
69
|
"audit:rule-id-uniqueness": "node ./scripts/audit-rule-id-uniqueness.mjs",
|
|
66
|
-
"audit:v3-purge": "node ./scripts/v3-purge-audit.mjs",
|
|
67
70
|
"build:release-bundle": "node ./scripts/build-release-benchmark-bundle.mjs",
|
|
68
71
|
"sync:adapters": "node ./scripts/sync-thin-adapters.mjs",
|
|
69
72
|
"check:adapters": "node ./scripts/sync-thin-adapters.mjs --check",
|
|
@@ -72,6 +75,9 @@
|
|
|
72
75
|
"sbom:generate": "node ./scripts/generate-sbom.mjs",
|
|
73
76
|
"benchmark:detection": "node ./scripts/detection-benchmark.mjs",
|
|
74
77
|
"benchmark:token": "node ./scripts/token-optimization-benchmark.mjs",
|
|
78
|
+
"benchmark:adaptive-context": "node ./scripts/adaptive-context-benchmark.mjs",
|
|
79
|
+
"benchmark:ascx": "node ./scripts/ascx-runtime-token-saver-benchmark.mjs",
|
|
80
|
+
"benchmark:compact-natural": "node ./scripts/compact-natural-mode-benchmark.mjs",
|
|
75
81
|
"benchmark:bundle": "node ./scripts/benchmark-evidence-bundle.mjs",
|
|
76
82
|
"benchmark:writer-judge": "node ./scripts/benchmark-writer-judge-matrix.mjs",
|
|
77
83
|
"benchmark:gate": "node ./scripts/benchmark-gate.mjs",
|
|
@@ -84,7 +90,7 @@
|
|
|
84
90
|
"report:governance-weekly": "node ./scripts/governance-weekly-report.mjs",
|
|
85
91
|
"clean:local": "node ./scripts/clean-local-artifacts.mjs",
|
|
86
92
|
"validate": "node ./scripts/validate.mjs",
|
|
87
|
-
"test": "node --test ./tests/cli-smoke.test.mjs ./tests/mcp-server.test.mjs ./tests/llm-judge.test.mjs ./tests/ui-rubric-calibration.test.mjs ./tests/operations.test.mjs ./tests/knowledge-injection.test.mjs ./tests/
|
|
93
|
+
"test": "node --test ./tests/cli-smoke.test.mjs ./tests/mcp-server.test.mjs ./tests/llm-judge.test.mjs ./tests/ui-rubric-calibration.test.mjs ./tests/operations.test.mjs ./tests/knowledge-injection.test.mjs ./tests/audit-caching-scope-hygiene.test.mjs ./tests/research-dossier-migration.test.mjs ./tests/typography-palette-anti-repeat-audit.test.mjs ./tests/audit-design-anti-repeat-command.test.mjs ./tests/adaptive-context.test.mjs ./tests/ascx-runtime-token-saver.test.mjs ./tests/compact-natural-mode.test.mjs ./benchmarks/token-usage/lib/token-counter.test.mjs ./benchmarks/token-usage/lib/provider-cache-matrix.test.mjs ./benchmarks/token-usage/lib/cache-layer-contract.test.mjs ./benchmarks/token-usage/lib/cache-economics.test.mjs"
|
|
88
94
|
},
|
|
89
95
|
"devDependencies": {
|
|
90
96
|
"@anthropic-ai/sdk": "^0.96.0",
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
export const ADAPTIVE_CONTEXT_FIXTURES = [
|
|
2
|
+
{
|
|
3
|
+
id: 'auth-flow-review',
|
|
4
|
+
requestText: 'Review this login auth flow. Check JWT session handling, API response errors, and what tests should cover.',
|
|
5
|
+
requiredLabels: ['SEC', 'API', 'ERR', 'TEST'],
|
|
6
|
+
allowedLabels: ['SEC', 'API', 'ERR', 'TEST'],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: 'real-auth-refactor',
|
|
10
|
+
requestText: 'Tolong refactor auth flow ini, jangan ubah behavior, cek security dan test juga.',
|
|
11
|
+
requiredLabels: ['SEC', 'ARCH', 'TEST'],
|
|
12
|
+
allowedLabels: ['SEC', 'ARCH', 'TEST', 'ERR', 'API'],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'runtime-hardening',
|
|
16
|
+
requestText: 'Make adaptive context runtime stable. Fix missed implicit cases before moving to ASCX.',
|
|
17
|
+
requiredLabels: ['ARCH', 'TEST', 'ERR'],
|
|
18
|
+
allowedLabels: ['ARCH', 'TEST', 'ERR'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'natural-migration-broke',
|
|
22
|
+
requestText: 'Something broke after I pushed the migration yesterday.',
|
|
23
|
+
requiredLabels: ['MIG', 'ERR'],
|
|
24
|
+
allowedLabels: ['MIG', 'ERR'],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'natural-frontend-mobile-overlap',
|
|
28
|
+
requestText: 'This page flickers on mobile and the text overlaps.',
|
|
29
|
+
requiredLabels: ['FE'],
|
|
30
|
+
allowedLabels: ['FE'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'indonesian-access-leak',
|
|
34
|
+
requestText: 'Audit pembayaran ini, takut kebuka akses user lain.',
|
|
35
|
+
requiredLabels: ['SEC'],
|
|
36
|
+
allowedLabels: ['SEC'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'indonesian-readable-service',
|
|
40
|
+
requestText: 'Rapihin service ini biar namingnya enak dibaca.',
|
|
41
|
+
requiredLabels: ['ARCH', 'NAME'],
|
|
42
|
+
allowedLabels: ['ARCH', 'NAME'],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'natural-cron-silent',
|
|
46
|
+
requestText: 'My cron stops silently, need logs and retry.',
|
|
47
|
+
requiredLabels: ['JOB', 'ERR', 'OBS', 'RES'],
|
|
48
|
+
allowedLabels: ['JOB', 'ERR', 'OBS', 'RES'],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'auth-middleware-duplicate',
|
|
52
|
+
requestText: 'Remove duplicate code in auth middleware.',
|
|
53
|
+
requiredLabels: ['SEC', 'ARCH'],
|
|
54
|
+
allowedLabels: ['SEC', 'ARCH'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'indonesian-slow-query',
|
|
58
|
+
requestText: 'Bisa cek kenapa checkout lemot banget pas query order.',
|
|
59
|
+
requiredLabels: ['DATA', 'PERF'],
|
|
60
|
+
allowedLabels: ['DATA', 'PERF'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'config-exposing-key',
|
|
64
|
+
requestText: 'Update env var for staging without exposing key.',
|
|
65
|
+
requiredLabels: ['CFG', 'SEC'],
|
|
66
|
+
allowedLabels: ['CFG', 'SEC'],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'token-budget-context-hardening',
|
|
70
|
+
requestText: 'Tighten adaptive context token budget and benchmark reporting for real request corpus.',
|
|
71
|
+
requiredLabels: ['ARCH', 'TEST'],
|
|
72
|
+
allowedLabels: ['ARCH', 'TEST'],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'tenant-access-leak-indonesian',
|
|
76
|
+
requestText: 'Pas login, user bisa lihat data tenant sebelah.',
|
|
77
|
+
requiredLabels: ['SEC'],
|
|
78
|
+
allowedLabels: ['SEC'],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'invoice-worker-no-log',
|
|
82
|
+
requestText: 'Abis deploy, worker invoice ga jalan tapi ga ada error di log.',
|
|
83
|
+
requiredLabels: ['JOB', 'ERR', 'OBS'],
|
|
84
|
+
allowedLabels: ['JOB', 'ERR', 'OBS'],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'checkout-helper-naming',
|
|
88
|
+
requestText: 'Rapihin nama variabel di checkout helper, jangan bikin abstraction baru.',
|
|
89
|
+
requiredLabels: ['ARCH', 'NAME'],
|
|
90
|
+
allowedLabels: ['ARCH', 'NAME'],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'mobile-button-cut-off',
|
|
94
|
+
requestText: 'Button checkout kepotong di layar kecil.',
|
|
95
|
+
requiredLabels: ['FE'],
|
|
96
|
+
allowedLabels: ['FE'],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'production-migration-rollback',
|
|
100
|
+
requestText: 'Migration order sukses locally tapi production rollback.',
|
|
101
|
+
requiredLabels: ['MIG', 'ERR'],
|
|
102
|
+
allowedLabels: ['MIG', 'ERR'],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'cancel-order-idempotent-endpoint',
|
|
106
|
+
requestText: 'Buat endpoint cancel order idempotent dan documented.',
|
|
107
|
+
requiredLabels: ['API'],
|
|
108
|
+
allowedLabels: ['API'],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'production-env-secret-error',
|
|
112
|
+
requestText: 'Env production salah kebaca, jangan tampilin secret di error.',
|
|
113
|
+
requiredLabels: ['CFG', 'SEC', 'ERR'],
|
|
114
|
+
allowedLabels: ['CFG', 'SEC', 'ERR'],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'websocket-reconnect-timeout',
|
|
118
|
+
requestText: 'WebSocket reconnect sering timeout, perlu fallback.',
|
|
119
|
+
requiredLabels: ['RT', 'RES'],
|
|
120
|
+
allowedLabels: ['RT', 'RES'],
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: 'invoice-query-timeout-nplusone',
|
|
124
|
+
requestText: 'Query invoice timeout dan N+1.',
|
|
125
|
+
requiredLabels: ['DATA', 'PERF', 'RES'],
|
|
126
|
+
allowedLabels: ['DATA', 'PERF', 'RES'],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 'dependency-update-check',
|
|
130
|
+
requestText: 'Cek dependency package ini outdated atau perlu update.',
|
|
131
|
+
requiredLabels: ['DEP'],
|
|
132
|
+
allowedLabels: ['DEP'],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 'frontend-redesign',
|
|
136
|
+
requestText: 'Redesign this frontend screen from zero with responsive layout, motion, and UI design docs.',
|
|
137
|
+
requiredLabels: ['FE'],
|
|
138
|
+
allowedLabels: ['FE'],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'database-migration-failure',
|
|
142
|
+
requestText: 'The database migration fails during rollback after a schema change. Check query impact and validation coverage.',
|
|
143
|
+
requiredLabels: ['DATA', 'MIG', 'ERR', 'TEST'],
|
|
144
|
+
allowedLabels: ['DATA', 'MIG', 'ERR', 'TEST'],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: 'docker-env-setup',
|
|
148
|
+
requestText: 'Set up Docker Compose with env config and validation so the container can run locally.',
|
|
149
|
+
requiredLabels: ['DOCK', 'CFG', 'TEST'],
|
|
150
|
+
allowedLabels: ['DOCK', 'CFG', 'TEST'],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'worker-retry-observability',
|
|
154
|
+
requestText: 'Fix the queue worker retry flow. It publishes events, needs fallback behavior, and should log trace data.',
|
|
155
|
+
requiredLabels: ['JOB', 'EVT', 'RES', 'OBS', 'ERR'],
|
|
156
|
+
allowedLabels: ['JOB', 'EVT', 'RES', 'OBS', 'ERR'],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'service-refactor-clean-code',
|
|
160
|
+
requestText: 'Refactor this service module. Clean up helper names, avoid over-engineering, and keep tests readable.',
|
|
161
|
+
requiredLabels: ['ARCH', 'NAME', 'TEST'],
|
|
162
|
+
allowedLabels: ['ARCH', 'NAME', 'TEST'],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'versioned-api-endpoint',
|
|
166
|
+
requestText: 'Design a versioned API endpoint contract with safe request validation, error responses, and backward compatibility.',
|
|
167
|
+
requiredLabels: ['API', 'VER', 'ERR', 'SEC', 'TEST'],
|
|
168
|
+
allowedLabels: ['API', 'VER', 'ERR', 'SEC', 'TEST'],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'slow-query-performance',
|
|
172
|
+
requestText: 'The SQL query is slow and may be an N+1 issue. Add observability and a performance test.',
|
|
173
|
+
requiredLabels: ['PERF', 'DATA', 'OBS', 'TEST'],
|
|
174
|
+
allowedLabels: ['PERF', 'DATA', 'OBS', 'TEST'],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'config-secret-feature-flag',
|
|
178
|
+
requestText: 'Add a feature flag from env config without leaking secrets in errors.',
|
|
179
|
+
requiredLabels: ['CFG', 'SEC', 'ERR'],
|
|
180
|
+
allowedLabels: ['CFG', 'SEC', 'ERR'],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'realtime-stream-contract',
|
|
184
|
+
requestText: 'Plan a realtime WebSocket stream API with timeout recovery and monitoring.',
|
|
185
|
+
requiredLabels: ['RT', 'API', 'RES', 'OBS'],
|
|
186
|
+
allowedLabels: ['RT', 'API', 'RES', 'OBS'],
|
|
187
|
+
},
|
|
188
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { evaluateAdaptiveContextFixtures } from '../lib/cli/adaptive-context.mjs';
|
|
4
|
+
import { ADAPTIVE_CONTEXT_FIXTURES } from './adaptive-context/fixtures.mjs';
|
|
5
|
+
|
|
6
|
+
const report = evaluateAdaptiveContextFixtures(ADAPTIVE_CONTEXT_FIXTURES);
|
|
7
|
+
|
|
8
|
+
console.log(JSON.stringify(report, null, 2));
|
|
9
|
+
process.exit(report.passed ? 0 : 1);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { evaluateAscxFixtures } from '../lib/cli/ascx/fixture-evaluator.mjs';
|
|
4
|
+
import { ASCX_RUNTIME_TOKEN_SAVER_FIXTURES } from '../benchmarks/runtime-token-saver/fixtures.mjs';
|
|
5
|
+
|
|
6
|
+
const report = await evaluateAscxFixtures(ASCX_RUNTIME_TOKEN_SAVER_FIXTURES);
|
|
7
|
+
|
|
8
|
+
console.log(JSON.stringify(report, null, 2));
|
|
9
|
+
process.exit(report.passed ? 0 : 1);
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* Phase 2 cache-layer integrity gate. Validates provider cache metadata,
|
|
6
6
|
* fixture segmentation, and the emitted cache simulation JSON without calling
|
|
7
7
|
* provider APIs.
|
|
8
|
+
*
|
|
9
|
+
* Boundary: this audit covers the TECHNICAL contract (provider matrix,
|
|
10
|
+
* layer definitions, fixture segmentation, simulation result JSON shape).
|
|
11
|
+
* For public-prose hygiene around caching saving figures see
|
|
12
|
+
* audit-caching-scope-hygiene.mjs.
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
15
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* that each claim is integration-scoped per `docs/architecture/decisions-foundation.md`
|
|
10
10
|
* D4 "Per-Tool Caching Scope Matrix".
|
|
11
11
|
*
|
|
12
|
+
* Boundary: this audit covers PUBLIC-PROSE hygiene only (preventing
|
|
13
|
+
* universal "X% caching saving" claims that mix integration modes). For the
|
|
14
|
+
* technical provider/fixture/result-JSON contract see
|
|
15
|
+
* audit-cache-layer-contract.mjs.
|
|
16
|
+
*
|
|
12
17
|
* The rule: never publish a single universal "X% caching saving" figure that
|
|
13
18
|
* mixes integration modes. Every numerical caching saving claim on a public
|
|
14
19
|
* surface must either:
|
|
@@ -15,7 +15,6 @@ const LOCAL_ARTIFACT_PATHS = [
|
|
|
15
15
|
'.zed',
|
|
16
16
|
'.agentic-backup',
|
|
17
17
|
'.agent-context/state/active-memory.json',
|
|
18
|
-
'.agent-context/state/v3-purge-audit.json',
|
|
19
18
|
'.agent-context/state/llm-judge-report.json',
|
|
20
19
|
'.agent-context/state/benchmark-analysis.json',
|
|
21
20
|
'.agent-context/state/benchmark-evidence-bundle.json',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { COMPACT_NATURAL_MODE_FIXTURES } from '../benchmarks/compact-natural-mode/fixtures.mjs';
|
|
4
|
+
import { evaluateCompactNaturalFixtures } from '../benchmarks/compact-natural-mode/scorer.mjs';
|
|
5
|
+
|
|
6
|
+
const report = evaluateCompactNaturalFixtures(COMPACT_NATURAL_MODE_FIXTURES);
|
|
7
|
+
|
|
8
|
+
console.log(JSON.stringify(report, null, 2));
|
|
9
|
+
process.exit(report.passed ? 0 : 1);
|
|
@@ -17,9 +17,7 @@ const __dirname = dirname(__filename);
|
|
|
17
17
|
const REPOSITORY_ROOT = resolve(__dirname, '..');
|
|
18
18
|
|
|
19
19
|
const REQUIRED_FILES = [
|
|
20
|
-
'docs/
|
|
21
|
-
'docs/archive/v1.7-issue-breakdown.md',
|
|
22
|
-
'docs/archive/v1.7-execution-playbook.md',
|
|
20
|
+
'docs/archive/HISTORY.md',
|
|
23
21
|
'AGENTS.md',
|
|
24
22
|
'.agent-context/prompts/bootstrap-design.md',
|
|
25
23
|
'scripts/ui-design-judge.mjs',
|
|
@@ -32,11 +30,10 @@ const REQUIRED_FILES = [
|
|
|
32
30
|
'lib/cli/detector/design-evidence.mjs',
|
|
33
31
|
];
|
|
34
32
|
|
|
35
|
-
const
|
|
33
|
+
const REQUIRED_HISTORY_SNIPPETS = [
|
|
36
34
|
'V1.7',
|
|
37
35
|
'Frontend Product Experience',
|
|
38
|
-
'
|
|
39
|
-
'Delivered Scope',
|
|
36
|
+
'completed',
|
|
40
37
|
];
|
|
41
38
|
|
|
42
39
|
const REQUIRED_PR_CHECKLIST_SNIPPETS = [
|
|
@@ -174,7 +171,7 @@ function runAudit() {
|
|
|
174
171
|
assertFileExists(requiredFilePath, failures);
|
|
175
172
|
}
|
|
176
173
|
|
|
177
|
-
const roadmapPath = 'docs/
|
|
174
|
+
const roadmapPath = 'docs/archive/HISTORY.md';
|
|
178
175
|
const frontendRulePath = '.agent-context/rules/frontend-architecture.md';
|
|
179
176
|
const bootstrapDesignPromptPath = '.agent-context/prompts/bootstrap-design.md';
|
|
180
177
|
const instructionsPath = 'AGENTS.md';
|
|
@@ -185,7 +182,7 @@ function runAudit() {
|
|
|
185
182
|
|
|
186
183
|
if (existsSync(resolve(REPOSITORY_ROOT, roadmapPath))) {
|
|
187
184
|
const roadmapContent = readFileSync(resolve(REPOSITORY_ROOT, roadmapPath), 'utf8');
|
|
188
|
-
assertContains('
|
|
185
|
+
assertContains('Project history', roadmapPath, roadmapContent, REQUIRED_HISTORY_SNIPPETS, failures);
|
|
189
186
|
}
|
|
190
187
|
|
|
191
188
|
if (existsSync(resolve(REPOSITORY_ROOT, prChecklistPath))) {
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
export function runStaticReleaseChecks(results, diagnostics) {
|
|
24
24
|
const packageJsonPath = 'package.json';
|
|
25
25
|
const changelogPath = 'CHANGELOG.md';
|
|
26
|
-
const roadmapPath = 'docs/roadmap.md';
|
|
27
26
|
|
|
28
27
|
const packageJsonContent = readText(packageJsonPath);
|
|
29
28
|
if (!packageJsonContent) {
|
|
@@ -61,13 +60,14 @@ export function runStaticReleaseChecks(results, diagnostics) {
|
|
|
61
60
|
pushResult(results, true, 'changelog-version-entry', `Found release header for ${releaseVersion}`);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const historyPath = 'docs/archive/HISTORY.md';
|
|
64
|
+
const historyContent = readText(historyPath);
|
|
65
|
+
if (!historyContent) {
|
|
66
|
+
pushResult(results, false, 'history-exists', `Missing ${historyPath}`);
|
|
67
|
+
} else if (!historyContent.includes('V1.8')) {
|
|
68
|
+
pushResult(results, false, 'history-v18', 'Project history does not mention V1.8 release track');
|
|
69
69
|
} else {
|
|
70
|
-
pushResult(results, true, '
|
|
70
|
+
pushResult(results, true, 'history-v18', 'Project history includes V1.8 release track');
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
try {
|
|
@@ -15,6 +15,7 @@ export const FORMAL_ARTIFACT_PATHS = [
|
|
|
15
15
|
'docs/deep-analysis-and-roadmap-backlog.md',
|
|
16
16
|
'.agent-context/rules/api-docs.md',
|
|
17
17
|
'.agent-context/review-checklists/pr-checklist.md',
|
|
18
|
+
'.agent-context/prompts/compact-natural-mode.md',
|
|
18
19
|
'.agent-context/prompts/review-code.md',
|
|
19
20
|
'CLAUDE.md',
|
|
20
21
|
'GEMINI.md',
|
|
@@ -51,7 +52,6 @@ export const REQUIRED_HUMAN_WRITING_SNIPPETS = [
|
|
|
51
52
|
];
|
|
52
53
|
export const TERMINOLOGY_REFERENCE_PATHS = [
|
|
53
54
|
'README.md',
|
|
54
|
-
'docs/roadmap.md',
|
|
55
55
|
];
|
|
56
56
|
export const REQUIRED_TERMINOLOGY_ROW_PATTERNS = [
|
|
57
57
|
{
|
|
@@ -69,7 +69,6 @@ export const REQUIRED_TERMINOLOGY_ROW_PATTERNS = [
|
|
|
69
69
|
];
|
|
70
70
|
export const REQUIRED_TERMINOLOGY_RULE_SNIPPET =
|
|
71
71
|
'Rule: on first mention in developer-facing docs, include canonical term in parentheses.';
|
|
72
|
-
export const TERMINOLOGY_REFERENCE_DOCUMENT_PATH = 'docs/terminology-mapping.md';
|
|
73
72
|
export const REQUIRED_DEVELOPER_FIRST_MENTION_PATTERNS = [
|
|
74
73
|
{
|
|
75
74
|
path: 'README.md',
|