@massa-ai/claude-plugin 1.6.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/.claude-plugin/plugin.json +18 -0
- package/README.md +74 -0
- package/agents/massa-ai-architecture-specialist.md +65 -0
- package/agents/massa-ai-audit-specialist.md +81 -0
- package/agents/massa-ai-builder.md +67 -0
- package/agents/massa-ai-context-curator.md +67 -0
- package/agents/massa-ai-documentation-agent.md +65 -0
- package/agents/massa-ai-furps-analyst.md +71 -0
- package/agents/massa-ai-investigator.md +68 -0
- package/agents/massa-ai-mobile-specialist.md +82 -0
- package/agents/massa-ai-navigator.md +75 -0
- package/agents/massa-ai-plan-critic.md +90 -0
- package/agents/massa-ai-planner.md +65 -0
- package/agents/massa-ai-requirements-analyst.md +64 -0
- package/agents/massa-ai-reviewer.md +66 -0
- package/agents/massa-ai-test-engineer.md +66 -0
- package/agents/massa-ai-verification-agent.md +65 -0
- package/commands/def.md +17 -0
- package/commands/find.md +19 -0
- package/commands/graph.md +16 -0
- package/commands/index.md +19 -0
- package/commands/map.md +24 -0
- package/commands/status.md +15 -0
- package/hooks/README.md +52 -0
- package/hooks/_pin.sh +64 -0
- package/hooks/_post.sh +77 -0
- package/hooks/hooks.json +54 -0
- package/hooks/massa-ai-hook.ts +298 -0
- package/hooks/post-tool-use.sh +4 -0
- package/hooks/pre-compact.sh +70 -0
- package/hooks/session-start.sh +5 -0
- package/hooks/stop.sh +4 -0
- package/hooks/user-prompt-submit.sh +4 -0
- package/install.sh +435 -0
- package/package.json +32 -0
- package/skills/agents/architecture-specialist/SKILL.md +69 -0
- package/skills/agents/audit-specialist/SKILL.md +85 -0
- package/skills/agents/builder/SKILL.md +71 -0
- package/skills/agents/context-curator/SKILL.md +71 -0
- package/skills/agents/documentation-agent/SKILL.md +69 -0
- package/skills/agents/furps-analyst/SKILL.md +74 -0
- package/skills/agents/investigator/SKILL.md +72 -0
- package/skills/agents/mobile-specialist/SKILL.md +86 -0
- package/skills/agents/navigator/SKILL.md +79 -0
- package/skills/agents/plan-critic/SKILL.md +93 -0
- package/skills/agents/planner/SKILL.md +69 -0
- package/skills/agents/requirements-analyst/SKILL.md +68 -0
- package/skills/agents/reviewer/SKILL.md +70 -0
- package/skills/agents/test-engineer/SKILL.md +70 -0
- package/skills/agents/verification-agent/SKILL.md +69 -0
- package/skills/massa-ai/SKILL.md +315 -0
- package/skills/massa-ai/personas/README.md +35 -0
- package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
- package/skills/massa-ai/personas/catalog.json +157 -0
- package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
- package/skills/massa-ai/personas/product-manager.md +67 -0
- package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
- package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
- package/skills/massa-ai/references/adr-authoring.md +189 -0
- package/skills/massa-ai/references/agent-orchestration.md +221 -0
- package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
- package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
- package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
- package/skills/massa-ai/references/architecture-lenses.md +108 -0
- package/skills/massa-ai/references/audit-report-io.md +459 -0
- package/skills/massa-ai/references/audit-scope.md +103 -0
- package/skills/massa-ai/references/code-annotation.md +111 -0
- package/skills/massa-ai/references/codebase-investigation.md +96 -0
- package/skills/massa-ai/references/context-firewall.md +62 -0
- package/skills/massa-ai/references/conversation-feedback.md +104 -0
- package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
- package/skills/massa-ai/references/decision-engine.md +73 -0
- package/skills/massa-ai/references/evidence-gate.md +53 -0
- package/skills/massa-ai/references/furps/analyst-role.md +49 -0
- package/skills/massa-ai/references/furps/checklist.md +92 -0
- package/skills/massa-ai/references/furps/intake.md +104 -0
- package/skills/massa-ai/references/furps/report-contract.md +140 -0
- package/skills/massa-ai/references/hook-enforcement.md +137 -0
- package/skills/massa-ai/references/implementation-delivery.md +101 -0
- package/skills/massa-ai/references/installation.md +110 -0
- package/skills/massa-ai/references/lessons.md +119 -0
- package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
- package/skills/massa-ai/references/maestro/cli-device.md +65 -0
- package/skills/massa-ai/references/maestro/cloud.md +67 -0
- package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
- package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
- package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
- package/skills/massa-ai/references/maestro/mcp.md +59 -0
- package/skills/massa-ai/references/maestro/patterns.md +96 -0
- package/skills/massa-ai/references/maestro/selectors.md +91 -0
- package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
- package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
- package/skills/massa-ai/references/maestro.md +47 -0
- package/skills/massa-ai/references/mcp-tools.md +296 -0
- package/skills/massa-ai/references/memory-policy.md +103 -0
- package/skills/massa-ai/references/mobile-context.md +113 -0
- package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
- package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
- package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
- package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
- package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
- package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
- package/skills/massa-ai/references/naming-standards.md +47 -0
- package/skills/massa-ai/references/pr-task-fix.md +80 -0
- package/skills/massa-ai/references/project-context.md +76 -0
- package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
- package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
- package/skills/massa-ai/references/rfc/document-contract.md +85 -0
- package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
- package/skills/massa-ai/references/root-cause-scripts.md +97 -0
- package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
- package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
- package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
- package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
- package/skills/massa-ai/references/spec-driven/design.md +257 -0
- package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
- package/skills/massa-ai/references/spec-driven/execute.md +471 -0
- package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
- package/skills/massa-ai/references/spec-driven/memory.md +214 -0
- package/skills/massa-ai/references/spec-driven/specify.md +283 -0
- package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
- package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
- package/skills/massa-ai/references/spec-driven/validate.md +397 -0
- package/skills/massa-ai/references/subagent-design.md +132 -0
- package/skills/massa-ai/references/synapse-policy.md +160 -0
- package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
- package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
- package/skills/massa-ai/references/tdd/document-contract.md +136 -0
- package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
- package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
- package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
- package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
- package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
- package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
- package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
- package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
- package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
- package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
- package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
- package/skills/massa-ai/references/verification-ladder.md +62 -0
- package/skills/massa-ai/scripts/lessons.py +590 -0
- package/skills/massa-ai/workflows/adr.md +33 -0
- package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
- package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
- package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
- package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
- package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
- package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
- package/skills/massa-ai/workflows/commit.md +61 -0
- package/skills/massa-ai/workflows/debug.md +86 -0
- package/skills/massa-ai/workflows/design.md +54 -0
- package/skills/massa-ai/workflows/exploration.md +119 -0
- package/skills/massa-ai/workflows/feature.md +52 -0
- package/skills/massa-ai/workflows/general.md +46 -0
- package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
- package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
- package/skills/massa-ai/workflows/long-session.md +44 -0
- package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
- package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
- package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
- package/skills/massa-ai/workflows/onboarding.md +23 -0
- package/skills/massa-ai/workflows/refactor.md +47 -0
- package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
- package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
- package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
- package/skills/massa-ai/workflows/rfc.md +55 -0
- package/skills/massa-ai/workflows/security/security-audit.md +113 -0
- package/skills/massa-ai/workflows/security/security-fix.md +97 -0
- package/skills/massa-ai/workflows/spec-driven.md +217 -0
- package/skills/massa-ai/workflows/tdd.md +71 -0
- package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
- package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
- package/skills/massa-ai/workflows/the-fool.md +82 -0
- package/skills/massa-ai/workflows/ticket.md +42 -0
- package/skills/persona-router/SKILL.md +158 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# ADR Authoring
|
|
2
|
+
|
|
3
|
+
Use this reference from `workflows/adr.md`. It defines how massa-ai creates Architecture Decision Records without delegating orchestration to another ADR skill.
|
|
4
|
+
|
|
5
|
+
## Core Rule
|
|
6
|
+
|
|
7
|
+
An ADR records a significant architecture decision that is already made or being finalized. If the user is still choosing among options, route to `workflows/rfc.md`. If the user needs implementation design after the decision, route to `workflows/tdd.md`.
|
|
8
|
+
|
|
9
|
+
Route matrix:
|
|
10
|
+
|
|
11
|
+
| User state | Route |
|
|
12
|
+
|---|---|
|
|
13
|
+
| One architecture decision is selected and needs durable consequences recorded | ADR |
|
|
14
|
+
| Two or more options remain open, or stakeholders must review before choosing | RFC |
|
|
15
|
+
| Direction is selected and implementation architecture/contracts/rollout need a blueprint | TDD |
|
|
16
|
+
| Requirements, design, tasks, and execution all need staged approval | Spec-driven |
|
|
17
|
+
|
|
18
|
+
Source relevance requires the source to name at least one target, constraint, risk, dependency, public contract, rejected option, decision owner, or rollout/rollback consequence for this ADR. Sources that provide only style or adjacent context are examples, not facts.
|
|
19
|
+
|
|
20
|
+
Do not guess. Missing source facts become questions, source gaps, or a workflow route change.
|
|
21
|
+
|
|
22
|
+
## Source Order
|
|
23
|
+
|
|
24
|
+
Prefer sources in this order:
|
|
25
|
+
|
|
26
|
+
1. User prompt and explicitly provided Markdown files.
|
|
27
|
+
2. ADR template from Markdown or Atlassian MCP. If absent, ask fallback ADR format/status/supersession questions.
|
|
28
|
+
3. PRD from Markdown or Atlassian MCP when provided. If needed but absent, ask for missing context instead of inventing.
|
|
29
|
+
4. RFC from Markdown or Atlassian MCP when provided. If needed but absent, ask for missing context instead of inventing. If the user does not know, assume the decision is not made and route to `workflows/rfc.md`.
|
|
30
|
+
5. Complementary ADR from Markdown or Atlassian MCP when provided. Use it as factual context only for cross-stack constraints, contracts, dependencies, risks, and links.
|
|
31
|
+
6. Same-Stack Example ADR from Markdown or Atlassian MCP when provided. Use it only for format, structure, tone, naming, metadata, and placement conventions; do not use its decision context, rationale, constraints, consequences, or claims as facts for the new ADR.
|
|
32
|
+
7. UI/UX context from Figma MCP when provided and relevant. If Figma is absent, use PRD, RFC, or NotebookLM context. If none exists, ignore UI/UX.
|
|
33
|
+
8. NotebookLM when the user provides one or more notebook IDs. Query each relevant notebook separately, preserve source attribution by notebook ID, dedupe overlapping facts, and never assume or hard-code a default notebook ID.
|
|
34
|
+
9. `recall`, `search`, current repo docs, existing ADRs, and source code for corroboration.
|
|
35
|
+
|
|
36
|
+
Load `references/context-firewall.md` before bringing large Markdown, Atlassian, NotebookLM, Figma, broad research, or verbose source output into the main context. Bring back source pointers and compact facts, not raw dumps.
|
|
37
|
+
|
|
38
|
+
Load `references/mobile-context.md` only when the ADR context touches KMP, iOS, Android, native bridges, mobile lifecycle, offline sync, permissions, push/background behavior, local persistence, or backend-mobile contracts. Mobile is context-only here; do not add runtime mobile lazy-loading policy unless the user separately asks for that decision.
|
|
39
|
+
|
|
40
|
+
## Stack ADR Inputs
|
|
41
|
+
|
|
42
|
+
Classify optional ADR inputs before using them:
|
|
43
|
+
|
|
44
|
+
- `target-stack`: the stack of the ADR being created, such as mobile, backend, frontend, data, infrastructure, or platform.
|
|
45
|
+
- `complementary-stack`: another stack that integrates with the target stack, such as backend for a mobile ADR or mobile for a backend ADR.
|
|
46
|
+
- `same-stack example`: an ADR from the same stack as the target, provided as an example/base.
|
|
47
|
+
|
|
48
|
+
Use explicit user labels first. Infer stack role from source names, page titles, paths, or content only when obvious. Ask when ambiguity affects whether the ADR is complementary context or same-stack example.
|
|
49
|
+
|
|
50
|
+
Complementary ADR rules:
|
|
51
|
+
|
|
52
|
+
- Accept from Markdown files or Atlassian MCP.
|
|
53
|
+
- Use as real context only for cross-stack API contracts, schemas, auth flows, data ownership, compatibility constraints, rollout dependencies, operational risks, security boundaries, and links.
|
|
54
|
+
- Do not copy unrelated rationale or consequences from the complementary ADR into the new ADR.
|
|
55
|
+
|
|
56
|
+
Same-Stack Example ADR rules:
|
|
57
|
+
|
|
58
|
+
- Accept from Markdown files or Atlassian MCP.
|
|
59
|
+
- Use as style and structure guidance only: headings, metadata shape, status wording, numbering pattern, title style, tone, level of detail, and link formatting.
|
|
60
|
+
- The same-stack example context is not factual context for the new ADR.
|
|
61
|
+
- The example ADR facts must not be copied into context, rationale, constraints, consequences, links, or source confidence for the new ADR unless separately confirmed by another valid source.
|
|
62
|
+
|
|
63
|
+
## NotebookLM Inputs
|
|
64
|
+
|
|
65
|
+
Accept multiple NotebookLM notebook IDs when the user provides them. For each relevant notebook ID:
|
|
66
|
+
|
|
67
|
+
- Query the notebook separately for ADR-relevant facts.
|
|
68
|
+
- Preserve attribution by notebook ID in the source notes.
|
|
69
|
+
- Dedupe overlapping facts across notebooks without losing source coverage.
|
|
70
|
+
- Treat NotebookLM summaries as source-backed context only when the answer ties facts to notebook sources.
|
|
71
|
+
- Never hard-code a notebook ID or assume a default notebook.
|
|
72
|
+
|
|
73
|
+
If a notebook cannot be queried, state the failure and continue with available sources instead of inventing notebook facts.
|
|
74
|
+
|
|
75
|
+
## Source Confidence
|
|
76
|
+
|
|
77
|
+
Label each material claim before finalizing:
|
|
78
|
+
|
|
79
|
+
- `confirmed`: verified against current source, docs, ADRs, or MCP-backed context.
|
|
80
|
+
- `user-provided`: supplied directly by the user.
|
|
81
|
+
- `recalled`: recovered from massa-ai memory and not contradicted by current evidence.
|
|
82
|
+
- `inferred`: derived from evidence; state the inference and why it follows.
|
|
83
|
+
- `unresolved`: not sufficiently supported; ask or omit.
|
|
84
|
+
|
|
85
|
+
Do not include unresolved claims as ADR facts.
|
|
86
|
+
|
|
87
|
+
## Readiness Gate
|
|
88
|
+
|
|
89
|
+
Proceed only when all mandatory fields are source-backed or user-confirmed:
|
|
90
|
+
|
|
91
|
+
- Decision title: noun phrase, not a question.
|
|
92
|
+
- Decision date: use the user's date or current date when no other date is provided.
|
|
93
|
+
- Status: Accepted, Proposed, Deprecated, or Superseded.
|
|
94
|
+
- Context: forces, constraints, and situation that made the decision necessary.
|
|
95
|
+
- Decision: what was chosen and why this option wins.
|
|
96
|
+
- Consequences: positive and negative trade-offs.
|
|
97
|
+
- Supersession: whether this supersedes or is superseded by another ADR.
|
|
98
|
+
- Links: related ADRs, RFCs, PRDs, tickets, docs, Figma files, NotebookLM notes, or code references when available.
|
|
99
|
+
|
|
100
|
+
Recommended fields:
|
|
101
|
+
|
|
102
|
+
- Decision drivers.
|
|
103
|
+
- Options considered.
|
|
104
|
+
- Pros and cons per option.
|
|
105
|
+
- Outcome rationale tied to the drivers.
|
|
106
|
+
- Rollback, migration, or reversibility notes when decision risk warrants them.
|
|
107
|
+
|
|
108
|
+
Ask before drafting when a mandatory field is missing. If the user cannot confirm that a decision has been made, route to RFC.
|
|
109
|
+
|
|
110
|
+
## Fallback Questions
|
|
111
|
+
|
|
112
|
+
When no project template or sufficient context is provided, ask only for missing high-impact details. Use these ADR-authoring questions as the fallback set:
|
|
113
|
+
|
|
114
|
+
- What decision should this ADR record?
|
|
115
|
+
- Which format should be used: MADR, Nygard, or Y-Statement? Default to MADR for structured trade-offs.
|
|
116
|
+
- What is the status: Accepted, Proposed, Deprecated, or Superseded?
|
|
117
|
+
- Does this ADR supersede a previous decision? If yes, which ADR?
|
|
118
|
+
- What context, constraints, or product forces made the decision necessary?
|
|
119
|
+
- Which alternatives were seriously considered, and why were they rejected?
|
|
120
|
+
- What positive and negative consequences should future engineers know?
|
|
121
|
+
|
|
122
|
+
If the user provides a project ADR template, follow it instead of these fallback questions.
|
|
123
|
+
|
|
124
|
+
## Format Guidance
|
|
125
|
+
|
|
126
|
+
Use the project's existing ADR style first. If no template or prior convention exists:
|
|
127
|
+
|
|
128
|
+
- MADR: default for most decisions, especially when alternatives were compared.
|
|
129
|
+
- Nygard: use for small, obvious decisions that only need Context, Decision, and Consequences.
|
|
130
|
+
- Y-Statement: use for very compact inline records.
|
|
131
|
+
|
|
132
|
+
Preserve the user's language for section headers and content. Keep technical terms in English when that is the local convention.
|
|
133
|
+
|
|
134
|
+
## Numbering And Placement
|
|
135
|
+
|
|
136
|
+
Find the ADR directory before assigning a number. Check common locations in order:
|
|
137
|
+
|
|
138
|
+
1. `docs/adr/`
|
|
139
|
+
2. `docs/decisions/`
|
|
140
|
+
3. `adr/`
|
|
141
|
+
4. `.adr/`
|
|
142
|
+
|
|
143
|
+
Scan existing ADR filenames for the highest zero-padded number and assign the next number. Use `NNN-kebab-case-title.md`. If no directory exists, propose `docs/adr/001-kebab-case-title.md` unless the user or project docs specify a different location.
|
|
144
|
+
|
|
145
|
+
In Default mode, save the ADR when the user asked for execution. In Plan Mode, propose the path and content without writing.
|
|
146
|
+
|
|
147
|
+
## Output Targets
|
|
148
|
+
|
|
149
|
+
Default output is local Markdown in the project's standard ADR directory.
|
|
150
|
+
|
|
151
|
+
Confluence output:
|
|
152
|
+
|
|
153
|
+
- Use only when the user requests Confluence output.
|
|
154
|
+
- If the user provides a parent Confluence page link, write the generated ADR as a child page through Atlassian MCP.
|
|
155
|
+
- Include the resulting Confluence page link in completion evidence and ADR links when available.
|
|
156
|
+
- If the parent page link is missing, ask for the parent link or ask whether to write the ADR Markdown under `.adr/` instead.
|
|
157
|
+
- If Atlassian MCP is unavailable, state that Confluence writing is unavailable and ask whether to write a local `.adr/` Markdown file.
|
|
158
|
+
|
|
159
|
+
Local `.adr/` fallback:
|
|
160
|
+
|
|
161
|
+
- Use `.adr/` when the user chooses local fallback after missing Confluence parent context or unavailable Atlassian MCP, even if another standard ADR directory exists.
|
|
162
|
+
- Preserve the same ADR numbering and filename rules unless the project has a stronger convention.
|
|
163
|
+
- Do not silently switch from requested Confluence output to local files without user confirmation.
|
|
164
|
+
|
|
165
|
+
## Quality Checklist
|
|
166
|
+
|
|
167
|
+
Before finalizing:
|
|
168
|
+
|
|
169
|
+
- Title records the decision, not the question.
|
|
170
|
+
- Date and status are present.
|
|
171
|
+
- Context explains forces and constraints, not just the implementation outcome.
|
|
172
|
+
- Decision is direct and tied to source-backed rationale.
|
|
173
|
+
- Consequences include honest downsides.
|
|
174
|
+
- Alternatives include at least two real options when using MADR.
|
|
175
|
+
- Links and supersession relationships are included when applicable.
|
|
176
|
+
- File path and number match project convention.
|
|
177
|
+
- Every non-obvious claim has source confidence.
|
|
178
|
+
|
|
179
|
+
## Anti-Patterns
|
|
180
|
+
|
|
181
|
+
- Creating an ADR for an undecided proposal instead of routing to RFC.
|
|
182
|
+
- Writing implementation details that belong in a TDD.
|
|
183
|
+
- Editing the meaning of old ADRs instead of superseding them.
|
|
184
|
+
- Omitting "why not" rationale for rejected alternatives.
|
|
185
|
+
- Treating massa-ai memory as current truth without corroboration when accuracy matters.
|
|
186
|
+
- Fabricating PRD, RFC, UI/UX, Atlassian, Figma, or NotebookLM facts because a source was unavailable.
|
|
187
|
+
- Treating same-stack example ADR facts as context for the new ADR.
|
|
188
|
+
- Copying complementary ADR rationale outside cross-stack contracts, constraints, dependencies, risks, or links.
|
|
189
|
+
- Silently writing local `.adr/` Markdown when the user requested Confluence output.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Agent Orchestration
|
|
2
|
+
|
|
3
|
+
Use this reference when a workflow benefits from isolated context, parallel work, or independent verification.
|
|
4
|
+
|
|
5
|
+
Load `references/context-firewall.md` first when the delegated work may involve verbose logs, snapshots, generated reports, external research, or broad source inspection.
|
|
6
|
+
|
|
7
|
+
Load `references/subagent-design.md` only when designing or revising reusable subagent roles, adding a new role to this file, or turning repeated delegated work into a stable role charter. Do not load it for ordinary one-off delegation.
|
|
8
|
+
|
|
9
|
+
## Principle
|
|
10
|
+
|
|
11
|
+
The main agent is the orchestrator. It owns:
|
|
12
|
+
|
|
13
|
+
- workflow routing
|
|
14
|
+
- memory recall and persistence
|
|
15
|
+
- user questions and trade-off synthesis
|
|
16
|
+
- conversation feedback status updates
|
|
17
|
+
- final Evidence Gate
|
|
18
|
+
- final user-facing report
|
|
19
|
+
|
|
20
|
+
Subagents do bounded work only. Do not delegate everything.
|
|
21
|
+
|
|
22
|
+
## Delegation Gates
|
|
23
|
+
|
|
24
|
+
Delegate only when all base requirements are true and at least one dispatch trigger is true.
|
|
25
|
+
|
|
26
|
+
Base requirements:
|
|
27
|
+
|
|
28
|
+
- The task is isolated, concrete, and has a clear output contract.
|
|
29
|
+
- The subagent can make progress without full conversation history.
|
|
30
|
+
- The work is parallelizable, context-heavy, or useful as independent verification.
|
|
31
|
+
- The task has deterministic sensors or concrete artifact checks.
|
|
32
|
+
- The write set is disjoint from other active agents when edits are allowed.
|
|
33
|
+
|
|
34
|
+
Dispatch triggers:
|
|
35
|
+
|
|
36
|
+
- User explicitly asks for subagents, delegation, parallel agent work, or independent review.
|
|
37
|
+
- The scope has >=2 independent slices with disjoint write sets.
|
|
38
|
+
- The scope touches >10 files, >500 LOC, or >2 modules.
|
|
39
|
+
- A high/critical audit finding needs independent verification.
|
|
40
|
+
- Verbose context would exceed the context-firewall thresholds and can be summarized independently.
|
|
41
|
+
|
|
42
|
+
Keep local when any are true:
|
|
43
|
+
|
|
44
|
+
- The next main-agent step is blocked on the result.
|
|
45
|
+
- The task needs unresolved user intent.
|
|
46
|
+
- The work is tightly coupled across many files without a clear owner.
|
|
47
|
+
- The subagent would only duplicate main-agent thinking.
|
|
48
|
+
- Platform policy does not permit spawning an agent for this request.
|
|
49
|
+
|
|
50
|
+
## Plan Challenge Exception
|
|
51
|
+
|
|
52
|
+
Plan Challenge `plan-critic` is a standing policy exception to the normal dispatch triggers after a concrete plan exists. Always attempt a read-only `massa-ai-plan-critic` for both `depth: lite` and `depth: full` when subagent tooling is available and platform policy permits spawning. Normal base requirements still matter for packet quality: the critique must be bounded, read-only, and concrete, but it does not need to satisfy the ordinary dispatch triggers such as file count, module count, or explicit user delegation.
|
|
53
|
+
|
|
54
|
+
For all other roles, preserve the normal delegation gates above.
|
|
55
|
+
|
|
56
|
+
## Name Resolution
|
|
57
|
+
|
|
58
|
+
Charters live at `skills/agents/<role>/SKILL.md`. Hosts register every charter
|
|
59
|
+
under the prefixed name `massa-ai-<role>` (Claude, Codex, Cursor, OpenCode all
|
|
60
|
+
use that prefix; `scripts/generate-subagent-artifacts.ts` emits it).
|
|
61
|
+
|
|
62
|
+
- **Dispatch under the prefixed host name**, never the bare role name. A bare
|
|
63
|
+
`subagent_type` does not resolve on any supported host.
|
|
64
|
+
- The bare role name is the registry key: use it in memory tags, capability
|
|
65
|
+
packets, and prose.
|
|
66
|
+
- Every dispatch block in a workflow carries the prefixed name inline so
|
|
67
|
+
dispatch never depends on this file being loaded.
|
|
68
|
+
|
|
69
|
+
If the named agent is unavailable for any reason — not registered, plugin not
|
|
70
|
+
installed, spawning forbidden by platform policy, or the host returns an unknown
|
|
71
|
+
`subagent_type` — do not retry under another name and do not invent one. Run the
|
|
72
|
+
delegated scope locally against the same output contract, and report the skipped
|
|
73
|
+
delegation with its reason in the Evidence Gate.
|
|
74
|
+
|
|
75
|
+
## Roles
|
|
76
|
+
|
|
77
|
+
Use the role names in prompts and memory tags; use the host agent names to
|
|
78
|
+
dispatch.
|
|
79
|
+
|
|
80
|
+
Before adding a new reusable role, load `references/subagent-design.md` and write a bounded role charter. For one-off tasks, use an existing role plus the prompt contract below instead of inventing a new role.
|
|
81
|
+
|
|
82
|
+
| Role | Host agent name | Use For | Read/Write | Charter |
|
|
83
|
+
|---|---|---|---|---|
|
|
84
|
+
| `investigator` | `massa-ai-investigator` | Trace code paths, find entry points, summarize current behavior | read-only | `skills/agents/investigator/SKILL.md` |
|
|
85
|
+
| `navigator` | `massa-ai-navigator` | Answer "where is X / who calls Y" from the massa-ai index before reading files | read-only | `skills/agents/navigator/SKILL.md` |
|
|
86
|
+
| `implementer` → `builder` | `massa-ai-builder` | Execute one atomic task with a disjoint write set | write | `skills/agents/builder/SKILL.md` |
|
|
87
|
+
| `verifier` → `verification-agent` | `massa-ai-verification-agent` | Independently run sensors and inspect whether claims hold | read-only | `skills/agents/verification-agent/SKILL.md` |
|
|
88
|
+
| `domain-mapper` → `architecture-specialist` | `massa-ai-architecture-specialist` | Identify subdomains, bounded contexts, language conflicts, cohesion | read-only | `skills/agents/architecture-specialist/SKILL.md` (lens: `domain`) |
|
|
89
|
+
| `coupling-auditor` → `architecture-specialist` | `massa-ai-architecture-specialist` | Analyze strength, distance, volatility, and risky dependencies | read-only | `skills/agents/architecture-specialist/SKILL.md` (lens: `coupling`) |
|
|
90
|
+
| `deepening-architect` → `architecture-specialist` | `massa-ai-architecture-specialist` | Find shallow modules and deepening opportunities | read-only | `skills/agents/architecture-specialist/SKILL.md` (lens: `deepening`) |
|
|
91
|
+
| `audit-specialist` | `massa-ai-audit-specialist` | Findings-only audit through one selected `lens` | read-only | `skills/agents/audit-specialist/SKILL.md` |
|
|
92
|
+
| `plan-critic` | `massa-ai-plan-critic` | Stress-test a constructed plan using The Fool mode and return bounded critique | read-only | `skills/agents/plan-critic/SKILL.md` |
|
|
93
|
+
| `furps-analyst` | `massa-ai-furps-analyst` | Analyze one FURPS+ dimension of a PRD/ADR against the checklist and return structured findings | read-only | `skills/agents/furps-analyst/SKILL.md` |
|
|
94
|
+
|
|
95
|
+
The remaining charters — `planner`, `reviewer`, `context-curator`,
|
|
96
|
+
`requirements-analyst`, `test-engineer`, `documentation-agent`,
|
|
97
|
+
`mobile-specialist` — follow the same `massa-ai-<role>` convention and are
|
|
98
|
+
listed in the Agent Table of `skills/AGENTS.md`.
|
|
99
|
+
|
|
100
|
+
**Role mapping:** `investigator`→`investigator` (identical); `implementer`→`builder` (renamed); `verifier`→`verification-agent` (renamed, centralizes Verification Ladder); `domain-mapper`+`coupling-auditor`+`deepening-architect`→`architecture-specialist` (three roles folded into one specialist; the `lens` input field selects the sub-mode). Workflows dispatch the new agent names via named dispatch blocks; the old role names above are kept for traceability only.
|
|
101
|
+
|
|
102
|
+
## Capability Packet
|
|
103
|
+
|
|
104
|
+
When dispatching a subagent, send a compact capability packet rather than a loose instruction. Include:
|
|
105
|
+
|
|
106
|
+
- role and purpose for this workflow
|
|
107
|
+
- trigger: why delegation is justified now
|
|
108
|
+
- exact scope: files, modules, diff, report finding, task IDs, or artifact
|
|
109
|
+
- permissions: read-only or write with disjoint ownership
|
|
110
|
+
- inputs: recalled facts, source pointers, constraints, and exclusions
|
|
111
|
+
- sensors: expected commands or concrete checks
|
|
112
|
+
- output: the exact output contract
|
|
113
|
+
- firewall: raw logs, diffs, snapshots, reports, or research that must be summarized
|
|
114
|
+
- memory boundary: whether the subagent may suggest memories and who persists them
|
|
115
|
+
- exact next step: what the main agent should do with the result
|
|
116
|
+
|
|
117
|
+
## Prompt Contract
|
|
118
|
+
|
|
119
|
+
Every delegated task must include:
|
|
120
|
+
|
|
121
|
+
- exact `projectId`
|
|
122
|
+
- exact parent `workflowSessionId` or child session tag
|
|
123
|
+
- workflow name
|
|
124
|
+
- role name
|
|
125
|
+
- scope and file/module ownership
|
|
126
|
+
- facts already known
|
|
127
|
+
- what to avoid redoing
|
|
128
|
+
- allowed tools or mutation level
|
|
129
|
+
- deterministic validation expected
|
|
130
|
+
- context-firewall limit: what raw output must not be returned
|
|
131
|
+
- skipped-check policy and how to report unavailable sensors
|
|
132
|
+
- memory boundary: whether to suggest memories only or write none
|
|
133
|
+
- exact output format
|
|
134
|
+
|
|
135
|
+
## Output Contract
|
|
136
|
+
|
|
137
|
+
Every subagent returns:
|
|
138
|
+
|
|
139
|
+
- Status: `Complete`, `Blocked`, or `Partial`
|
|
140
|
+
- Scope checked or files changed
|
|
141
|
+
- Evidence: command result, static finding, source location, or artifact inspected
|
|
142
|
+
- Findings or implementation summary
|
|
143
|
+
- Risks and skipped checks
|
|
144
|
+
- Exact next step
|
|
145
|
+
|
|
146
|
+
Subagents must summarize verbose research, logs, snapshots, diffs, search output,
|
|
147
|
+
and transcripts. The main agent should receive only evidence, findings, risk,
|
|
148
|
+
skipped checks, memory suggestions when allowed, and the next step, not raw dumps.
|
|
149
|
+
|
|
150
|
+
## Conversation Feedback
|
|
151
|
+
|
|
152
|
+
Use `references/conversation-feedback.md` when subagent lifecycle visibility would help the user understand what is running. Keep status updates to 1-2 human-readable lines.
|
|
153
|
+
|
|
154
|
+
Use these labels for delegated work:
|
|
155
|
+
|
|
156
|
+
- `Agent Started` when a role is launched with scope and permission mode.
|
|
157
|
+
- `Agent Running` when waiting on a long-running role or reporting its current bounded task.
|
|
158
|
+
- `Agent Done` when the role returns usable evidence, findings, implementation, or verification.
|
|
159
|
+
- `Agent Blocked` when the role cannot complete its assigned scope.
|
|
160
|
+
|
|
161
|
+
Do not expose raw subagent prompts, raw logs, private reasoning, or full output dumps in feedback lines.
|
|
162
|
+
|
|
163
|
+
Example:
|
|
164
|
+
|
|
165
|
+
```md
|
|
166
|
+
🤖 [Agent Started] Verifier is checking the docs-only change set. Scope: massa-ai references and README.
|
|
167
|
+
🤖 [Agent Done] Verifier found no stale references. Skipped checks: none.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Plan-Critic Contract
|
|
171
|
+
|
|
172
|
+
Dispatch `massa-ai-plan-critic` only after a concrete plan exists. Dispatch it with the capability packet above and the standard output contract. The subagent receives the plan, scope, constraints, compact recalled facts/evidence, selected depth, selected The Fool mode only for full gates, known risks, verification recipe, parent identifiers, and context-firewall limits. It never receives full conversation context.
|
|
173
|
+
|
|
174
|
+
For `depth: lite`, the packet uses the low-risk checklist and does not include The Fool mode references. It returns:
|
|
175
|
+
|
|
176
|
+
- strongest low-risk challenges
|
|
177
|
+
- assumption most likely to fail
|
|
178
|
+
- deterministic check that would falsify success
|
|
179
|
+
- high-risk or broad-scope trigger found, if any
|
|
180
|
+
- `escalate_to_full: true|false`
|
|
181
|
+
- escalation reason
|
|
182
|
+
|
|
183
|
+
For `depth: full`, or after lite escalation, the main agent selects the mode, loads the relevant The Fool references, and dispatches a full packet. It returns:
|
|
184
|
+
|
|
185
|
+
- selected mode
|
|
186
|
+
- steelmanned thesis
|
|
187
|
+
- 3-5 strongest challenges
|
|
188
|
+
- severity: `critical`, `high`, `medium`, or `low`
|
|
189
|
+
- affected plan section
|
|
190
|
+
- evidence gap or assumption at risk
|
|
191
|
+
- required revision or accepted-risk framing
|
|
192
|
+
- confidence impact
|
|
193
|
+
- exact next step
|
|
194
|
+
|
|
195
|
+
The main agent owns final synthesis and applies the canonical Plan Challenge
|
|
196
|
+
Policy: the `<!-- massa-ai:bootstrap -->` block installed as `<host>/AGENTS.md`,
|
|
197
|
+
whose single source is `skills/AGENTS.md` in the product repo.
|
|
198
|
+
|
|
199
|
+
## Memory Rules
|
|
200
|
+
|
|
201
|
+
- Main agent persists durable conclusions after synthesis.
|
|
202
|
+
- Subagents may suggest memory content but should not create broad project memories unless explicitly assigned.
|
|
203
|
+
- Use tags such as `agent:verifier` or `agent:domain-mapper` only when they improve retrieval.
|
|
204
|
+
- Do not persist one-off subagent chatter.
|
|
205
|
+
|
|
206
|
+
## Synapse Isolation
|
|
207
|
+
|
|
208
|
+
For delegated tasks that expect repeated searches:
|
|
209
|
+
|
|
210
|
+
- create one ephemeral Synapse session per subagent
|
|
211
|
+
- pass only that agent's `synapseSessionId` to its `search` calls
|
|
212
|
+
- keep parent/child `workflowSessionId` values in memory tags and output packets
|
|
213
|
+
- never share one Synapse session across concurrent agents
|
|
214
|
+
- allow stateless fallback when session creation or adapter translation fails
|
|
215
|
+
|
|
216
|
+
## Guardrails
|
|
217
|
+
|
|
218
|
+
- No self-evaluation: claims need deterministic sensors or concrete source evidence.
|
|
219
|
+
- No hidden scope expansion: subagents must not improve adjacent code.
|
|
220
|
+
- No context dragging: send only task-specific source pointers and constraints, and receive compact summaries only.
|
|
221
|
+
- No conflicting writes: parallel implementers need disjoint files or worktrees.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Architecture Coupling Lens
|
|
2
|
+
|
|
3
|
+
Use this detail reference when an architecture audit or execution task needs dependency health, dependency direction, integration cost, or coupling reduction.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- Core Model
|
|
8
|
+
- Dependency Graph
|
|
9
|
+
- Strength Levels
|
|
10
|
+
- Symmetric Coupling
|
|
11
|
+
- Connascence Ladder
|
|
12
|
+
- Distance Levels
|
|
13
|
+
- Volatility Signals
|
|
14
|
+
- Balance Table
|
|
15
|
+
- Quantitative Anchors
|
|
16
|
+
- Pattern Strength Action Lookup
|
|
17
|
+
- Static Leads
|
|
18
|
+
- Positive Patterns
|
|
19
|
+
- Fix Direction
|
|
20
|
+
|
|
21
|
+
## Core Model
|
|
22
|
+
|
|
23
|
+
Analyze coupling through three dimensions:
|
|
24
|
+
|
|
25
|
+
- Strength: what knowledge or behavior is shared
|
|
26
|
+
- Distance: how far apart the coupled modules are
|
|
27
|
+
- Volatility: how likely either side is to change
|
|
28
|
+
|
|
29
|
+
High strength is not automatically bad. Strong coupling can be cohesive when modules are close and change together. Risk rises when strong coupling crosses distance and volatile business behavior.
|
|
30
|
+
|
|
31
|
+
## Dependency Graph
|
|
32
|
+
|
|
33
|
+
Map directed dependencies:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
A -> B means A depends on B.
|
|
37
|
+
B is upstream and exposes knowledge to A.
|
|
38
|
+
A is downstream and absorbs upstream changes.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For each relevant edge, record:
|
|
42
|
+
|
|
43
|
+
- caller/downstream module
|
|
44
|
+
- callee/upstream module
|
|
45
|
+
- dependency kind: import, DI, HTTP/gRPC, queue/event, shared DB, generated client, shared schema, test fixture
|
|
46
|
+
- exported surface or contract used
|
|
47
|
+
- whether the dependency crosses package, bounded context, service, team, or external-system distance
|
|
48
|
+
|
|
49
|
+
## Strength Levels
|
|
50
|
+
|
|
51
|
+
Classify by strongest evidence:
|
|
52
|
+
|
|
53
|
+
- Intrusive: downstream reads internals not designed for integration, such as private fields, another service DB, internal config/file shape, reflection, monkey patching, or undocumented generated artifacts.
|
|
54
|
+
- Functional: modules must coordinate behavior, order, transaction, duplicated business rule, deployment, or state transitions.
|
|
55
|
+
- Model: upstream exposes internal domain model, enum meanings, field names, value semantics, tuple positions, or persistence schema as integration surface.
|
|
56
|
+
- Contract: upstream exposes integration-specific DTO, event, schema, facade, published language, or versioned protocol that hides internals.
|
|
57
|
+
|
|
58
|
+
### Symmetric Coupling
|
|
59
|
+
|
|
60
|
+
A sub-degree of Functional coupling with no import edge: two modules
|
|
61
|
+
independently encode the same business rule, so changing the rule requires
|
|
62
|
+
editing both. It is the defect static import analysis most often misses.
|
|
63
|
+
|
|
64
|
+
Detection signals:
|
|
65
|
+
|
|
66
|
+
- the same predicate, threshold, mapping, or validation duplicated across modules
|
|
67
|
+
- comments like "update X when changing Y" or "keep in sync with"
|
|
68
|
+
- two validators, formatters, or mappers that must agree but share no type
|
|
69
|
+
- a bug fixed in one place that later recurs in the other
|
|
70
|
+
|
|
71
|
+
Treat as Functional strength regardless of distance. The fix is to extract the
|
|
72
|
+
shared rule to one owned location and reference it, not to add an import edge.
|
|
73
|
+
|
|
74
|
+
## Connascence Ladder
|
|
75
|
+
|
|
76
|
+
Map the shared knowledge to a rung, weakest (most tolerable) to strongest.
|
|
77
|
+
Lower rungs are cheaper to change; higher rungs amplify distance and volatility.
|
|
78
|
+
|
|
79
|
+
| Rung | Connascence | Meaning |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| 1 | Name | depends only on an identifier; a rename propagates |
|
|
82
|
+
| 2 | Type | depends on a type or shape |
|
|
83
|
+
| 3 | Meaning | depends on an agreed value, convention, or format (magic numbers, date formats) |
|
|
84
|
+
| 4 | Position | depends on argument, field, or tuple order |
|
|
85
|
+
| 5 | Algorithm | depends on call order, timing, transaction, or duplicated logic |
|
|
86
|
+
|
|
87
|
+
Rungs 4-5 map to Functional/Intrusive strength; rungs 1-2 map to Contract
|
|
88
|
+
strength. Use the rung to justify the Fix Direction: collapse higher rungs into
|
|
89
|
+
named contracts or shared owned logic before widening distance.
|
|
90
|
+
|
|
91
|
+
## Distance Levels
|
|
92
|
+
|
|
93
|
+
Use the closest common ownership point:
|
|
94
|
+
|
|
95
|
+
- same function or class
|
|
96
|
+
- same package or vertical slice
|
|
97
|
+
- same module/library
|
|
98
|
+
- different app/service
|
|
99
|
+
- external system or different team
|
|
100
|
+
|
|
101
|
+
Increase distance when deployment, ownership, or team coordination is separate.
|
|
102
|
+
|
|
103
|
+
### Distance Scorecard
|
|
104
|
+
|
|
105
|
+
| Layer pair | Distance |
|
|
106
|
+
|---|---|
|
|
107
|
+
| same function or class | 0 |
|
|
108
|
+
| same package or vertical slice | 1 |
|
|
109
|
+
| same module or library | 2 |
|
|
110
|
+
| different app or service | 3 |
|
|
111
|
+
| external system or different team | 4 |
|
|
112
|
+
|
|
113
|
+
Conway's-Law bump: when the two sides are owned by different teams (even inside
|
|
114
|
+
one service), add 1 to the distance — coordination cost makes the coupling
|
|
115
|
+
behave like the next distance tier.
|
|
116
|
+
|
|
117
|
+
## Volatility Signals
|
|
118
|
+
|
|
119
|
+
Prefer real evidence:
|
|
120
|
+
|
|
121
|
+
- Core or evolving business subdomain
|
|
122
|
+
- recent commits or co-change patterns
|
|
123
|
+
- TODO/FIXME clusters around behavior
|
|
124
|
+
- multiple API versions or migration code
|
|
125
|
+
- fragile tests, recurring regressions, or repeated audit findings
|
|
126
|
+
- user-provided roadmap pressure
|
|
127
|
+
|
|
128
|
+
If history is unavailable, mark volatility as inferred and lower confidence.
|
|
129
|
+
|
|
130
|
+
Turn "recent commits" into measured co-change (volatility by file):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
git log --since='3 months ago' --name-only --pretty=format: \
|
|
134
|
+
| grep -v '^$' | sort | uniq -c | sort -rn | head -30
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Co-change is evidence: files that move together repeatedly are coupled even
|
|
138
|
+
with no import edge. Two files in the top co-change set with no declared
|
|
139
|
+
dependency are an undeclared functional-coupling finding.
|
|
140
|
+
|
|
141
|
+
Override edge case: a Generic subdomain (auth, logging, storage plumbing) is
|
|
142
|
+
normally Low volatility. If that generic component is mid-migration or has
|
|
143
|
+
multiple in-repo versions, override it to High volatility for the duration —
|
|
144
|
+
generic-by-default never overrides measured churn.
|
|
145
|
+
|
|
146
|
+
## Balance Table
|
|
147
|
+
|
|
148
|
+
Use this diagnosis table. The Severity column is the reproducible priority:
|
|
149
|
+
critical edges first, watch edges only if unstable, the rest are healthy or
|
|
150
|
+
low-cost.
|
|
151
|
+
|
|
152
|
+
| Strength | Distance | Volatility | Severity | Diagnosis |
|
|
153
|
+
|---|---|---|---|---|
|
|
154
|
+
| High | High | High | 🔴 Critical | Costly global change pressure; prioritize |
|
|
155
|
+
| High | High | Low | 🟡 Watch | Often acceptable if stable and documented |
|
|
156
|
+
| High | Low | High | 🟢 Cohesive | Usually cohesive: keep close or merge |
|
|
157
|
+
| High | Low | Low | 🟢 Fine | Usually fine |
|
|
158
|
+
| Low | High | High | 🟢 Healthy | Healthy loose coupling |
|
|
159
|
+
| Low | High | Low | 🟢 Healthy | Healthy or low-cost |
|
|
160
|
+
| Low | Low | High | 🟠 Inspect | Local complexity; inspect cohesion |
|
|
161
|
+
| Low | Low | Low | 🟢 Low | Low priority unless noisy |
|
|
162
|
+
|
|
163
|
+
## Quantitative Anchors
|
|
164
|
+
|
|
165
|
+
Binary each dimension before reading the Balance Table so two auditors reach the
|
|
166
|
+
same cell.
|
|
167
|
+
|
|
168
|
+
| Dimension | 1 (High) | 0 (Low) |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| Strength (S) | Intrusive, Functional, or Model coupling | Contract coupling |
|
|
171
|
+
| Distance (D) | crosses service, team, or external boundary | same module or package |
|
|
172
|
+
| Volatility (V) | core/evolving subdomain or recent co-change | stable or generic |
|
|
173
|
+
|
|
174
|
+
Then:
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
BALANCE = (S XOR D) OR (NOT V)
|
|
178
|
+
MAINTENANCE_EFFORT = S * D * V
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- `BALANCE = 1` (balanced): the edge is acceptable — strength is local (S=0),
|
|
182
|
+
distance is local (D=0), or the edge is stable (V=0).
|
|
183
|
+
- `BALANCE = 0` (unbalanced): strong, distant, AND volatile — the highest-cost
|
|
184
|
+
edge; prioritize it.
|
|
185
|
+
- `MAINTENANCE_EFFORT` ranks unbalanced edges: it is 1 only in the single
|
|
186
|
+
strong+distant+volatile cell. Use it to order fixes when several edges tie.
|
|
187
|
+
|
|
188
|
+
These are scoring aids, not proof. A `BALANCE = 1` edge still warrants a finding
|
|
189
|
+
when concrete evidence shows real change friction.
|
|
190
|
+
|
|
191
|
+
## Pattern Strength Action Lookup
|
|
192
|
+
|
|
193
|
+
Classify a concrete pattern, then act.
|
|
194
|
+
|
|
195
|
+
| # | Pattern | Strength | Action |
|
|
196
|
+
|---|---|---|---|
|
|
197
|
+
| 1 | downstream reads another module's private fields or internals | Intrusive | seal behind a contract; remove direct access |
|
|
198
|
+
| 2 | downstream queries another context's database | Intrusive | expose an owned API or anti-corruption layer |
|
|
199
|
+
| 3 | duplicated business predicate or rule in two modules | Functional (symmetric) | extract to one owned location |
|
|
200
|
+
| 4 | mandatory call ordering spread across callers | Functional | hide ordering behind one interface |
|
|
201
|
+
| 5 | shared transaction or state transitions across modules | Functional | co-locate or publish an explicit contract |
|
|
202
|
+
| 6 | upstream exposes persistence schema or enum as integration surface | Model | publish a versioned DTO or language |
|
|
203
|
+
| 7 | DTO mirrors a full domain object | Model | project to a use-case-specific DTO |
|
|
204
|
+
| 8 | dependency on field name, value, or tuple position | Model | wrap in a typed contract |
|
|
205
|
+
| 9 | versioned DTO, event, or schema hides internals | Contract | accept; document as stable |
|
|
206
|
+
| 10 | stable facade or anti-corruption layer translating vocabulary | Contract | accept; record as intentional |
|
|
207
|
+
|
|
208
|
+
## Static Leads
|
|
209
|
+
|
|
210
|
+
Look for:
|
|
211
|
+
|
|
212
|
+
- direct reads of another module's database, config, or internal files
|
|
213
|
+
- imports from `internal`, `private`, generated, or persistence model paths across contexts
|
|
214
|
+
- duplicate business predicates, thresholds, mappings, or validation
|
|
215
|
+
- comments like "update X when changing Y"
|
|
216
|
+
- DTOs that mirror full domain or persistence objects
|
|
217
|
+
- mandatory call ordering spread across callers
|
|
218
|
+
- cycles, bidirectional imports, or dependency inversion breaks
|
|
219
|
+
- tests that require constructing far-away internals to exercise local behavior
|
|
220
|
+
|
|
221
|
+
## Positive Patterns
|
|
222
|
+
|
|
223
|
+
Call out positive evidence when useful:
|
|
224
|
+
|
|
225
|
+
- use-case-specific DTOs or events
|
|
226
|
+
- versioned public contracts
|
|
227
|
+
- anti-corruption layers translating vocabulary
|
|
228
|
+
- stable facade that hides internal model churn
|
|
229
|
+
- dependency direction from volatile policy toward stable abstraction, not from stable core toward volatile detail
|
|
230
|
+
|
|
231
|
+
## Fix Direction
|
|
232
|
+
|
|
233
|
+
Reduce strength before increasing distance:
|
|
234
|
+
|
|
235
|
+
- replace intrusive/model coupling with explicit contracts
|
|
236
|
+
- move tightly coupled volatile modules closer when they change together
|
|
237
|
+
- extract shared duplicated rule only when it is a real domain rule, not trivial repetition
|
|
238
|
+
- document accepted strong-stable integration instead of refactoring it
|
|
239
|
+
- avoid introducing ports/adapters unless there is real variation, test substitution, external dependency, or direction pressure
|