Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
387 changes: 375 additions & 12 deletions README.en.md

Large diffs are not rendered by default.

197 changes: 187 additions & 10 deletions README.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions docs/engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ metadata、requirements、plan、ledger、claim 和 handoff;只有受支持的
计划时必须继承其 requirements、plan 和 `implementationScope`,不能重新规划或扩权。
这些状态写入既有 ledger、plan revision 和 workflow metadata,不建立第二套提示词 authority。

## 基于已接受状态的交付叙事

最终用户可见的标题、文件名、注释、commit、PR、summary 和 handoff 叙事应从已接受
目标、权威基线、实际读回状态和本任务 diff 生成,并假设读者没有参与工作会话。仅在
会话中被否决的方案或措辞修正不进入最终产物的交付身份;只有当它们构成必要的审计事实、
引用或用户明确要求的比较时才保留。

这条规则只约束交付叙事,不修改执行授权或审计事实。requirements、计划中的真实方案
比较、`excludedScope`、review/verification 证据、失败与 blocker、迁移和兼容影响、
安全事实、引用内容以及 handoff 的结构化状态和 resolution reason 必须保留。工具、hook
或外部平台创建或改写用户可见表面后,应在能力允许时读回实际结果;无法读回时报告该
表面未验证,不能把提示词规则描述成确定性保证。

## 代码地图

| 目录 | 职责 |
Expand Down
6 changes: 6 additions & 0 deletions docs/platform-adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ adapter upgrade 先在 staging 中生成预览,用户确认后再通过 journa
- 不保存易过期的 task/session 状态副本。
- 未证明宿主 session 传播时要求显式 session。
- 保留用户自写配置,并支持重复安装和安全卸载。
- 为默认 Solo 和 mode producer 提供基于已接受状态的交付叙事规则;它只影响最终用户可见
包装,不修改 requirements、ledger、handoff resolution 或 completion gate。

该叙事规则属于 managed adapter 内容。renderer 更新后,现有安装会按相同 digest 契约
显示 `stale`,必须继续通过 `adapter upgrade --dry-run` 和显式确认发布;它不构成新的
adapter schema,因此不单独提升 renderer schema version。

## Legacy hooks

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mancode",
"version": "0.6.2",
"version": "0.6.3",
"description": "AI coding agent workflow harness with mancode Continuity for cross-conversation tasks, decisions, verification, and team coordination.",
"type": "module",
"license": "AGPL-3.0-only",
Expand Down
55 changes: 50 additions & 5 deletions scripts/verify-dist-adapters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,61 @@ try {
await mkdir(projectRoot, { recursive: true });
runCli(['init', '--empty', '--platform', 'all', '--lang', 'en']);

const generatedFiles = [
const bootstrapFiles = new Set([
'CLAUDE.md',
'.claude/skills/man/SKILL.md',
'.cursor/rules/mancode-continuity.mdc',
'.cursor/commands/man.md',
'AGENTS.md',
'.github/copilot-instructions.md',
]);
const manFiles = new Set([
'.claude/skills/man/SKILL.md',
'.cursor/commands/man.md',
'.agents/skills/man/SKILL.md',
'.dsh/skills/man/SKILL.md',
'.github/copilot-instructions.md',
'.github/prompts/man.prompt.md',
'.qoder/commands/man.md',
];
]);
const manteamFiles = new Set([
'.claude/skills/manteam/SKILL.md',
'.cursor/commands/manteam.md',
'.agents/skills/manteam/SKILL.md',
'.dsh/skills/manteam/SKILL.md',
'.github/prompts/manteam.prompt.md',
'.qoder/commands/manteam.md',
]);
const generatedFiles = [...bootstrapFiles, ...manFiles, ...manteamFiles];

for (const relativePath of generatedFiles) {
const content = await readFile(
path.join(projectRoot, relativePath),
'utf8',
);
assertGeneratedContract(relativePath, content);
if (bootstrapFiles.has(relativePath)) {
assertContainsAll(relativePath, content, [
'accepted target',
'task-owned diff',
'Rejected session-only proposals',
'mark them unverified',
]);
}
if (manFiles.has(relativePath)) {
assertContainsAll(relativePath, content, [
'completion, a commit, or a PR',
'accepted requirements and plan',
'task-owned diff from the bound `baseHead`',
'Preserve failures, blockers',
'report it as unverified',
]);
}
if (manteamFiles.has(relativePath)) {
assertContainsAll(relativePath, content, [
'Before any handoff, commit, or PR',
'current authoritative task and handoff state plus the task-owned diff',
'every formal handoff status and resolution reason',
'mark it unverified',
]);
}
}

const status = runCli(['status', '--brief', '--json']);
Expand Down Expand Up @@ -94,6 +130,15 @@ function assertGeneratedContract(relativePath, content) {
}
}

function assertContainsAll(relativePath, content, requiredValues) {
for (const required of requiredValues) {
assert(
content.includes(required),
`${relativePath} is missing compiled delivery guidance: ${required}`,
);
}
}

function assert(condition, message) {
if (!condition) throw new Error(message);
}
2 changes: 2 additions & 0 deletions src/context/accepted-state-narrative-guidance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const ACCEPTED_STATE_NARRATIVE_GUIDANCE =
'Base final titles, filenames, comments, commits, PRs, summaries, and handoffs on the accepted target, authoritative baseline, observed final state, and task-owned diff. Rejected session-only proposals and wording fixes do not define delivery identity. Preserve relevant failures, blockers, compatibility, migration, diagnosis, audit, quotations, requested comparisons, and authoritative workflow or handoff facts. Read back external surfaces when possible; otherwise mark them unverified.';
6 changes: 3 additions & 3 deletions src/installers/mode-skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ const MODE_META: Record<ModeName, ModeMeta> = {
' If environment, permission, or data is missing, set blocked with `--blocking-reason` and keep state resumable instead of advancing.',
'3. Reproduce the shortest path and write `diagnosis.md` with evidence, root cause or candidates, impact, and confidence; then update to Step 4.',
'4. Apply only the requested minimum fix, or make no code change when the user requested validation only. New architecture or cross-module scope returns to /man. Then update to Step 5.',
'5. Re-run the path and affected positive, negative, and permission boundaries; write `mamba-report.md` with environment, evidence, artifacts, regression scope, and risks.',
'5. Re-run the path and affected positive, negative, and permission boundaries; write `mamba-report.md` from the observed final state with environment, evidence, artifacts, regression scope, and risks. Preserve authoritative no_repro, blocked/manual_test_required, failed validation, negative or permission results, and residual risks.',
'',
'Finish through the CLI with exactly one result: completed+fixed, completed+verified, completed+no_repro, completed+manual_test_required, or blocked+blockingReason. Never claim real testing in restricted mode. Child blocked/manual_test_required propagation is handled by the CLI. After a child finishes with fixed/verified/no_repro, inspect its parent; if that parent is still blocked because of this child, run `mancode workflow update <parentTaskId> --status in_progress` before restoring parent state at Step 6. Never auto-resume manual_test_required.',
].join('\n'),
Expand All @@ -703,7 +703,7 @@ const MODE_META: Record<ModeName, ModeMeta> = {
'Step 6 — Run `workflow verify <taskId> init`, execute detected build/lint/typecheck/test and smoke checks, and record every required acceptance ID with reproducible evidence; automated passed/failed records include the command and exit code. Use require-manual when a foreground browser, device, or human judgment is necessary; stop for explicit user confirmation before confirm-manual. The CLI blocks Step 7 and review until all checks pass. Then write `review-scope.md` and initialize targeted or full review. An explicit user review skip uses `workflow review <taskId> skip --reason <reason>` at Step 6, never generic skipped metadata.',
'Step 7 — Run one quality review limited to the changed diff and direct impact. Compare every changed path and behavior with confirmed requirements, acceptance IDs, and implementation scope; any unauthorized behavior, path outside include, or path matching exclude is a blocker. Findings require changed-line evidence and user impact, with at most three new findings. Record stable blocker IDs through `workflow review ... complete`; do not fix yet.',
'Step 8 — Only full review runs the security/boundary reviewer. It must read Film #1, mark the same root cause duplicate, and stay within security, permissions, recovery, resources, and boundaries. A targeted review treats the second domain as not applicable; it is never recorded as a skipped step.',
'Step 9 — If open blockers exist, fix them in one remediation round and record resolved IDs through `workflow review ... remediate`; remediation invalidates all earlier acceptance evidence, so re-run and re-record every required check at Step 9 without re-running completed reviewers. Write `summary.md` and set completed only when verification and required review domains are complete and blockers are zero.',
'Step 9 — If open blockers exist, fix them in one remediation round and record resolved IDs through `workflow review ... remediate`; remediation invalidates all earlier acceptance evidence, so re-run and re-record every required check at Step 9 without re-running completed reviewers. Build `summary.md`, commit, and PR copy from the accepted target, authoritative baseline, observed final state, and task-owned diff; preserve excluded scope, failed verification, blockers, migration or rollback, and audit facts. Set completed only when verification and required review domains are complete and blockers are zero.',
'',
'Stop and return the read-only diagnostic `NEEDS_REALIGNMENT` with reason `MANCODE_REFRAME_REQUIRED` when new evidence invalidates the confirmed goal, semantic owner, source of truth, or acceptance; platform entries would produce different semantics; status/contract/policy/transition meaning must change; an adapter is stale, the writer is incompatible, an operation is unfinished, an active child/open handoff/active solo assignment exists; or the change exceeds the current requirements/plan scope. Preserve metadata, requirements, plan, ledgers, claims, and handoffs. Do not call generic workflow update, write blocked/currentStep/planning, archive files, release claims, or claim to be back at Step 2.',
'',
Expand Down Expand Up @@ -734,7 +734,7 @@ const MODE_META: Record<ModeName, ModeMeta> = {
'`workflow update --status in_progress`; never auto-resume manual_test_required.',
'',
'Read `.mancode/memory/prd.md`, `spec.md`, and `decisions.md`; append durable',
'decisions only after confirmed implementation. Write `handoff.md`. Never',
'decisions only after confirmed implementation. Build `handoff.md`, commit, and PR copy from the accepted target, authoritative baseline, observed final state, and task-owned diff; preserve conflicts, incomplete work, failed verification, migration or rollback, audit facts, and formal rejected or cancelled handoff states and reasons. Never',
'overwrite teammate changes or commit/merge/push without explicit approval.',
].join('\n'),
},
Expand Down
3 changes: 3 additions & 0 deletions src/installers/shared-content.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import { ACCEPTED_STATE_NARRATIVE_GUIDANCE } from '../context/accepted-state-narrative-guidance.js';
import {
INTERFACE_EMOJI_ICON_GUIDANCE,
VISUAL_DIRECTION_SELECTION_GUIDANCE,
Expand Down Expand Up @@ -122,6 +123,8 @@ function renderPracticeRules(): string {
'',
'For every task, consider: why this change, what already exists, and what is the smallest useful diff?',
'',
`- ${ACCEPTED_STATE_NARRATIVE_GUIDANCE}`,
'',
'In solo mode, use the narrowest meaningful validation and one bounded self-check limited to the current diff. Do not start another reviewer or repeat the review.',
'Recommend man and explain the trigger when platform entry/flow differs, the semantic owner or source of truth is unclear, status/contract/policy semantics change, scope/architecture/cost/acceptance crosses files or modules, or historical compatibility, migration, cross-platform, or team evidence is required. Auth, payment, sensitive data, deletion, public APIs, untrusted input, concurrency, and infrastructure remain hard-risk signals. Advice alone never changes mode, step, policy, or authority.',
'While executing confirmed requirements/plan, new evidence that invalidates its goal, owner, source of truth, acceptance, or scope, or a stale adapter/incompatible writer/unfinished operation/active child/open handoff/active solo assignment, requires the read-only diagnostic `NEEDS_REALIGNMENT` with reason `MANCODE_REFRAME_REQUIRED`. Preserve metadata, requirements, plan, ledgers, claims, and handoffs; do not call generic workflow update, write blocked/currentStep/planning, archive files, release claims, or claim to be back at Step 2.',
Expand Down
Loading
Loading