deuk-agent-flow 4.0.19
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/CHANGELOG.ko.md +223 -0
- package/CHANGELOG.md +227 -0
- package/LICENSE +184 -0
- package/README.ko.md +282 -0
- package/README.md +270 -0
- package/bin/deuk-agent-flow.js +50 -0
- package/bin/deuk-agent-rule.js +2 -0
- package/core-rules/AGENTS.md +153 -0
- package/core-rules/GEMINI.md +7 -0
- package/docs/architecture.ko.md +34 -0
- package/docs/architecture.md +33 -0
- package/docs/assets/architecture-v3.png +0 -0
- package/docs/how-it-works.ko.md +52 -0
- package/docs/how-it-works.md +71 -0
- package/docs/principles.ko.md +68 -0
- package/docs/principles.md +68 -0
- package/docs/usage-guide.ko.md +212 -0
- package/package.json +96 -0
- package/scripts/cli-args.mjs +200 -0
- package/scripts/cli-init-commands.mjs +1799 -0
- package/scripts/cli-init-logic.mjs +64 -0
- package/scripts/cli-prompts.mjs +104 -0
- package/scripts/cli-rule-compiler.mjs +112 -0
- package/scripts/cli-skill-commands.mjs +201 -0
- package/scripts/cli-telemetry-commands.mjs +599 -0
- package/scripts/cli-ticket-commands.mjs +2393 -0
- package/scripts/cli-ticket-index.mjs +298 -0
- package/scripts/cli-ticket-migration.mjs +320 -0
- package/scripts/cli-ticket-parser.mjs +209 -0
- package/scripts/cli-usage-commands.mjs +326 -0
- package/scripts/cli-utils.mjs +587 -0
- package/scripts/cli.mjs +246 -0
- package/scripts/lint-md.mjs +267 -0
- package/scripts/lint-rules.mjs +186 -0
- package/scripts/merge-logic.mjs +44 -0
- package/scripts/plan-parser.mjs +53 -0
- package/scripts/publish-dual-npm.mjs +141 -0
- package/scripts/smoke-npm-docker.mjs +102 -0
- package/scripts/smoke-npm-local.mjs +109 -0
- package/scripts/update-download-badge.mjs +107 -0
- package/templates/MODULE_RULE_TEMPLATE.md +11 -0
- package/templates/PROJECT_RULE.md +47 -0
- package/templates/TICKET_TEMPLATE.ko.md +44 -0
- package/templates/TICKET_TEMPLATE.md +44 -0
- package/templates/project-pilot/CONFORMANCE_GATE_TEMPLATE.md +23 -0
- package/templates/project-pilot/DRIFT_CHECKLIST.md +19 -0
- package/templates/project-pilot/FLOW_CONTRACT_TEMPLATE.md +26 -0
- package/templates/project-pilot/IMPLEMENTATION_MATRIX_TEMPLATE.md +30 -0
- package/templates/project-pilot/INTEGRATION_CONTRACT_TEMPLATE.md +26 -0
- package/templates/project-pilot/OWNER_MAP_TEMPLATE.md +15 -0
- package/templates/project-pilot/PROJECT_PILOT_RULE_TEMPLATE.md +34 -0
- package/templates/project-pilot/REFACTOR_CONTRACT_TEMPLATE.md +32 -0
- package/templates/project-pilot/REMEDIATION_PLAN_TEMPLATE.md +33 -0
- package/templates/rules.d/deukcontext-mcp.md +31 -0
- package/templates/rules.d/platform-coexistence.md +29 -0
- package/templates/skills/context-recall/SKILL.md +25 -0
- package/templates/skills/generated-file-guard/SKILL.md +25 -0
- package/templates/skills/project-pilot/SKILL.md +63 -0
- package/templates/skills/safe-refactor/SKILL.md +25 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { mkdirSync, writeFileSync } from "fs";
|
|
3
|
+
import { dirname, join } from "path";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_PACKAGES = ["deuk-agent-flow", "deuk-agent-rule"];
|
|
6
|
+
const DEFAULT_RANGE = "last-month";
|
|
7
|
+
const DEFAULT_OUT = "docs/badges/npm-downloads.json";
|
|
8
|
+
const DEFAULT_CANONICAL_PACKAGE = "deuk-agent-flow";
|
|
9
|
+
|
|
10
|
+
function parseArgs(argv) {
|
|
11
|
+
const opts = {
|
|
12
|
+
packages: [...DEFAULT_PACKAGES],
|
|
13
|
+
range: DEFAULT_RANGE,
|
|
14
|
+
out: DEFAULT_OUT,
|
|
15
|
+
canonicalPackage: DEFAULT_CANONICAL_PACKAGE,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
19
|
+
const arg = argv[i];
|
|
20
|
+
if (arg === "--packages") {
|
|
21
|
+
opts.packages = argv[++i].split(",").map((name) => name.trim()).filter(Boolean);
|
|
22
|
+
} else if (arg === "--range") {
|
|
23
|
+
opts.range = argv[++i];
|
|
24
|
+
} else if (arg === "--out") {
|
|
25
|
+
opts.out = argv[++i];
|
|
26
|
+
} else if (arg === "--canonical") {
|
|
27
|
+
opts.canonicalPackage = argv[++i];
|
|
28
|
+
} else {
|
|
29
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (opts.packages.length === 0) {
|
|
34
|
+
throw new Error("--packages must include at least one npm package name");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return opts;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function fetchDownloads(packageName, range) {
|
|
41
|
+
const url = `https://api.npmjs.org/downloads/point/${encodeURIComponent(range)}/${encodeURIComponent(packageName)}`;
|
|
42
|
+
const res = await fetch(url);
|
|
43
|
+
|
|
44
|
+
if (res.status === 404) {
|
|
45
|
+
return { package: packageName, downloads: 0, missing: true };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!res.ok) {
|
|
49
|
+
throw new Error(`npm downloads request failed for ${packageName}: ${res.status} ${res.statusText}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const body = await res.json();
|
|
53
|
+
return {
|
|
54
|
+
package: packageName,
|
|
55
|
+
downloads: Number(body.downloads || 0),
|
|
56
|
+
missing: false,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function formatDownloads(value) {
|
|
61
|
+
return new Intl.NumberFormat("en", {
|
|
62
|
+
notation: "compact",
|
|
63
|
+
maximumFractionDigits: value >= 1000 ? 1 : 0,
|
|
64
|
+
}).format(value);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function buildDownloadsBadge(opts) {
|
|
68
|
+
const canonicalPackage = opts.canonicalPackage || opts.packages[0];
|
|
69
|
+
const packages = await Promise.all(opts.packages.map((name) => fetchDownloads(name, opts.range)));
|
|
70
|
+
const total = packages.reduce((sum, pkg) => sum + pkg.downloads, 0);
|
|
71
|
+
const canonical = packages.find((pkg) => pkg.package === canonicalPackage) || packages[0];
|
|
72
|
+
const aliases = packages.filter((pkg) => pkg.package !== canonical.package);
|
|
73
|
+
const aliasTotal = aliases.reduce((sum, pkg) => sum + pkg.downloads, 0);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
schemaVersion: 1,
|
|
77
|
+
label: `${canonical.package} downloads`,
|
|
78
|
+
message: `${formatDownloads(total)}/${opts.range}`,
|
|
79
|
+
color: "2f6fed",
|
|
80
|
+
namedLogo: "npm",
|
|
81
|
+
cacheSeconds: 86400,
|
|
82
|
+
total,
|
|
83
|
+
canonicalPackage: canonical.package,
|
|
84
|
+
canonicalDownloads: canonical.downloads,
|
|
85
|
+
aliasTotal,
|
|
86
|
+
range: opts.range,
|
|
87
|
+
packages,
|
|
88
|
+
aliases,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
93
|
+
const opts = parseArgs(argv);
|
|
94
|
+
const badge = await buildDownloadsBadge(opts);
|
|
95
|
+
const outPath = join(process.cwd(), opts.out);
|
|
96
|
+
|
|
97
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
98
|
+
writeFileSync(outPath, JSON.stringify(badge, null, 2) + "\n", "utf8");
|
|
99
|
+
console.log(`Wrote ${opts.out}: ${badge.message}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
103
|
+
main().catch((error) => {
|
|
104
|
+
console.error(error.message);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
architecture_docs: ""
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Project Rules
|
|
6
|
+
|
|
7
|
+
## Architecture Boundaries
|
|
8
|
+
|
|
9
|
+
> [!NOTE] **To AI Agents**
|
|
10
|
+
> If `architecture_docs` is empty and no rules are defined below,
|
|
11
|
+
> this project has no architecture rules yet.
|
|
12
|
+
> → Ask user to define them, or analyze codebase and propose a draft.
|
|
13
|
+
> → Do NOT make assumptions about project architecture.
|
|
14
|
+
|
|
15
|
+
### Module Ownership
|
|
16
|
+
<!-- Define which modules exist and who owns them -->
|
|
17
|
+
| Module | Owner | Editable |
|
|
18
|
+
|--------|-------|----------|
|
|
19
|
+
| `src/` | Core source | Yes |
|
|
20
|
+
|
|
21
|
+
### Dependency Direction
|
|
22
|
+
<!-- Define allowed dependency directions between modules -->
|
|
23
|
+
|
|
24
|
+
## DC-CODEGEN: Generated File Mapping
|
|
25
|
+
|
|
26
|
+
> [!IMPORTANT] **REQUIRED**
|
|
27
|
+
> Agents use this table to decide which files are safe to edit.
|
|
28
|
+
> Files not listed here → agent MUST ask user before editing.
|
|
29
|
+
|
|
30
|
+
| Generated (DO NOT EDIT) | Source (edit here) | Build command |
|
|
31
|
+
|-------------------------|-------------------|---------------|
|
|
32
|
+
| `dist/` | `src/` | `npm run build` |
|
|
33
|
+
|
|
34
|
+
## DC-* Guards (project-specific)
|
|
35
|
+
|
|
36
|
+
| Guard | Condition → Action |
|
|
37
|
+
|-------|-------------------|
|
|
38
|
+
| DC-HALT | Infrastructure error → stop, no bypass, report to user. |
|
|
39
|
+
| DC-INFRA | Bootstrap/transport/DB/routing code → separate ticket + approval. |
|
|
40
|
+
|
|
41
|
+
## Build & Test
|
|
42
|
+
|
|
43
|
+
| Action | Command |
|
|
44
|
+
|--------|---------|
|
|
45
|
+
| Build | `npm run build` |
|
|
46
|
+
| Test | `npm test` |
|
|
47
|
+
| Lint | `npx deuk-agent-flow lint:md` |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
<%- frontmatter %>
|
|
3
|
+
---
|
|
4
|
+
# <%= meta.title %>
|
|
5
|
+
|
|
6
|
+
## Agent Permission Contract (APC)
|
|
7
|
+
|
|
8
|
+
[BOUNDARY]
|
|
9
|
+
- 확인된 범위를 기준으로 정확한 수정 가능 모듈을 적습니다.
|
|
10
|
+
- 생성물, 무관한 공용 영역, 외부 루트처럼 건드리면 안 되는 범위를 적습니다.
|
|
11
|
+
- 이 범위를 지배하는 프로젝트 규칙과 코어 규칙을 적습니다.
|
|
12
|
+
|
|
13
|
+
[CONTRACT]
|
|
14
|
+
- 이 티켓이 의존하는 실제 입력, 근거, 아티팩트를 적습니다.
|
|
15
|
+
- 이 티켓이 만들어야 하는 실제 결과를 적습니다.
|
|
16
|
+
- 허용되는 부작용과 명시적으로 제외할 항목을 적습니다.
|
|
17
|
+
- 사용자가 명시적으로 요청한 경우가 아니면 테스트 작성/확장은 넣지 않습니다.
|
|
18
|
+
|
|
19
|
+
[PATCH PLAN]
|
|
20
|
+
- 확인된 로컬 맥락을 기준으로 정확한 구현 경로를 적습니다.
|
|
21
|
+
|
|
22
|
+
## Compact Plan
|
|
23
|
+
|
|
24
|
+
- 실제로 확인한 문제, 선택한 접근, 가장 작은 검증 대상을 적습니다.
|
|
25
|
+
|
|
26
|
+
## Problem Analysis
|
|
27
|
+
|
|
28
|
+
- 확인된 관측을 바탕으로 실제 불일치, 실패, 요청 내용을 적습니다.
|
|
29
|
+
|
|
30
|
+
## Source Observations
|
|
31
|
+
|
|
32
|
+
- 파일, 명령, diff, 문서, 이전 티켓 기록에서 확인한 실제 근거를 적습니다.
|
|
33
|
+
|
|
34
|
+
## Cause Hypotheses
|
|
35
|
+
|
|
36
|
+
- 현재 가장 유력한 설명과 아직 경쟁 중인 다른 가설을 적습니다.
|
|
37
|
+
|
|
38
|
+
## Improvement Direction
|
|
39
|
+
|
|
40
|
+
- 선택한 방향, 범위 경계, 이 경로를 택한 이유를 적습니다.
|
|
41
|
+
|
|
42
|
+
## Audit Evidence
|
|
43
|
+
|
|
44
|
+
- 승인 전과 실행 전까지 확인한 사실과 명령을 적습니다.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
<%- frontmatter %>
|
|
3
|
+
---
|
|
4
|
+
# <%= meta.title %>
|
|
5
|
+
|
|
6
|
+
## Agent Permission Contract (APC)
|
|
7
|
+
|
|
8
|
+
[BOUNDARY]
|
|
9
|
+
- Record the exact editable modules for this ticket using confirmed scope.
|
|
10
|
+
- Record forbidden/generated/unrelated areas that must stay untouched.
|
|
11
|
+
- Cite the governing project/core rule set that defines the boundary.
|
|
12
|
+
|
|
13
|
+
[CONTRACT]
|
|
14
|
+
- Record the concrete inputs, artifacts, or local evidence this ticket depends on.
|
|
15
|
+
- Record the concrete output expected from this ticket.
|
|
16
|
+
- Record allowed side effects and anything explicitly excluded.
|
|
17
|
+
- Do not include test creation or test expansion unless the user explicitly requested tests.
|
|
18
|
+
|
|
19
|
+
[PATCH PLAN]
|
|
20
|
+
- Record the exact implementation path for this ticket using confirmed local context.
|
|
21
|
+
|
|
22
|
+
## Compact Plan
|
|
23
|
+
|
|
24
|
+
- Record the concrete finding, chosen approach, and smallest verification target.
|
|
25
|
+
|
|
26
|
+
## Problem Analysis
|
|
27
|
+
|
|
28
|
+
- Record the actual mismatch, failure, or request using confirmed observations.
|
|
29
|
+
|
|
30
|
+
## Source Observations
|
|
31
|
+
|
|
32
|
+
- Record concrete local evidence from files, commands, diffs, docs, or prior ticket history.
|
|
33
|
+
|
|
34
|
+
## Cause Hypotheses
|
|
35
|
+
|
|
36
|
+
- Record the current best explanation and the alternatives still under consideration.
|
|
37
|
+
|
|
38
|
+
## Improvement Direction
|
|
39
|
+
|
|
40
|
+
- Record the chosen direction, scope boundaries, and why this path is being taken.
|
|
41
|
+
|
|
42
|
+
## Audit Evidence
|
|
43
|
+
|
|
44
|
+
- Record the confirmed facts and commands gathered before approval and execution.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Conformance Gate Template
|
|
2
|
+
|
|
3
|
+
## Pre-Implementation
|
|
4
|
+
|
|
5
|
+
- Implementation matrix exists:
|
|
6
|
+
- Refactor contract exists:
|
|
7
|
+
- Owner map exists:
|
|
8
|
+
- Drift checklist completed:
|
|
9
|
+
|
|
10
|
+
## Verification Commands
|
|
11
|
+
|
|
12
|
+
| Stage | Command | Expected Result | Actual Result |
|
|
13
|
+
| --- | --- | --- | --- |
|
|
14
|
+
| structure | | | |
|
|
15
|
+
| build/test | | | |
|
|
16
|
+
| runtime/report | | | |
|
|
17
|
+
|
|
18
|
+
## Exit Criteria
|
|
19
|
+
|
|
20
|
+
- Contract and implementation agree.
|
|
21
|
+
- Unsupported paths are explicit.
|
|
22
|
+
- Generated/runtime/report outputs match the intended owner path.
|
|
23
|
+
- Residual risks are recorded.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Drift Checklist
|
|
2
|
+
|
|
3
|
+
Mark each line before implementation.
|
|
4
|
+
|
|
5
|
+
- [ ] No silent fallback remains in the touched path.
|
|
6
|
+
- [ ] No alias-only path is being treated as a real contract.
|
|
7
|
+
- [ ] No no-op or placeholder path is being counted as support.
|
|
8
|
+
- [ ] No generated artifact is being edited directly.
|
|
9
|
+
- [ ] No single-language patch is being presented as a shared fix.
|
|
10
|
+
- [ ] No unsupported-by-contract path is being mislabeled as broken.
|
|
11
|
+
- [ ] No broken-entrypoint is being hidden as unsupported.
|
|
12
|
+
- [ ] Error behavior is explicit and testable.
|
|
13
|
+
- [ ] Verification covers the actual owner path.
|
|
14
|
+
|
|
15
|
+
## Known Exceptions
|
|
16
|
+
|
|
17
|
+
| Exception | Reason | Guard |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| | | |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Flow Contract Template
|
|
2
|
+
|
|
3
|
+
## Flow Identity
|
|
4
|
+
|
|
5
|
+
- Workflow or call path:
|
|
6
|
+
- Trigger:
|
|
7
|
+
- Expected owner:
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
| Step | Surface | Contract | Evidence |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| | | | |
|
|
14
|
+
|
|
15
|
+
## Flow Rules
|
|
16
|
+
|
|
17
|
+
- Required order:
|
|
18
|
+
- Required handoff:
|
|
19
|
+
- Forbidden shortcut:
|
|
20
|
+
- Verification point:
|
|
21
|
+
|
|
22
|
+
## Exceptions
|
|
23
|
+
|
|
24
|
+
| Exception | Scope | Required guard |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| | | |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Implementation Matrix Template
|
|
2
|
+
|
|
3
|
+
## Target
|
|
4
|
+
|
|
5
|
+
- Feature or contract family:
|
|
6
|
+
- Matrix axis A:
|
|
7
|
+
- Matrix axis B:
|
|
8
|
+
|
|
9
|
+
## Status Codes
|
|
10
|
+
|
|
11
|
+
| Code | Meaning |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `C` | complete |
|
|
14
|
+
| `P` | partial |
|
|
15
|
+
| `S` | stub |
|
|
16
|
+
| `B` | broken-entrypoint |
|
|
17
|
+
| `U` | unsupported-by-contract |
|
|
18
|
+
| `D` | documented exception |
|
|
19
|
+
|
|
20
|
+
## Matrix
|
|
21
|
+
|
|
22
|
+
| Axis A | Axis B | Status | Evidence | Owner | Action |
|
|
23
|
+
| --- | --- | --- | --- | --- | --- |
|
|
24
|
+
| | | | | | |
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
- Hidden shortcut candidates:
|
|
29
|
+
- Split candidates:
|
|
30
|
+
- Explicit unsupported paths:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Integration Contract Template
|
|
2
|
+
|
|
3
|
+
## Integration Identity
|
|
4
|
+
|
|
5
|
+
- Connected surfaces:
|
|
6
|
+
- Shared contract:
|
|
7
|
+
- Expected direction:
|
|
8
|
+
|
|
9
|
+
## Surface Rules
|
|
10
|
+
|
|
11
|
+
| Surface | Responsibility | Input | Output | Owner |
|
|
12
|
+
| --- | --- | --- | --- | --- |
|
|
13
|
+
| | | | | |
|
|
14
|
+
|
|
15
|
+
## Drift Risks
|
|
16
|
+
|
|
17
|
+
- Alias risk:
|
|
18
|
+
- Fallback risk:
|
|
19
|
+
- Generated/source mismatch risk:
|
|
20
|
+
- Report/test mismatch risk:
|
|
21
|
+
|
|
22
|
+
## Verification
|
|
23
|
+
|
|
24
|
+
- Minimum command:
|
|
25
|
+
- Expected proof:
|
|
26
|
+
- Residual risk:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Owner Map Template
|
|
2
|
+
|
|
3
|
+
| Symptom Surface | Source of Truth | Editable Here | Regeneration or Sync Command | Notes |
|
|
4
|
+
| --- | --- | --- | --- | --- |
|
|
5
|
+
| generated file | | yes/no | | |
|
|
6
|
+
| runtime implementation | | yes/no | | |
|
|
7
|
+
| report output | | yes/no | | |
|
|
8
|
+
| template | | yes/no | | |
|
|
9
|
+
| contract data | | yes/no | | |
|
|
10
|
+
|
|
11
|
+
## Owner Decision
|
|
12
|
+
|
|
13
|
+
- Primary owner:
|
|
14
|
+
- Secondary owner:
|
|
15
|
+
- Do-not-edit surfaces:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ProjectPilot Rule Template
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
- Product:
|
|
6
|
+
- Shared refactor contract:
|
|
7
|
+
- Generated/source/runtime boundaries:
|
|
8
|
+
|
|
9
|
+
## Mandatory Gates
|
|
10
|
+
|
|
11
|
+
1. Build an implementation matrix before cross-surface edits.
|
|
12
|
+
2. Classify `B`, `S`, `P`, `U`, and documented exceptions separately.
|
|
13
|
+
3. Identify the source owner before touching any generated or report artifact.
|
|
14
|
+
4. Define the conformance gate before implementation.
|
|
15
|
+
|
|
16
|
+
## Prohibited Shortcuts
|
|
17
|
+
|
|
18
|
+
- Silent fallback
|
|
19
|
+
- Alias-only compatibility patch
|
|
20
|
+
- No-op implementation presented as support
|
|
21
|
+
- Generated artifact direct edit
|
|
22
|
+
- Single-language patch presented as shared fix
|
|
23
|
+
|
|
24
|
+
## Required Evidence
|
|
25
|
+
|
|
26
|
+
- File and line references:
|
|
27
|
+
- Verification commands:
|
|
28
|
+
- Contract references:
|
|
29
|
+
|
|
30
|
+
## Project Exceptions
|
|
31
|
+
|
|
32
|
+
| Exception | Why allowed | Guard |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| | | |
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Refactor Contract Template
|
|
2
|
+
|
|
3
|
+
## Contract Identity
|
|
4
|
+
|
|
5
|
+
- Feature or protocol:
|
|
6
|
+
- Canonical entrypoint:
|
|
7
|
+
- Supported callers:
|
|
8
|
+
|
|
9
|
+
## Input Shape
|
|
10
|
+
|
|
11
|
+
- Required inputs:
|
|
12
|
+
- Optional inputs:
|
|
13
|
+
- Invalid inputs:
|
|
14
|
+
|
|
15
|
+
## Result Shape
|
|
16
|
+
|
|
17
|
+
- Success result:
|
|
18
|
+
- Error result:
|
|
19
|
+
- Unsupported result:
|
|
20
|
+
|
|
21
|
+
## Shared Guarantees
|
|
22
|
+
|
|
23
|
+
- Naming rule:
|
|
24
|
+
- Ownership rule:
|
|
25
|
+
- Fail-fast rule:
|
|
26
|
+
- Generated/runtime alignment rule:
|
|
27
|
+
|
|
28
|
+
## Exceptions
|
|
29
|
+
|
|
30
|
+
| Exception | Scope | Required evidence |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| | | |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Remediation Plan Template
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
- Parent ProjectPilot ticket:
|
|
6
|
+
- Target matrix row(s):
|
|
7
|
+
- Owner path:
|
|
8
|
+
|
|
9
|
+
## Defect Class
|
|
10
|
+
|
|
11
|
+
- `B` broken-entrypoint
|
|
12
|
+
- `S` stub
|
|
13
|
+
- `P` partial
|
|
14
|
+
- `U` unsupported-by-contract formalization
|
|
15
|
+
- `D` documented exception alignment
|
|
16
|
+
|
|
17
|
+
## Implementation Goal
|
|
18
|
+
|
|
19
|
+
- Exact symptom:
|
|
20
|
+
- Intended shared behavior:
|
|
21
|
+
- Non-goals:
|
|
22
|
+
|
|
23
|
+
## Required Evidence
|
|
24
|
+
|
|
25
|
+
- Matrix reference:
|
|
26
|
+
- Refactor contract reference:
|
|
27
|
+
- Owner map reference:
|
|
28
|
+
|
|
29
|
+
## Verification
|
|
30
|
+
|
|
31
|
+
- Minimum command:
|
|
32
|
+
- Expected proof:
|
|
33
|
+
- Residual risk:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: deukcontext-mcp
|
|
3
|
+
condition:
|
|
4
|
+
mcp: deuk-agent-context
|
|
5
|
+
inject_target: ["AGENTS.md", "GEMINI.md"]
|
|
6
|
+
---
|
|
7
|
+
## DeukContext RAG Protocol
|
|
8
|
+
|
|
9
|
+
### RAG Usage
|
|
10
|
+
- Start with local source-of-truth files: current source code, tests, project rules, and CLI ticket state.
|
|
11
|
+
- Use `mcp_deukcontext_search_*` when local evidence is insufficient, prior decisions may matter, the task crosses old tickets, or the user asks for historical/deep analysis.
|
|
12
|
+
- Use RAG as advisory memory. Current source code, tests, and ticket state remain the source of truth.
|
|
13
|
+
- Treat DeukAgentContext as an online-only memory layer. Do not rely on offline snapshots or local mirrors as the primary context source.
|
|
14
|
+
- Choose the narrowest MCP tool: `search_code` for symbols, `search_rules` for policy, `search_tickets` for prior outcomes, and `synthesize_knowledge` only for cross-collection questions.
|
|
15
|
+
- Search narrowly: include the concrete project plus symbol, file, command, rule id, or failure mode.
|
|
16
|
+
- Stop after 2 MCP calls for the same question. Do not broaden repeatedly.
|
|
17
|
+
- **Do NOT use RAG for Ticket Navigation.** Ticket lookup is a direct CLI operation, not a search task.
|
|
18
|
+
|
|
19
|
+
### RAG Quality Gate
|
|
20
|
+
- Treat placeholder summaries, duplicate ticket/report chunks, stale archive-only hits, unrelated projects, or summaries with no usable fact as a miss.
|
|
21
|
+
- When a result only says to read the file, read the current file locally before deciding.
|
|
22
|
+
- Prefer `search_code` for implementation questions and request evidence only when the extra context is likely to be useful.
|
|
23
|
+
- Record hit/weak-hit/miss/stale evidence in the ticket when it changes confidence, plan, or follow-up direction.
|
|
24
|
+
- For investigation, regression, quality, or root-cause tasks, write confirmed facts, hypotheses, improvement direction, and open questions into the active ticket before asking the user for clarification. Then point the user to the ticket instead of keeping the analysis only in chat.
|
|
25
|
+
|
|
26
|
+
### RAG Failure Handling
|
|
27
|
+
- **Error** (2+ failures): Switch to local search (`grep_search`/`view_file`). Do not retry in a loop.
|
|
28
|
+
- **Miss or weak hit** (`[RAG-MISS]`, placeholder, duplicate, stale): Fall back to local search. If local analysis finds reusable current-code knowledge, inject it once via `mcp_deukcontext_add_knowledge` with project, source path, code status, and applicability.
|
|
29
|
+
- **Stale indexed doc**: If an indexed document is wrong or incomplete, use `mcp_deukcontext_refresh_document` instead of adding a competing fragment.
|
|
30
|
+
- **Archive boundary**: Completed work should be preserved through ticket archive and knowledge distillation so the active context does not accumulate stale live-state references.
|
|
31
|
+
- **Docs vs knowledge**: `.deuk-agent/docs/` holds human-readable source artifacts (all plans and reports under `docs/plan`, archived originals in `docs/archive`). `.deuk-agent/knowledge/` holds only distilled machine-readable retrieval JSON generated from archived tickets/plans.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: platform-coexistence
|
|
3
|
+
inject_target: ["AGENTS.md"]
|
|
4
|
+
---
|
|
5
|
+
## Platform MCP Bridge
|
|
6
|
+
|
|
7
|
+
### MCP Configuration per Platform
|
|
8
|
+
|
|
9
|
+
Each platform uses a different MCP config file. Ensure `deuk-agent-context` is registered in the appropriate location:
|
|
10
|
+
|
|
11
|
+
| Platform | MCP Config Path | Registration |
|
|
12
|
+
|----------|----------------|--------------|
|
|
13
|
+
| Antigravity | `.mcp.json` (project root) | Auto-detected by IDE |
|
|
14
|
+
| Claude Code | `.mcp.json` (project root) | `claude mcp add --transport sse deuk-agent-context <url>` |
|
|
15
|
+
| Copilot | `.vscode/mcp.json` | VS Code settings or manual JSON edit |
|
|
16
|
+
| Codex | `.mcp.json` (project root) | Manual JSON edit |
|
|
17
|
+
| Cursor | `.cursor/mcp.json` | Cursor Settings > MCP |
|
|
18
|
+
|
|
19
|
+
### Artifact Path Self-Check
|
|
20
|
+
|
|
21
|
+
Before saving any artifact, verify the platform's native path is NOT the only copy:
|
|
22
|
+
|
|
23
|
+
| Platform Native Path | RAG-Indexed? | Action Required |
|
|
24
|
+
|---------------------|:------------:|-----------------|
|
|
25
|
+
| `brain/<conv>/` (Antigravity) | NO | Copy to `.deuk-agent/docs/` |
|
|
26
|
+
| `.cursor/plans/` (Cursor) | NO | Copy to `.deuk-agent/docs/plan/` |
|
|
27
|
+
| Terminal output (Claude/Codex) | NO | Save directly to `.deuk-agent/docs/` |
|
|
28
|
+
| VS Code diff (Copilot) | NO | Save plan text to `.deuk-agent/docs/plan/` |
|
|
29
|
+
| `.deuk-agent/docs/` | **YES** | ✓ Correct path |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-recall
|
|
3
|
+
summary: Reuse prior ticket and rule memory without turning RAG into the source of truth.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Recall
|
|
7
|
+
|
|
8
|
+
Authority: follow `core-rules/AGENTS.md`, the active ticket APC, Phase Gate, and `PROJECT_RULE.md`.
|
|
9
|
+
|
|
10
|
+
Use this skill when a task repeats a failure family, references prior decisions, asks why something happened, or crosses old tickets/rules.
|
|
11
|
+
|
|
12
|
+
## Micro-Protocol
|
|
13
|
+
|
|
14
|
+
1. Read current local source, project rules, and active ticket first.
|
|
15
|
+
2. Ask DeukAgentContext one narrow query naming the project, symbol, file, command, or failure mode.
|
|
16
|
+
3. Treat stale, duplicate, placeholder, or unrelated hits as weak evidence.
|
|
17
|
+
4. Put useful recall into the ticket as evidence, not chat narration.
|
|
18
|
+
5. If local analysis produces reusable current knowledge after a miss, add one knowledge record.
|
|
19
|
+
|
|
20
|
+
## Stop Conditions
|
|
21
|
+
|
|
22
|
+
- Two weak or stale recall attempts for the same question.
|
|
23
|
+
- RAG conflicts with current local source.
|
|
24
|
+
- Recall would expand scope beyond the active ticket.
|
|
25
|
+
- The remembered fix path bypasses current generated/source, parity, or verification rules.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generated-file-guard
|
|
3
|
+
summary: Prevent direct generated artifact edits and route changes to their source.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generated File Guard
|
|
7
|
+
|
|
8
|
+
Authority: follow `core-rules/AGENTS.md`, the active ticket APC, Phase Gate, and `PROJECT_RULE.md`.
|
|
9
|
+
|
|
10
|
+
Use this skill when a task mentions generated files, `dist`, `gen`, codegen, reports, benchmark outputs, or synchronized spokes.
|
|
11
|
+
|
|
12
|
+
## Micro-Protocol
|
|
13
|
+
|
|
14
|
+
1. Check `PROJECT_RULE.md` generated/source mapping.
|
|
15
|
+
2. Check target files for `@generated`, `DO NOT EDIT`, generated directories, or report artifact paths.
|
|
16
|
+
3. If the target is generated, identify the source file or generator command.
|
|
17
|
+
4. Prefer dry-run or `/tmp` output when probing generators.
|
|
18
|
+
5. Record the source-of-truth owner and verification command in the ticket before edits.
|
|
19
|
+
|
|
20
|
+
## Stop Conditions
|
|
21
|
+
|
|
22
|
+
- The source-of-truth file cannot be identified after bounded lookup.
|
|
23
|
+
- A broad regeneration would modify outputs outside ticket scope.
|
|
24
|
+
- The proposed fix hides, relabels, or narrows failing generated/report rows.
|
|
25
|
+
- The change would edit both generated output and source in the same patch.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-pilot
|
|
3
|
+
summary: Apply the ProjectPilot Refactor Contract Kit before cross-language, generated/runtime, or repeated-drift refactors.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ProjectPilot
|
|
7
|
+
|
|
8
|
+
Authority: follow `core-rules/AGENTS.md`, the active ticket APC, Phase Gate, and project rules.
|
|
9
|
+
|
|
10
|
+
Use this skill when the task involves any of the following:
|
|
11
|
+
|
|
12
|
+
- multi-language feature or behavior changes
|
|
13
|
+
- protocol, serialization, transport, codec, or table lane work
|
|
14
|
+
- generated/runtime/report contract drift
|
|
15
|
+
- fallback, alias, helper, no-op, placeholder, or silent stub cleanup
|
|
16
|
+
- convention, naming, file layout, factory surface, or lifecycle unification
|
|
17
|
+
- repeated failure families where one local fix would hide shared contract drift
|
|
18
|
+
|
|
19
|
+
## Micro-Protocol
|
|
20
|
+
|
|
21
|
+
1. Read local project rules and architecture constraints first.
|
|
22
|
+
2. Create or select the active ticket and record ProjectPilot scope before editing.
|
|
23
|
+
3. Define the refactor contract before proposing or making edits.
|
|
24
|
+
4. Build the implementation matrix across the relevant surfaces.
|
|
25
|
+
5. Classify drift as `C`, `P`, `S`, `B`, `U`, or `D`.
|
|
26
|
+
6. Identify source owners before touching source, generated, runtime, report, or template files.
|
|
27
|
+
7. Fill the drift checklist and reject shortcuts that hide drift.
|
|
28
|
+
8. Define the conformance gate in the ticket without creating tests unless the user requested tests.
|
|
29
|
+
9. Only then split remediation tickets or implement scoped changes.
|
|
30
|
+
|
|
31
|
+
## Required Outputs
|
|
32
|
+
|
|
33
|
+
- Implementation Matrix
|
|
34
|
+
- Refactor Contract
|
|
35
|
+
- Flow Contract
|
|
36
|
+
- Integration Contract
|
|
37
|
+
- Owner Map
|
|
38
|
+
- Drift Checklist
|
|
39
|
+
- Conformance Gate
|
|
40
|
+
- Remediation Plan
|
|
41
|
+
|
|
42
|
+
Use the shared ProjectPilot semantics and templates when available:
|
|
43
|
+
|
|
44
|
+
- `docs/PROJECT_PILOT.md`
|
|
45
|
+
- `templates/project-pilot/IMPLEMENTATION_MATRIX_TEMPLATE.md`
|
|
46
|
+
- `templates/project-pilot/REFACTOR_CONTRACT_TEMPLATE.md`
|
|
47
|
+
- `templates/project-pilot/FLOW_CONTRACT_TEMPLATE.md`
|
|
48
|
+
- `templates/project-pilot/INTEGRATION_CONTRACT_TEMPLATE.md`
|
|
49
|
+
- `templates/project-pilot/OWNER_MAP_TEMPLATE.md`
|
|
50
|
+
- `templates/project-pilot/DRIFT_CHECKLIST.md`
|
|
51
|
+
- `templates/project-pilot/CONFORMANCE_GATE_TEMPLATE.md`
|
|
52
|
+
- `templates/project-pilot/REMEDIATION_PLAN_TEMPLATE.md`
|
|
53
|
+
|
|
54
|
+
Consumer projects may keep only project-local pilot evidence and references. Shared ProjectPilot semantics and templates are owned by DeukAgentFlow.
|
|
55
|
+
|
|
56
|
+
## Stop Conditions
|
|
57
|
+
|
|
58
|
+
- No active ticket or no approval boundary for refactor-contract work.
|
|
59
|
+
- No implementation matrix or refactor contract can be stated clearly.
|
|
60
|
+
- Source-of-truth owner cannot be identified.
|
|
61
|
+
- A fix depends on generated direct edits or hidden fallback.
|
|
62
|
+
- Unsupported-by-contract and broken-entrypoint are not separated.
|
|
63
|
+
- Verification cannot prove the claimed alignment.
|