okstra 0.231.1 → 0.233.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/README.md +19 -271
- package/dist/cli-registry.mjs +14 -1
- package/dist/cli-registry.mjs.map +1 -1
- package/dist/commands/execute/render-bundle.d.mts +6 -1
- package/dist/commands/execute/render-bundle.mjs +139 -32
- package/dist/commands/execute/render-bundle.mjs.map +1 -1
- package/dist/commands/lifecycle/config.mjs +6 -74
- package/dist/commands/lifecycle/config.mjs.map +1 -1
- package/dist/commands/memory/memory.mjs +9 -55
- package/dist/commands/memory/memory.mjs.map +1 -1
- package/dist/commands/trace/capacity.d.mts +12 -0
- package/dist/commands/trace/capacity.mjs +21 -0
- package/dist/commands/trace/capacity.mjs.map +1 -0
- package/dist/commands/trace/model.d.mts +89 -0
- package/dist/commands/trace/model.mjs +251 -0
- package/dist/commands/trace/model.mjs.map +1 -0
- package/dist/commands/trace/progression.d.mts +11 -0
- package/dist/commands/trace/progression.mjs +194 -0
- package/dist/commands/trace/progression.mjs.map +1 -0
- package/dist/commands/trace/review.d.mts +7 -0
- package/dist/commands/trace/review.mjs +51 -0
- package/dist/commands/trace/review.mjs.map +1 -0
- package/dist/commands/trace/task-link.d.mts +18 -0
- package/dist/commands/trace/task-link.mjs +72 -0
- package/dist/commands/trace/task-link.mjs.map +1 -0
- package/dist/commands/trace/trace.d.mts +1 -0
- package/dist/commands/trace/trace.mjs +293 -0
- package/dist/commands/trace/trace.mjs.map +1 -0
- package/dist/lib/bounded-file.d.mts +1 -0
- package/dist/lib/bounded-file.mjs +36 -0
- package/dist/lib/bounded-file.mjs.map +1 -0
- package/dist/lib/config-store.d.mts +34 -0
- package/dist/lib/config-store.mjs +70 -0
- package/dist/lib/config-store.mjs.map +1 -0
- package/dist/lib/file-lock.mjs +4 -5
- package/dist/lib/file-lock.mjs.map +1 -1
- package/dist/lib/input-limit.d.mts +4 -0
- package/dist/lib/input-limit.mjs +8 -0
- package/dist/lib/input-limit.mjs.map +1 -0
- package/dist/lib/memory-auto-register.d.mts +1 -0
- package/dist/lib/memory-auto-register.mjs +98 -0
- package/dist/lib/memory-auto-register.mjs.map +1 -0
- package/dist/lib/memory-entry-contract.d.mts +12 -0
- package/dist/lib/memory-entry-contract.mjs +46 -0
- package/dist/lib/memory-entry-contract.mjs.map +1 -0
- package/dist/lib/python-helper.d.mts +1 -1
- package/dist/lib/python-helper.mjs +3 -2
- package/dist/lib/python-helper.mjs.map +1 -1
- package/dist/lib/record-secrets.d.mts +1 -0
- package/dist/lib/record-secrets.mjs +28 -0
- package/dist/lib/record-secrets.mjs.map +1 -0
- package/dist/lib/report-language-tag.d.mts +1 -0
- package/dist/lib/report-language-tag.mjs +4 -0
- package/dist/lib/report-language-tag.mjs.map +1 -0
- package/dist/lib/report-language.d.mts +1 -0
- package/dist/lib/report-language.mjs +50 -0
- package/dist/lib/report-language.mjs.map +1 -0
- package/dist/lib/skill-catalog.mjs +3 -0
- package/dist/lib/skill-catalog.mjs.map +1 -1
- package/dist/lib/types.d.mts +2 -1
- package/docs/architecture/storage-model.md +163 -5
- package/docs/architecture.md +17 -4
- package/docs/cli.md +511 -0
- package/docs/contributor-change-matrix.md +1 -2
- package/docs/project-structure-overview.md +33 -42
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/common.json +8 -8
- package/runtime/agents/operations/trace-interface-review.json +6 -0
- package/runtime/agents/operations/trace-scope-review.json +6 -0
- package/runtime/agents/roles/verifier.json +2 -4
- package/runtime/bin/okstra-provider-exec.py +10 -4
- package/runtime/prompts/coding-preflight/architectures/hexagonal.md +23 -30
- package/runtime/prompts/coding-preflight/authoring-checks.md +17 -0
- package/runtime/prompts/coding-preflight/clean-code.md +88 -286
- package/runtime/prompts/coding-preflight/frameworks/node-server.md +2 -3
- package/runtime/prompts/coding-preflight/languages/java.md +3 -5
- package/runtime/prompts/coding-preflight/languages/javascript-typescript.md +5 -12
- package/runtime/prompts/coding-preflight/languages/kotlin.md +2 -4
- package/runtime/prompts/coding-preflight/languages/python.md +2 -7
- package/runtime/prompts/coding-preflight/languages/rust.md +2 -8
- package/runtime/prompts/coding-preflight/languages/sql.md +2 -4
- package/runtime/prompts/coding-preflight/overview.md +25 -38
- package/runtime/prompts/coding-preflight/review-rules.json +30 -0
- package/runtime/prompts/duties/code-reviewer.json +15 -18
- package/runtime/prompts/duties/implementation-verifier.json +1 -0
- package/runtime/prompts/duties/interface-reviewer.json +32 -0
- package/runtime/prompts/host-orchestration/README.md +18 -9
- package/runtime/prompts/launch.template.md +3 -2
- package/runtime/prompts/lead/context-loader.md +2 -0
- package/runtime/prompts/lead/okstra-lead-contract.md +7 -7
- package/runtime/prompts/lead/report-writer.md +6 -6
- package/runtime/prompts/profiles/_coding-conventions-preflight.md +41 -6
- package/runtime/prompts/profiles/_common-contract.md +1 -1
- package/runtime/python/okstra_ctl/agent/invocation.py +122 -36
- package/runtime/python/okstra_ctl/agent/prompt_cli/cli.py +72 -26
- package/runtime/python/okstra_ctl/agent/prompt_cli/corrections.py +23 -8
- package/runtime/python/okstra_ctl/agent/prompt_cli/materialize.py +58 -14
- package/runtime/python/okstra_ctl/agent/prompt_cli/results.py +8 -11
- package/runtime/python/okstra_ctl/agent/standalone.py +15 -0
- package/runtime/python/okstra_ctl/analysis_packet.py +24 -30
- package/runtime/python/okstra_ctl/attempt_evidence.py +10 -0
- package/runtime/python/okstra_ctl/code_review_census.py +162 -7
- package/runtime/python/okstra_ctl/code_review_coverage.py +4 -274
- package/runtime/python/okstra_ctl/code_review_integrity.py +154 -0
- package/runtime/python/okstra_ctl/code_review_invocation.py +212 -0
- package/runtime/python/okstra_ctl/code_review_prepare.py +381 -0
- package/runtime/python/okstra_ctl/code_review_run.py +384 -0
- package/runtime/python/okstra_ctl/code_review_scope.py +49 -9
- package/runtime/python/okstra_ctl/code_review_supervisor.py +41 -0
- package/runtime/python/okstra_ctl/code_review_target.py +212 -13
- package/runtime/python/okstra_ctl/consumers.py +12 -9
- package/runtime/python/okstra_ctl/coverage_census.py +11 -2
- package/runtime/python/okstra_ctl/design_review.py +207 -0
- package/runtime/python/okstra_ctl/design_review_evidence.py +297 -0
- package/runtime/python/okstra_ctl/design_snapshot.py +16 -9
- package/runtime/python/okstra_ctl/direct_work.py +45 -3
- package/runtime/python/okstra_ctl/dispatch_core.py +31 -15
- package/runtime/python/okstra_ctl/dispatch_state.py +9 -2
- package/runtime/python/okstra_ctl/doctor.py +8 -25
- package/runtime/python/okstra_ctl/domain/role.py +1 -0
- package/runtime/python/okstra_ctl/doyouknow/__init__.py +9 -0
- package/runtime/python/okstra_ctl/doyouknow/cli.py +91 -0
- package/runtime/python/okstra_ctl/doyouknow/config.py +58 -0
- package/runtime/python/okstra_ctl/doyouknow/contracts.py +184 -0
- package/runtime/python/okstra_ctl/doyouknow/identity.py +22 -0
- package/runtime/python/okstra_ctl/doyouknow/paths.py +22 -0
- package/runtime/python/okstra_ctl/doyouknow/pending.py +72 -0
- package/runtime/python/okstra_ctl/doyouknow/registration.py +260 -0
- package/runtime/python/okstra_ctl/doyouknow/source_contracts.py +128 -0
- package/runtime/python/okstra_ctl/doyouknow/source_store.py +172 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/io.py +36 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/manager.py +300 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/memory.py +179 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/task.py +95 -0
- package/runtime/python/okstra_ctl/doyouknow/store.py +260 -0
- package/runtime/python/okstra_ctl/doyouknow/sync.py +58 -0
- package/runtime/python/okstra_ctl/execution_mutation_audit.py +18 -2
- package/runtime/python/okstra_ctl/file_size_cap.py +3 -4
- package/runtime/python/okstra_ctl/final_report_schema.py +37 -34
- package/runtime/python/okstra_ctl/incremental_carry.py +6 -7
- package/runtime/python/okstra_ctl/initial_prompt_materialization.py +9 -2
- package/runtime/python/okstra_ctl/json_boundary.py +51 -5
- package/runtime/python/okstra_ctl/jsonl.py +21 -0
- package/runtime/python/okstra_ctl/manager_cli.py +148 -1
- package/runtime/python/okstra_ctl/manager_journal.py +126 -0
- package/runtime/python/okstra_ctl/manager_launch.py +3 -3
- package/runtime/python/okstra_ctl/manager_log.py +221 -0
- package/runtime/python/okstra_ctl/manager_paths.py +8 -0
- package/runtime/python/okstra_ctl/manager_registration.py +29 -0
- package/runtime/python/okstra_ctl/manager_resume.py +59 -0
- package/runtime/python/okstra_ctl/manager_split.py +2 -2
- package/runtime/python/okstra_ctl/manager_store.py +116 -17
- package/runtime/python/okstra_ctl/manager_sync.py +45 -25
- package/runtime/python/okstra_ctl/manager_view.py +35 -2
- package/runtime/python/okstra_ctl/material.py +2 -0
- package/runtime/python/okstra_ctl/model_cli.py +64 -14
- package/runtime/python/okstra_ctl/model_defaults.py +22 -0
- package/runtime/python/okstra_ctl/model_io/renderers.py +16 -2
- package/runtime/python/okstra_ctl/model_io_cli.py +7 -1
- package/runtime/python/okstra_ctl/operation_invocation.py +207 -28
- package/runtime/python/okstra_ctl/path_hints.py +14 -3
- package/runtime/python/okstra_ctl/paths.py +6 -1
- package/runtime/python/okstra_ctl/phases/catalog.py +24 -7
- package/runtime/python/okstra_ctl/phases/final_verification/validation.py +20 -0
- package/runtime/python/okstra_ctl/phases/implementation/host-rules.md +3 -3
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-deliverable.md +10 -0
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-diff-review.md +23 -8
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-self-check.md +6 -4
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-verifier.md +38 -10
- package/runtime/python/okstra_ctl/phases/implementation/report_assets/implementation.template.html +13 -0
- package/runtime/python/okstra_ctl/phases/implementation/spec.md +25 -0
- package/runtime/python/okstra_ctl/phases/implementation/validation.py +6 -0
- package/runtime/python/okstra_ctl/phases/implementation_option_selection/profile.md +1 -1
- package/runtime/python/okstra_ctl/phases/implementation_option_selection/votes.py +11 -11
- package/runtime/python/okstra_ctl/phases/implementation_planning/authoring.py +16 -9
- package/runtime/python/okstra_ctl/phases/implementation_planning/host-rules.md +3 -6
- package/runtime/python/okstra_ctl/phases/implementation_planning/instructions/plan-body-verification.md +12 -10
- package/runtime/python/okstra_ctl/phases/implementation_planning/profile.md +6 -6
- package/runtime/python/okstra_ctl/phases/improvement_discovery/lenses.py +12 -0
- package/runtime/python/okstra_ctl/phases/improvement_discovery/profile.md +7 -6
- package/runtime/python/okstra_ctl/phases/improvement_discovery/resolved_census.py +159 -0
- package/runtime/python/okstra_ctl/phases/improvement_discovery/spec.md +5 -2
- package/runtime/python/okstra_ctl/phases/improvement_discovery/validation.py +21 -7
- package/runtime/python/okstra_ctl/phases/release_handoff/boundary.json +1 -1
- package/runtime/python/okstra_ctl/phases/release_handoff/profile.md +4 -1
- package/runtime/python/okstra_ctl/plan_verify_cli.py +6 -4
- package/runtime/python/okstra_ctl/render.py +28 -2
- package/runtime/python/okstra_ctl/report_assembly.py +53 -11
- package/runtime/python/okstra_ctl/report_contract.py +26 -0
- package/runtime/python/okstra_ctl/report_corrections.py +36 -20
- package/runtime/python/okstra_ctl/report_inputs.py +1 -0
- package/runtime/python/okstra_ctl/report_language.py +4 -1
- package/runtime/python/okstra_ctl/report_narrative.py +182 -7
- package/runtime/python/okstra_ctl/report_projections.py +64 -18
- package/runtime/python/okstra_ctl/report_synthesis_packet.py +97 -38
- package/runtime/python/okstra_ctl/review_policy.py +359 -0
- package/runtime/python/okstra_ctl/review_verdicts.py +291 -0
- package/runtime/python/okstra_ctl/run.py +67 -36
- package/runtime/python/okstra_ctl/run_context.py +10 -1
- package/runtime/python/okstra_ctl/set_work_status.py +4 -15
- package/runtime/python/okstra_ctl/stage_done.py +11 -0
- package/runtime/python/okstra_ctl/standalone_review_audit.py +28 -0
- package/runtime/python/okstra_ctl/task_list_cli.py +34 -8
- package/runtime/python/okstra_ctl/task_query.py +239 -0
- package/runtime/python/okstra_ctl/trace_review.py +264 -0
- package/runtime/python/okstra_ctl/trace_tasks.py +197 -0
- package/runtime/python/okstra_ctl/user_authorization.py +14 -0
- package/runtime/python/okstra_ctl/verification_generation.py +23 -1
- package/runtime/python/okstra_ctl/verification_input_types.py +15 -1
- package/runtime/python/okstra_ctl/verification_inputs.py +28 -6
- package/runtime/python/okstra_ctl/verification_invocation.py +7 -1
- package/runtime/python/okstra_ctl/verification_target.py +2 -0
- package/runtime/python/okstra_ctl/wizard/confirmation.py +7 -3
- package/runtime/python/okstra_ctl/wizard/launch.py +52 -0
- package/runtime/python/okstra_ctl/wizard/launch_cli.py +39 -0
- package/runtime/python/okstra_ctl/wizard/outcome.py +17 -16
- package/runtime/python/okstra_ctl/wizard/registry.py +1 -1
- package/runtime/python/okstra_ctl/wizard/render.py +8 -0
- package/runtime/python/okstra_ctl/wizard/state.py +2 -1
- package/runtime/python/okstra_ctl/worker_prompt_headers.py +24 -9
- package/runtime/python/okstra_ctl/worker_runner.py +66 -10
- package/runtime/python/okstra_ctl/write_policy.py +34 -1
- package/runtime/python/okstra_project/__init__.py +2 -0
- package/runtime/python/okstra_project/dirs.py +18 -0
- package/runtime/python/okstra_project/state.py +45 -20
- package/runtime/python/okstra_token_usage/blocks.py +74 -0
- package/runtime/python/okstra_token_usage/cli.py +23 -10
- package/runtime/python/okstra_token_usage/collect.py +25 -22
- package/runtime/python/okstra_token_usage/policy.py +193 -0
- package/runtime/schemas/doyouknow-config-v1.schema.json +20 -0
- package/runtime/schemas/doyouknow-v1.schema.json +65 -0
- package/runtime/schemas/final-report-v2.0.schema.json +157 -0
- package/runtime/schemas/final-report-v3.0.schema.json +157 -0
- package/runtime/schemas/memory-entry-contract-v1.json +11 -0
- package/runtime/schemas/record-secret-patterns.json +41 -0
- package/runtime/schemas/report-synthesis-packet-v1.0.schema.json +1 -1
- package/runtime/skills/_fragments/wizard-confirm-step.md +1 -1
- package/runtime/skills/_fragments/wizard-preflight.md +1 -1
- package/runtime/skills/_fragments/wizard-prompt-loop.md +3 -5
- package/runtime/skills/_fragments/wizard-relay-protocol.md +1 -1
- package/runtime/skills/_fragments/wizard-render-bundle.md +15 -29
- package/runtime/skills/okstra-brief-gen/SKILL.md +7 -7
- package/runtime/skills/okstra-brief-gen/references/tracker-recursion.md +1 -1
- package/runtime/skills/okstra-code-review/SKILL.md +92 -136
- package/runtime/skills/okstra-code-review/references/census-rules.md +29 -105
- package/runtime/skills/okstra-code-review/references/review-calibration.md +37 -61
- package/runtime/skills/okstra-discussion/SKILL.md +22 -38
- package/runtime/skills/okstra-explain-flow/SKILL.md +6 -2
- package/runtime/skills/okstra-manager/SKILL.md +31 -0
- package/runtime/skills/okstra-memory/SKILL.md +8 -1
- package/runtime/skills/okstra-pr-gen/SKILL.md +1 -1
- package/runtime/skills/okstra-run/SKILL.md +55 -183
- package/runtime/skills/okstra-schedule-gen/SKILL.md +9 -13
- package/runtime/skills/okstra-setup/SKILL.md +3 -2
- package/runtime/skills/okstra-setup/references/project-config.md +2 -4
- package/runtime/skills/okstra-tdd/SKILL.md +187 -0
- package/runtime/skills/okstra-user-response/SKILL.md +4 -2
- package/runtime/templates/implementation-worker-preamble.md +4 -9
- package/runtime/templates/manager/view.template.html +4 -0
- package/runtime/templates/report-writer-prompt-preamble.md +15 -3
- package/runtime/templates/trace/trace.template.md +42 -0
- package/runtime/templates/worker-prompt-preamble.md +4 -12
- package/runtime/validators/checks/fixtures-02.py +25 -33
- package/runtime/validators/validate-run.py +107 -38
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-auto-register.mjs","sourceRoot":"","sources":["../../src/lib/memory-auto-register.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CA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IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,CAAC,MAAM,gCAAgC,CAAC,IAAI,CAAC,CAAC;YAAE,OAAO;QAC5D,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,QAAQ,CAAC,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnG,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC;YACnC,MAAM,EAAE,0BAA0B,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC;YACnF,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI;SAClE,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface MemoryEntryContract {
|
|
2
|
+
readonly schemaVersion: 1;
|
|
3
|
+
readonly requiredStrings: readonly string[];
|
|
4
|
+
readonly stringArrays: readonly string[];
|
|
5
|
+
readonly nullableStrings: readonly string[];
|
|
6
|
+
readonly optionalStrings: readonly string[];
|
|
7
|
+
readonly enums: Readonly<Record<string, readonly string[]>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function loadMemoryEntryContract(): MemoryEntryContract;
|
|
10
|
+
export declare function isMemoryType(value: string): boolean;
|
|
11
|
+
export declare function matchesMemoryEntryContract(value: Readonly<Record<string, unknown>>): boolean;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { getPackageRoot } from "./version.mjs";
|
|
4
|
+
let cachedContract;
|
|
5
|
+
function isStringArray(value) {
|
|
6
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
7
|
+
}
|
|
8
|
+
function isMemoryEntryContract(value) {
|
|
9
|
+
if (typeof value !== "object" || value === null ||
|
|
10
|
+
!("schemaVersion" in value) || value.schemaVersion !== 1 ||
|
|
11
|
+
!("requiredStrings" in value) || !isStringArray(value.requiredStrings) ||
|
|
12
|
+
!("stringArrays" in value) || !isStringArray(value.stringArrays) ||
|
|
13
|
+
!("nullableStrings" in value) || !isStringArray(value.nullableStrings) ||
|
|
14
|
+
!("optionalStrings" in value) || !isStringArray(value.optionalStrings) ||
|
|
15
|
+
!("enums" in value) || typeof value.enums !== "object" || value.enums === null)
|
|
16
|
+
return false;
|
|
17
|
+
return "type" in value.enums && "status" in value.enums &&
|
|
18
|
+
Object.values(value.enums).every((items) => isStringArray(items) && items.length > 0);
|
|
19
|
+
}
|
|
20
|
+
export function loadMemoryEntryContract() {
|
|
21
|
+
if (cachedContract)
|
|
22
|
+
return cachedContract;
|
|
23
|
+
const root = getPackageRoot();
|
|
24
|
+
const source = join(root, "schemas", "memory-entry-contract-v1.json");
|
|
25
|
+
const path = existsSync(source) ? source : join(root, "runtime", "schemas", "memory-entry-contract-v1.json");
|
|
26
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
27
|
+
if (!isMemoryEntryContract(value))
|
|
28
|
+
throw new Error("Invalid Memory Book entry contract");
|
|
29
|
+
cachedContract = value;
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
export function isMemoryType(value) {
|
|
33
|
+
return loadMemoryEntryContract().enums.type?.includes(value) ?? false;
|
|
34
|
+
}
|
|
35
|
+
export function matchesMemoryEntryContract(value) {
|
|
36
|
+
const contract = loadMemoryEntryContract();
|
|
37
|
+
return contract.requiredStrings.every((field) => typeof value[field] === "string") &&
|
|
38
|
+
contract.stringArrays.every((field) => isStringArray(value[field])) &&
|
|
39
|
+
contract.nullableStrings.every((field) => value[field] === null || typeof value[field] === "string") &&
|
|
40
|
+
contract.optionalStrings.every((field) => value[field] === undefined || typeof value[field] === "string") &&
|
|
41
|
+
Object.entries(contract.enums).every(([field, allowed]) => {
|
|
42
|
+
const item = value[field];
|
|
43
|
+
return typeof item === "string" && allowed.includes(item);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=memory-entry-contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-entry-contract.mjs","sourceRoot":"","sources":["../../src/lib/memory-entry-contract.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAW/C,IAAI,cAA+C,CAAC;AAEpD,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc;IAC3C,IACE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,CAAC,CAAC,eAAe,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,aAAa,KAAK,CAAC;QACxD,CAAC,CAAC,iBAAiB,IAAI,KAAK,CAAC,I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@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InstalledScriptOptions, JsonErrorOptions, ProcessResult, PythonModuleOptions, RuntimePaths } from "./types.mjs";
|
|
2
2
|
export declare function resolveInstalledScript(paths: RuntimePaths, scriptName: string): string | null;
|
|
3
3
|
export declare function runInstalledScript({ scriptName, args }: InstalledScriptOptions): Promise<number>;
|
|
4
|
-
export declare function runPythonModule({ module, args, extraEnv, stdio }: PythonModuleOptions): Promise<ProcessResult>;
|
|
4
|
+
export declare function runPythonModule({ module, args, extraEnv, stdio, timeoutMs }: PythonModuleOptions): Promise<ProcessResult>;
|
|
5
5
|
export declare function emitJsonError({ stage, reason, extra }: JsonErrorOptions): void;
|
|
@@ -43,12 +43,13 @@ export async function runInstalledScript({ scriptName, args }) {
|
|
|
43
43
|
}
|
|
44
44
|
return await spawnPythonEntry(entry, args, paths);
|
|
45
45
|
}
|
|
46
|
-
export async function runPythonModule({ module, args = [], extraEnv = {}, stdio = "inherit-stdout" }) {
|
|
46
|
+
export async function runPythonModule({ module, args = [], extraEnv = {}, stdio = "inherit-stdout", timeoutMs }) {
|
|
47
47
|
const paths = await resolvePaths();
|
|
48
48
|
return new Promise((resolve) => {
|
|
49
49
|
const child = spawn("python3", ["-m", module, ...args], {
|
|
50
|
-
stdio: stdio === "capture" ? ["ignore", "pipe", "pipe"] : ["ignore", "inherit", "inherit"],
|
|
50
|
+
stdio: stdio === "ignore" ? "ignore" : stdio === "capture" ? ["ignore", "pipe", "pipe"] : ["ignore", "inherit", "inherit"],
|
|
51
51
|
env: { ...process.env, PYTHONPATH: buildPythonpath(paths), ...extraEnv },
|
|
52
|
+
...(timeoutMs === undefined ? {} : { timeout: timeoutMs, killSignal: "SIGKILL" }),
|
|
52
53
|
});
|
|
53
54
|
// Collect chunks and join once: repeated `s += chunk` is O(n^2) for the
|
|
54
55
|
// large rendered prompts some capture-mode callers stream through here.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"python-helper.mjs","sourceRoot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QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACzC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;YAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;SAC5C,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,EAAoB;IAC3E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CACvE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectRecordSecrets(content: string): Promise<string[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { getPackageRoot } from "./version.mjs";
|
|
5
|
+
function compileRecordSecretPattern(value) {
|
|
6
|
+
if (typeof value !== "object" || value === null ||
|
|
7
|
+
!("pattern" in value) || typeof value.pattern !== "string" || !value.pattern ||
|
|
8
|
+
!("label" in value) || typeof value.label !== "string" || !value.label) {
|
|
9
|
+
throw new Error("Invalid record secret pattern");
|
|
10
|
+
}
|
|
11
|
+
return [new RegExp(value.pattern), value.label];
|
|
12
|
+
}
|
|
13
|
+
export async function detectRecordSecrets(content) {
|
|
14
|
+
const root = getPackageRoot();
|
|
15
|
+
const sourcePath = join(root, "schemas", "record-secret-patterns.json");
|
|
16
|
+
const policyPath = existsSync(sourcePath)
|
|
17
|
+
? sourcePath
|
|
18
|
+
: join(root, "runtime", "schemas", "record-secret-patterns.json");
|
|
19
|
+
const policy = JSON.parse(await readFile(policyPath, "utf8"));
|
|
20
|
+
if (typeof policy !== "object" || policy === null ||
|
|
21
|
+
!("schemaVersion" in policy) || policy.schemaVersion !== 1 ||
|
|
22
|
+
!("patterns" in policy) || !Array.isArray(policy.patterns) || !policy.patterns.length) {
|
|
23
|
+
throw new Error(`Invalid record secret policy: ${policyPath}`);
|
|
24
|
+
}
|
|
25
|
+
const patterns = policy.patterns.map(compileRecordSecretPattern);
|
|
26
|
+
return [...new Set(patterns.filter(([pattern]) => pattern.test(content)).map(([, label]) => label))];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=record-secrets.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-secrets.mjs","sourceRoot":"","sources":["../../src/lib/record-secrets.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,SAAS,0BAA0B,CAAC,KAAc;IAChD,IACE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO;QAC5E,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,EACtE,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC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0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-language-tag.mjs","sourceRoot":"","sources":["../../src/lib/report-language-tag.mts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveReportLanguage(projectRoot: string): Promise<string>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { projectJsonPath } from "./okstra-dirs.mjs";
|
|
5
|
+
import { isReportLanguageTag } from "./report-language-tag.mjs";
|
|
6
|
+
import { readBoundedUtf8 } from "./bounded-file.mjs";
|
|
7
|
+
import { InputLimitError } from "./input-limit.mjs";
|
|
8
|
+
const MAX_REPORT_LANGUAGE_CONFIG_BYTES = 256 * 1024;
|
|
9
|
+
async function readReportLanguage(path, label) {
|
|
10
|
+
let text;
|
|
11
|
+
try {
|
|
12
|
+
const stat = await fs.stat(path);
|
|
13
|
+
if (!stat.isFile())
|
|
14
|
+
return "";
|
|
15
|
+
text = await readBoundedUtf8(path, MAX_REPORT_LANGUAGE_CONFIG_BYTES);
|
|
16
|
+
}
|
|
17
|
+
catch (cause) {
|
|
18
|
+
if (cause instanceof InputLimitError)
|
|
19
|
+
throw cause;
|
|
20
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT")
|
|
21
|
+
return "";
|
|
22
|
+
throw new Error(`${label} config is unreadable: ${path}`, { cause });
|
|
23
|
+
}
|
|
24
|
+
let value;
|
|
25
|
+
try {
|
|
26
|
+
value = JSON.parse(text);
|
|
27
|
+
}
|
|
28
|
+
catch (cause) {
|
|
29
|
+
throw new Error(`${label} config is unreadable: ${path}`, { cause });
|
|
30
|
+
}
|
|
31
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
32
|
+
throw new Error(`${label} config must be a JSON object: ${path}`);
|
|
33
|
+
}
|
|
34
|
+
const language = "reportLanguage" in value ? value.reportLanguage : undefined;
|
|
35
|
+
if (language === undefined || language === null || language === "")
|
|
36
|
+
return "";
|
|
37
|
+
if (!isReportLanguageTag(language)) {
|
|
38
|
+
throw new Error(`${label} config reportLanguage must be a language tag: ${path}`);
|
|
39
|
+
}
|
|
40
|
+
return language;
|
|
41
|
+
}
|
|
42
|
+
export async function resolveReportLanguage(projectRoot) {
|
|
43
|
+
const home = process.env.OKSTRA_HOME || join(homedir(), ".okstra");
|
|
44
|
+
const candidates = await Promise.all([
|
|
45
|
+
readReportLanguage(projectJsonPath(projectRoot), "project"),
|
|
46
|
+
readReportLanguage(join(home, "config.json"), "global"),
|
|
47
|
+
]);
|
|
48
|
+
return candidates.find(Boolean) || "en";
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=report-language.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-language.mjs","sourceRoot":"","sources":["../../src/lib/report-language.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,gCAAgC,GAAG,GAAG,GAAG,IAAI,CAAC;AAEpD,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,KAAa;IAC3D,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QAC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AAQ,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,kDAAkD,IAAI,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,WAAmB;IAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnC,kBAAkB,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC;QAC3D,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,QAAQ,CAAC;KACxD,CAAC,CAAC;IACH,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AAC1C,CAAC"}
|
|
@@ -15,6 +15,7 @@ export const USER_SKILL_NAMES = Object.freeze([
|
|
|
15
15
|
"okstra-pr-gen",
|
|
16
16
|
"okstra-user-response",
|
|
17
17
|
"okstra-code-review",
|
|
18
|
+
"okstra-tdd",
|
|
18
19
|
"okstra-explain-flow",
|
|
19
20
|
]);
|
|
20
21
|
// Names okstra used to install as skills before they were renamed or moved
|
|
@@ -43,6 +44,8 @@ export const OBSOLETE_SKILL_NAMES = Object.freeze([
|
|
|
43
44
|
"okstra-logs",
|
|
44
45
|
"okstra-report-finder",
|
|
45
46
|
"okstra-time-summary",
|
|
47
|
+
// Renamed to okstra-tdd.
|
|
48
|
+
"okstra-trace",
|
|
46
49
|
]);
|
|
47
50
|
export function userSkillNames() {
|
|
48
51
|
return [...USER_SKILL_NAMES];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-catalog.mjs","sourceRoot":"","sources":["../../src/lib/skill-catalog.mts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,8CAA8C;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,qBAAqB;IACrB,eAAe;IACf,sBAAsB;IACtB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAC;AAEH,2EAA2E;AAC3E,8EAA8E;AAC9E,+EAA+E;AAC/E,oCAAoC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,QAAQ;IACR,uBAAuB;IACvB,sBAAsB;IACtB,oBAAoB;IACpB,sBAAsB;IACtB,yBAAyB;IACzB,kBAAkB;IAClB,wBAAwB;IACxB,cAAc;IACd,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,sEAAsE;IACtE,0EAA0E;IAC1E,gEAAgE;IAChE,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,sBAAsB;IACtB,qBAAqB;
|
|
1
|
+
{"version":3,"file":"skill-catalog.mjs","sourceRoot":"","sources":["../../src/lib/skill-catalog.mts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,8CAA8C;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,qBAAqB;IACrB,eAAe;IACf,sBAAsB;IACtB,oBAAoB;IACpB,YAAY;IACZ,qBAAqB;CACtB,CAAC,CAAC;AAEH,2EAA2E;AAC3E,8EAA8E;AAC9E,+EAA+E;AAC/E,oCAAoC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,QAAQ;IACR,uBAAuB;IACvB,sBAAsB;IACtB,oBAAoB;IACpB,sBAAsB;IACtB,yBAAyB;IACzB,kBAAkB;IAClB,wBAAwB;IACxB,cAAc;IACd,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,sEAAsE;IACtE,0EAA0E;IAC1E,gEAAgE;IAChE,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,sBAAsB;IACtB,qBAAqB;IACrB,yBAAyB;IACzB,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,CAAC,GAAG,oBAAoB,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/lib/types.d.mts
CHANGED
|
@@ -93,7 +93,8 @@ export interface PythonModuleOptions {
|
|
|
93
93
|
readonly module: string;
|
|
94
94
|
readonly args?: CliArgs;
|
|
95
95
|
readonly extraEnv?: Readonly<Record<string, string | undefined>>;
|
|
96
|
-
readonly stdio?: "capture" | "inherit-stdout";
|
|
96
|
+
readonly stdio?: "capture" | "inherit-stdout" | "ignore";
|
|
97
|
+
readonly timeoutMs?: number;
|
|
97
98
|
}
|
|
98
99
|
export interface InstalledScriptOptions {
|
|
99
100
|
readonly scriptName: string;
|
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# Storage model & on-disk contracts
|
|
2
2
|
|
|
3
|
+
새 `improvement-discovery` 실행은 실행 매니페스트에 `coverageCensusPolicy: "resolved-lenses-v1"`을 기록합니다. 준비 단계의 분석 자료는 관점 확정을 기다리는 상태이며, 최초 분석자 지침을 발행하기 전에 질문 기록의 `## Resolved lenses` 목록에서 1~4개 고유 관점을 읽습니다. 실행 준비와 같은 작업 잠금 안에서 범위표와 분석 자료를 완성하고, 범위표에 질문 기록·관점과 완성 전후 분석 자료의 내용 지문을 보존합니다. 셀 식별자와 범위표 파일 경로는 기존 계약을 사용합니다.
|
|
4
|
+
|
|
5
|
+
공통 초기 지침과 네이티브 `agent-prompt materialize`는 단계 소유 `resolved_census.prepare_resolved_lens_census()`를 공유합니다. 이후 호출은 저장된 지문과 셀 집합을 확인하여 재사용하고, 범위표 저장 뒤 분석 자료 쓰기가 중단된 경우에만 같은 입력으로 완성합니다. 이미 발행한 지침이나 변경된 근거가 있으면 준비물을 재생성하지 않습니다. 정책 필드가 없는 기존 실행은 기존 범위표를 유지합니다. 관련 준비·배송·재시도 검사는 `tests/run/test_prepare.py`에 있으며, 셀 미응답의 경고 정책과 보고서 `lensCoverage`의 검사 범위는 변경하지 않습니다.
|
|
6
|
+
|
|
7
|
+
Implementation Traces keep version-1 JSON frontmatter in `.okstra/traces/`.
|
|
8
|
+
Optional `task` metadata binds an attempt to a project task key. The task manifest
|
|
9
|
+
retains `executionKind: "implementation-trace"`, `implementationTracePath`,
|
|
10
|
+
`traceMetadata`, `traceDigest` and a bounded `implementationTraces` list. Latest
|
|
11
|
+
selection uses numeric creation time and path; delayed older attempts cannot
|
|
12
|
+
replace it. `latestWorkRecordPath` still names task-local direct-work JSON with
|
|
13
|
+
`crossVerification: "not-performed"`, preserving its previous-record chain.
|
|
14
|
+
Task mutex filenames hash the project identity and normalized group/task
|
|
15
|
+
segments, so aliases serialize together and long keys fit the filesystem.
|
|
16
|
+
Preparation and trace projection hold that mutex throughout manifest mutation.
|
|
17
|
+
Trace publication and task projection are separate recoverable operations;
|
|
18
|
+
`trace sync` retries projection and status reads its digest acknowledgment.
|
|
19
|
+
`trace_tasks.py` enforces these boundaries; `tests/run/test_trace_tasks.py` and
|
|
20
|
+
`tests/run/test_prepare.py` verify retries, ownership and preservation.
|
|
21
|
+
|
|
22
|
+
Verification inputs version `3.0` requires `reviewPolicy`: a versioned frozen
|
|
23
|
+
architecture declaration and source bodies with SHA-256 digests. Preparation
|
|
24
|
+
captures the coding-preflight pack, project-root `AGENTS.md` and `CLAUDE.md`,
|
|
25
|
+
declared absolute `reviewRulePacks` paths, and their local `references/*.md`
|
|
26
|
+
links. Unreadable declarations fail capture before the snapshot is published.
|
|
27
|
+
Workers consume the content through `model-io verification-input`; source paths
|
|
28
|
+
record provenance rather than replacing the frozen baseline. Input versions
|
|
29
|
+
`1.0` and `2.0` retain their existing read contracts. Enforcement is in
|
|
30
|
+
`verification_inputs.py` and `review_policy.py`; preparation regression cases
|
|
31
|
+
in `tests/run/test_prepare.py` verify source preservation and rejected inputs.
|
|
32
|
+
|
|
33
|
+
Verification-input reader version `4.0` additionally requires the pre-execution
|
|
34
|
+
`reviewBase` and approved plan. Its implementation generations capture a
|
|
35
|
+
`designReview` census, policy fingerprint and any manual function inventory.
|
|
36
|
+
`agent/invocation.py` appends the same sealed worklist to initial and subsequent
|
|
37
|
+
verifier prompts. `design_review.py` parses independent responses against that
|
|
38
|
+
baseline through the same grouped-rule parser used by standalone code review.
|
|
39
|
+
New implementation and final-verification preparations with an approved plan
|
|
40
|
+
produce version `4.0`. They require stable QA command IDs and a valid conformance
|
|
41
|
+
baseline. Planning retains version `3.0`; its architecture validator reads the
|
|
42
|
+
captured declaration. Existing versions are not retrofitted on resume.
|
|
43
|
+
|
|
44
|
+
For a language without the existing Python AST census, capture writes
|
|
45
|
+
`generation-N.functions.json` beside the pending generation and refuses dispatch.
|
|
46
|
+
The lead fills `files[path]` with `functions: [{start, end, name}]` and a nonblank
|
|
47
|
+
`rationale` describing the whole-file inventory. Empty functions require that
|
|
48
|
+
rationale too. The base/head and unresolved-file set must match; spans must fit
|
|
49
|
+
the frozen source. Range validation does not prove semantic completeness of a
|
|
50
|
+
manual inventory. Named Python test helpers receive semantic cells as well as
|
|
51
|
+
the test file's state-and-tests cell. `tests/verification/test_design_review.py`
|
|
52
|
+
checks rule omissions, finding linkage, stale baselines and manual inventory.
|
|
53
|
+
|
|
54
|
+
`design_review_evidence.py` authenticates each configured verifier's current
|
|
55
|
+
invocation, latest attempt, generation and sealed result bytes. Assembly owns
|
|
56
|
+
`implementation.verifierResults[].designReview` and derives the verifier verdict
|
|
57
|
+
from that return; the narrative cannot author the evidence or turn FAIL into
|
|
58
|
+
PASS. Current blocking findings and missing required accounting prevent an
|
|
59
|
+
accepted or conditionally accepted publication. Collection errors leave the
|
|
60
|
+
previous report unchanged. Phase validation re-derives the evidence, and
|
|
61
|
+
`stage_done.py` requires the same task, stage, base, head and accepted report
|
|
62
|
+
before writing a carry or completion row.
|
|
63
|
+
|
|
64
|
+
The common `consumers.append_consumer` boundary also checks a new completion
|
|
65
|
+
from `stage-close` or carry recovery. A pending review is not recovered as done.
|
|
66
|
+
Reconciliation rows that adjust an already completed stage retain their existing
|
|
67
|
+
patch/commit reconciliation procedure; they are not a new acceptance decision.
|
|
68
|
+
An older run of the same stage cannot supply its latest completion report.
|
|
69
|
+
|
|
70
|
+
Correction generations inspect the full stage diff again. Prior judgments are
|
|
71
|
+
not inherited because dependency-complete carry attestations are not captured
|
|
72
|
+
by this contract. Earlier findings remain in `history`; every earlier blocking
|
|
73
|
+
finding needs an explicit `Design Carry` disposition and cited basis. Nits,
|
|
74
|
+
parked items and accepted-risk bases remain visible in the report. Final
|
|
75
|
+
verification checks these source implementation reports through its prepared
|
|
76
|
+
target; it does not perform another global style review. Semantic correctness,
|
|
77
|
+
grading and truth of a disposition remain worker/lead judgments. Enforcement is
|
|
78
|
+
in report assembly, implementation validation, stage completion and
|
|
79
|
+
`phases/final_verification/validation.py`; regression owners are
|
|
80
|
+
`tests/verification/test_design_review.py` and `tests/report/test_assembly.py`.
|
|
81
|
+
|
|
3
82
|
> Detailed storage and contract section from [`docs/architecture.md`](../architecture.md). This section was split out after the main document exceeded 1,000 lines.
|
|
4
83
|
|
|
5
84
|
## Storage model
|
|
@@ -18,7 +97,7 @@ The task manifest, task index, instruction set, runs, and history are collected
|
|
|
18
97
|
- `instruction-set/`
|
|
19
98
|
- `analysis-profile.md`, `analysis-packet.md`, `analysis-material.md`, `reference-expectations.md`, `task-brief.md`
|
|
20
99
|
- `verification-target.md` for final verification and optional `directive.txt`
|
|
21
|
-
- `host-orchestration-rules.md
|
|
100
|
+
- `host-orchestration-rules.md` — `implementation`·`implementation-planning`이 선언한 호스트 지침의 동결 사본. wizard는 준비 전에 정본 경로를 반환하고, 준비 후 재개는 이 사본을 사용한다.
|
|
22
101
|
- `clarification-response.md`, the user's carried-in clarification answers, when the run has any
|
|
23
102
|
- `selected-direction.json`, the validated implementation direction snapshot for a new `implementation-planning` run
|
|
24
103
|
- `final-report-schema.json`, `final-report-template.md`
|
|
@@ -408,7 +487,7 @@ Design-preparation storage has three separate authorities:
|
|
|
408
487
|
| `design-prep-inputs/design-prep-input-<seq>-PREP-<NNN>-r<revision>-<uuid>.md` | user or wizard | Append-only and written only after semantic confirmation. Existing revisions are never edited or reserved before confirmation. |
|
|
409
488
|
|
|
410
489
|
The resolver selects the highest unique revision whose assessment fingerprint still matches the approved snapshot. Duplicate revision numbers and stale fingerprints are skipped with warnings rather than granted authority. A markerless legacy plan has no sidecars to migrate: it proceeds with the `legacy-unassessed` warning. This compatibility path does not rewrite its report.
|
|
411
|
-
|
|
490
|
+
최종 결과는 워커 stdout을 그대로 저장해서 만들지 않는다. 작성자는 manifest의 `reportNarrativePath`가 가리키는 소유 입력에 쓰고, Phase 7이 역할별 입력을 결합해 `final-report-<task-type>-<seq>.data.json`을 게시한 뒤 HTML을 만든다. 새 실행의 `json-v1` 입력은 `worker-results/report-writer-narrative-<task-type>-<seq>.json`이며, 기존 `markdown-v1`은 `.md` 경로와 줄 문법을 유지한다. 형식은 확장자가 아닌 manifest로 결정한다. 최종 데이터 스키마는 계속 `3.0`이며, 기존 v1·v2의 호환 판독도 유지한다. 읽기용 Markdown은 `okstra render-final-report`로 필요할 때 생성하며, 렌더링은 원본 데이터를 수정하지 않는다.
|
|
412
491
|
For the standalone Claude launcher, `sessions/claude-resume-<task-type>-<seq>.sh` remains an interruption-recovery compatibility helper. In-host Codex runs use host task continuity plus the generic `leadSession` manifest identity.
|
|
413
492
|
|
|
414
493
|
The resolved run directory collects execution history. It divides its contents into type-specific subdirectories such as `manifests/`, `state/`, `prompts/`, `reports/`, `status/`, `sessions/`, and `worker-results/`, then distinguishes each run-level artifact and result file with a `-<task-type>-<seq>` suffix (a three-digit, zero-padded per-category counter, such as `001` or `002`).
|
|
@@ -471,13 +550,37 @@ and `returnedBody`; the completion marker is published last and binds the
|
|
|
471
550
|
canonical result envelope digest. The same raw returned body may be used by two
|
|
472
551
|
independent invocations because identity comes from the envelope, while a
|
|
473
552
|
cross-invocation envelope link is rejected. Code review uses purpose
|
|
474
|
-
`code-review`; schedule narrative verification uses `schedule-verification
|
|
553
|
+
`code-review`; schedule narrative verification uses `schedule-verification`;
|
|
554
|
+
implementation-trace reviews use `trace-review`.
|
|
475
555
|
Consumers parse only the `returnedBody` emitted by
|
|
476
556
|
`agent-prompt verify-completion`. A branch review's final report may use the
|
|
477
557
|
documented `.project-docs/code-reviews/<branch>/` exception, but its invocation
|
|
478
558
|
specification, result envelope, and completion record remain under `.okstra/`.
|
|
479
559
|
|
|
560
|
+
New standalone code-review invocations also store `<invocation-id>.review-policy.json`
|
|
561
|
+
and `<invocation-id>.review-source.json`. The former binds the fixed base/head,
|
|
562
|
+
assigned canonical census, selected frozen rule bodies and the raw source-baseline
|
|
563
|
+
digest. Its digest appears in the immutable prompt. Shared policy originals are
|
|
564
|
+
archived once beside the full census; invocation selection never rereads live
|
|
565
|
+
installed rule bodies. Explicit resource selections supplement fixed-tree routing.
|
|
566
|
+
The shared policy's optional `authorPolicyDigest` identifies the complete policy
|
|
567
|
+
before protocol and additional-source capture. Reusing a census with an explicit
|
|
568
|
+
author run requires this identity to match exactly; an older shared policy without
|
|
569
|
+
it requires a new census output rather than an inferred match.
|
|
570
|
+
|
|
571
|
+
Completion for these invocations uses `schemaVersion: 2` and adds
|
|
572
|
+
`reviewAuditDigest`, binding `<invocation-id>.review-audit.json`. Publishing it
|
|
573
|
+
requires a successful source/Git comparison; CLI wrappers also require their
|
|
574
|
+
successful execution audit. Historical verification checks the stored audit and
|
|
575
|
+
baseline binding without comparing today's working tree. Older standalone
|
|
576
|
+
completions retain version 1. Source mutation detection is post-execution and
|
|
577
|
+
cannot guarantee prevention or observe arbitrary external side effects.
|
|
578
|
+
|
|
480
579
|
The persisted prompt's `**Worker Preamble Path:**` records the selected functional audience contract: analysis uses `templates/worker-prompt-preamble.md`, implementation executor/verifier uses `templates/implementation-worker-preamble.md`, and report writing uses `templates/report-writer-prompt-preamble.md`. Every initial prompt also persists `**Worker Error Contract Path:** templates/worker-error-contract.md`. A `runner=native-session` prompt additionally persists `**Host Session Contract Path:**`, resolved from the host adapter that declares `workerSessionContract`; the path is carried verbatim in the compact active-run context because it lives in the adapter tree rather than under the okstra home. Active-run and run-context runtime resources expose the same audience map plus the shared error-contract path, so dispatch replay and context-cost accounting do not infer an audience from a provider/model name.
|
|
580
|
+
The shared `Read scope` header owns the read boundary. `Analysis packet reading`
|
|
581
|
+
is emitted only for analysis or implementation workers whose input projection
|
|
582
|
+
lists the primary packet. Evidence headers own ledger syntax; the audience
|
|
583
|
+
preambles point to those headers instead of restating the protocol.
|
|
481
584
|
Unlike before, `analysis-profile.md`, `analysis-material.md`, `reference-expectations.md`, `task-brief.md`, skill copies, and `final-report-template.md` are not duplicated for every run.
|
|
482
585
|
These materials retain canonical copies in `instruction-set/` under the stable task root.
|
|
483
586
|
For `final-verification`, `verification-target.md` is also stable-task instruction-set state. Prepare owns the snapshot and stores its project-relative path plus SHA-256 digest in task/run manifests and active-run context. Initial analysis prompts carry the compact worktree/scope/base/head/path/digest identity and read this sidecar on demand instead of copying its diff stat.
|
|
@@ -534,6 +637,8 @@ The following former files are no longer generated by okstra.
|
|
|
534
637
|
~/.okstra/managers/<manager-id>/
|
|
535
638
|
├── manager.json
|
|
536
639
|
├── projects.json
|
|
640
|
+
├── events.jsonl
|
|
641
|
+
├── journal.jsonl
|
|
537
642
|
├── view/index.html
|
|
538
643
|
└── task-groups/<safe-task-group>/
|
|
539
644
|
├── group.json
|
|
@@ -555,9 +660,14 @@ Storage authority:
|
|
|
555
660
|
- `group.json`: the task group's original name and creation time, written by `new task-group` and `new task`. The directory name is a slug and cannot give the name back.
|
|
556
661
|
- `split-plan.json`: the last tracker split plan `task split` applied. The briefs it produced live in each child project's `.okstra/briefs/`, and the children it registered carry `ticketId`, `briefPath`, `scope` and `recommendedPhase` in `children.json`.
|
|
557
662
|
- `snapshots.json`: a read-side snapshot that `task sync` imports from the child project's `.okstra`. It is not the source of truth for project state.
|
|
558
|
-
-
|
|
663
|
+
- `<manager-id>/events.jsonl`: manager-level events. `manager-initialized` (new manager only), `project-linked` (new registration, or `changes` when an existing registration's root, role or tags changed), `project-unlinked` (with the kept child task keys and the affected manager tasks as `tasks`), `task-group-created` (only when the group directory did not exist yet; a group created before `group.json` existed gets none), and `task-removed` / `task-group-removed` (confirmed removals only, with the deleted task keys or task ids; `task-group-removed` names the group as stored, not as typed). Dry runs and identical re-runs write nothing.
|
|
664
|
+
- `<safe-task-id>/events.jsonl`: task-level events `task-created`, `task-children-added`, `task-updated`, `task-assigned` (changed role, tags or assignment as `from`/`to`), `task-synced` (children whose `task status` summary bucket changed since the previous snapshot, as `taskKey`/`from`/`to`; `from` is null without a previous snapshot or when it is damaged, which `task sync` reports on stderr before replacing it), `task-child-removed`, `project-unlinked`, `task-split` and `child-launch-prepared`. An assignment or sync that changes nothing writes no row. `remove task` and `remove task-group` delete the directory with its events; the manager-level `task-removed` / `task-group-removed` row remains.
|
|
665
|
+
- Event rows carry `event` and `createdAt` and do not copy directive bodies. They are appended after the state file is saved. A failed append leaves the command successful and prints `okstra manager: activity log write failed: <path>: <reason>` to stderr.
|
|
666
|
+
- `okstra manager log` merges both event files, `directives.jsonl` and `journal.jsonl` newest first. `--json` returns `{managerId, matchedCount, entries, damaged}`; each entry has `origin` (`manager-event`, `task-event`, `directive` or `journal`), `kind` (event name, `directive`, or the journal kind), `createdAt`, `taskGroup`, `taskId` and the stored object as `row`. Entries with the same `createdAt` come in reverse read order: later lines of one file first, and files read later (manager events, then each task's events and directives in task order, then the journal) first. `--task-group` / `--task-id` also selects manager-level rows and journal entries that name the task, so removals and unlinks stay visible after the task is deleted. `--grep` matches the body of directives and journal entries and the string values of events. `--open-followups` keeps only followups that no journal row resolves. It is read-only, reads task identities from manifests only, skips damaged lines and reports their line numbers per file.
|
|
667
|
+
- `journal.jsonl`: the manager-only journal written by `okstra manager journal add`. Each row is `{id, kind, body, createdAt, taskGroup, taskId, resolves}`; `id` is `j-<UTC stamp>-<4 hex digits>`, `kind` is `decision`, `finding`, `followup` or `session-summary`, `taskGroup`/`taskId` are both empty or hold the manifest's names of an existing manager task (another spelling with the same slug is stored as the manifest spells it), and `resolves` is empty or the id of an unresolved followup of the same manager. The body comes from `--body` or from a UTF-8 file given as `--body-file`; it must be non-empty, at most 4,000 characters and pass the record secret policy; a refused entry or a failed append exits 2 and writes nothing. `task run` does not read this file. doyouknow collects it as its own source under the manager (native id `journal`); a damaged journal reports `manager-journal-damaged` and an unreadable or oversized one `manager-journal-unavailable`, and the root and task sources still register.
|
|
668
|
+
- `okstra manager resume` is read-only. It reports the last `session-summary` entry, the number of entries listed before it in the `log` order (`Unsummarized activity`), open followups oldest first, the five most recent decisions, the newest `--recent` entries, and for each task the `task status` sync time, sync age, changed-since-sync count and unlinked child count; a task whose files cannot be read reports its `error` instead, and the rest is still printed. `--task-group` / `--task-id` given as empty strings are refused by `log` and `journal add`.
|
|
559
669
|
- `child-context/*.md`: child lead context prepared by `task run`. Sibling project reports/snapshots are passed only as read-side source material.
|
|
560
|
-
- `view/index.html`: the page `okstra manager view` writes from the files above. It is a derived view, rewritten on every run; it does not read child projects, so it shows each task as of its last `task sync`.
|
|
670
|
+
- `view/index.html`: the page `okstra manager view` writes from the files above, including open followups and manager-level events. It is a derived view, rewritten on every run; it does not read child projects, so it shows each task as of its last `task sync`.
|
|
561
671
|
|
|
562
672
|
Path segments are normalized into slugs. If a slug would be empty, as can happen with non-ASCII values, a `u-<sha1-prefix>` fallback segment is used. However, `manifest.json` and the child `taskKey` preserve the original input values (`project-id:task-group:task-id`).
|
|
563
673
|
|
|
@@ -648,6 +758,10 @@ The rendered `task-index.md` is an English-literal artifact. The headings, field
|
|
|
648
758
|
|
|
649
759
|
Each execution records the current run contract in the resolved `<run-dir>/manifests/run-manifest-<task-type>-<seq>.json`. The non-stage or stage-qualified rule above determines `<run-dir>`.
|
|
650
760
|
|
|
761
|
+
새 3.0 실행은 `reportAuthoringFormat: "json-v1"`·`usageAccountingPolicy: "advisory"`를 준비 시 기록한다. 각 필드가 없는 기존 실행은 각각 `markdown-v1`·`strict`로 읽는다. 이 두 필드는 결과 보고서의 `schemaVersion`이나 `reportContractVersion: "3.0"`을 변경하지 않는다. 알 수 없는 형식·정책은 거부하며, 기존 manifest·승인·digest를 일괄 변환하지 않는다. compact context의 `pathHints`에도 선언을 보존해 복원 시 기존 입력 확장자와 정책을 유지한다.
|
|
762
|
+
|
|
763
|
+
`advisory`에서 확인된 사용량 부재는 보고서에 `null`과 원인 진단으로 투영한다. 수집기의 원래 합계·출처·note는 team-state에 보존한다. 게시 후 재수집 결과는 team-state에만 반영하고 `data.json`·HTML을 다시 쓰지 않는다. 실제 실행·검증·generation·봉인·승인 근거가 누락되거나 변조된 경우의 차단은 사용량 정책과 별개로 유지한다.
|
|
764
|
+
|
|
651
765
|
`manifests/run-context-<task-type>-<seq>.json`, starting with schemaVersion `2.0`, stores `identity` + `pathHints` rather than directly storing every legacy path key. The host-side reader hydrates `pathHints` to reconstruct the former flat keys (`RUN_MANIFEST_RELATIVE_PATH`, `TEAM_STATE_PATH`, and so on) in memory.
|
|
652
766
|
|
|
653
767
|
`state/active-run-context-<task-type>-<seq>.json` is also the compact intake for lead Phase 1 starting with schemaVersion `2.0`. It stores only `identity` + `pathHints` and worker identities instead of repeated path strings, and the deterministic dispatcher hydrates it into the legacy active context shape when reading it.
|
|
@@ -764,3 +878,47 @@ Business artifacts use the original project root even when source inspection tar
|
|
|
764
878
|
- `.okstra/agent-invocations/explain-flow/`: frozen investigator prompt, role/duty snapshots, assignment metadata, process log/status, result envelope and verified completion.
|
|
765
879
|
|
|
766
880
|
The JSON boundary validates artifact schemas and atomically replaces files. Directory locks merge concurrent knowledge contributions and task links. Claims found in another project's knowledge store retain that owner; lookup does not copy them into another canonical store. A retry creates another execution id, and the original baseline and reports remain available.
|
|
881
|
+
|
|
882
|
+
## Linked work records
|
|
883
|
+
|
|
884
|
+
`okstra doyouknow` owns `<okstra-home>/doyouknow/graph.sqlite3`, independent of a
|
|
885
|
+
project or run. It stores scoped record and node identities, immutable revisions,
|
|
886
|
+
source references, evidence-bearing relations, and request identities. A write
|
|
887
|
+
uses one SQLite transaction; retries reuse their recorded result, while new
|
|
888
|
+
revisions check the expected previous revision. Lookup opens existing storage
|
|
889
|
+
read-only. `schemas/doyouknow-v1.schema.json` defines normalized write inputs.
|
|
890
|
+
|
|
891
|
+
Existing `memory-book/` notes, manager state, task artifacts, and shared business
|
|
892
|
+
knowledge retain their current owners. Explicit `sync` collects memory, manager
|
|
893
|
+
and manager-registered project task references; `list` reads current projections.
|
|
894
|
+
Native memory and manager writes request registration after their original save;
|
|
895
|
+
failures preserve identity-only pending UUIDs separately from SQLite. The
|
|
896
|
+
`pending/`, `registrations/` and `refusals/` directories under `doyouknow/` hold
|
|
897
|
+
delivery references, bounded attempt state and refusal fingerprints respectively.
|
|
898
|
+
Per-source locks serialize preparation and delivery, and acknowledgment removes
|
|
899
|
+
only the processed UUID. `preparationAttempts` records admitted preparation before
|
|
900
|
+
source I/O, independently of the fingerprint's delivery `attempts`. Three
|
|
901
|
+
incomplete preparations stop automatic work until explicit synchronization;
|
|
902
|
+
completed preparation resets that counter. Old state files without the preparation
|
|
903
|
+
counter read as zero. Excluded sources restore their prior delivery state.
|
|
904
|
+
Retry batches order references by modification time and UUID, then update only
|
|
905
|
+
an unsuccessful processed reference's modification time to let other work proceed.
|
|
906
|
+
Full synchronization combines pending recovery with
|
|
907
|
+
original-source comparison. `schemas/memory-entry-contract-v1.json`
|
|
908
|
+
owns entry fields and allowed type/status values for both Memory Book and its Python
|
|
909
|
+
collector. Collection distinguishes unreadable bodies, secret refusal and invalid
|
|
910
|
+
projections without copying source content into diagnostics.
|
|
911
|
+
The shared `schemas/record-secret-patterns.json` keeps the existing
|
|
912
|
+
memory rejection patterns available to both record writers. Its canonical digest
|
|
913
|
+
participates in source fingerprints so policy changes invalidate cached refusals.
|
|
914
|
+
Read-only collection and persistent refusal recording share the same pure
|
|
915
|
+
snapshot validator. Manager collection and automatic registration share one
|
|
916
|
+
acceptance policy: a refused manager root makes its domain unavailable, while a
|
|
917
|
+
refused task preserves healthy task updates and leaves the scan partial.
|
|
918
|
+
|
|
919
|
+
Database version 2 adds `source`, immutable `source_snapshot`, and source-owned
|
|
920
|
+
`source_relation` tables alongside the manual record tables. The same transaction
|
|
921
|
+
boundary serializes both writers. Upgrading version 1 first creates a mode-0600
|
|
922
|
+
`graph-v1-*.sqlite3` backup with a bounded backup deadline. Read-only lookup does
|
|
923
|
+
not migrate storage. `doyouknow/config.json` owns collection settings independently
|
|
924
|
+
of existing groups; incomplete scans preserve prior source data and confirmation times.
|
package/docs/architecture.md
CHANGED
|
@@ -163,6 +163,8 @@ Runtime entry points are consolidated in Python packages. Bash and skills only c
|
|
|
163
163
|
- Installation location: `~/.claude/skills/<name>/SKILL.md` or `~/.agents/skills/<name>/SKILL.md`.
|
|
164
164
|
- Release procedure: [`../../RELEASING.md`](../RELEASING.md) — npm publish flow and release-please / manual fallback.
|
|
165
165
|
|
|
166
|
+
새 코딩 정책 캡처에서는 함수의 줄별 영어 설명 검사를 사용하지 않는다. 함수 길이·중첩·숫자 자체는 검토 신호이며, 실제 오류·명시적 프로젝트 규칙 위반·구체적 설계 또는 유지보수 영향이 지적의 근거다. 변경한 핵심 동작과 실패 결과를 기존 테스트로 검증하고 필요할 때 선택적 변이를 수행한다. 프로젝트가 별도로 요구한 검사, 규칙별 판정표·증거·봉인과 이미 동결된 정책은 유지한다.
|
|
167
|
+
|
|
166
168
|
## Architecture: python authority + thin callers
|
|
167
169
|
|
|
168
170
|
okstra's prepare stage follows an on-disk authority + single Python entry-point model. This design satisfies two goals simultaneously.
|
|
@@ -198,6 +200,13 @@ Owned-object writes validate the complete replacement value before publication.
|
|
|
198
200
|
|
|
199
201
|
External JSON enters only through a purpose-specific adapter that validates its producer lane and path policy. The supported exceptions are user-supplied files outside `.okstra`, worker result lanes, Claude Code configuration, external-tool output inside its workspace, legacy error sidecars, and convergence results beside their state file. The sealed `ExternalJsonSource` type prevents a caller from granting itself a generic exception.
|
|
200
202
|
|
|
203
|
+
Both owned and external JSON readers accept an optional pre-parse byte limit.
|
|
204
|
+
Read-only task discovery uses `okstra_project.resolve_task_root_read_only`;
|
|
205
|
+
`find_task_root` retains its existing reconciliation behavior. Shared contained
|
|
206
|
+
path resolution lives in `okstra_project.dirs.contained_relative_path`.
|
|
207
|
+
Callers with an already validated catalog can supply it to the resolver,
|
|
208
|
+
avoiding another unbounded read of the same input.
|
|
209
|
+
|
|
201
210
|
Model callers receive fixed text projections instead of parsing owned objects. `okstra model-io` owns inspect projections, and `okstra preflight` renders named success or failure lines by default. A failure projection includes its stage, observed reason, and recovery action. Automation can request the unchanged preflight object with `--machine`; `--json` remains a deprecated one-release alias. A model-facing caller should rerun the named recovery action and then rerun the text command rather than opening the JSON artifact directly.
|
|
202
211
|
|
|
203
212
|
### State authority on disk
|
|
@@ -365,7 +374,7 @@ The complete artifact lifecycle is: worker results → Round 0 grouping → redu
|
|
|
365
374
|
|
|
366
375
|
Cross-verification does not mean that worker A reviews worker B's entire result. Round 0 records multi-source agreement immediately, and the reducer asks independent analyser instances to vote only on single-source or still-unresolved findings selected in the persisted queue. The report writer is never a voter. It organizes the validated result, while the later plan-body round verifies the consolidated `P-*` plan items rather than reopening the `F-*` finding queue.
|
|
367
376
|
|
|
368
|
-
|
|
377
|
+
리더는 묶은 입력을 `okstra convergence seed`, `plan-round`, `apply-round`, 선택적 `apply-critic-gaps`, `finalize`, `validate`로 진행한다. 각 워커의 재검증 묶음에서는 그 워커가 낸 지적을 제외하며, 해결된 지적은 큐에서 제거한다. 경량 재검증은 현재 묶음과 내장 근거만 받고, 태스크·단계 경계와 `verification-error`·`UNVERIFIABLE` 처리는 그대로 유지한다. 보고서 작성자는 투표하지 않고 검증된 수렴 결과와 모든 분석 결과를 읽는다. 계약 3.0에서는 선언된 형식의 작성자 입력, 포인터와 audit sidecar만 작성한다. 승인·활동·실행·수렴·설계 준비·계획 본문 검증 값은 각 소유자의 입력에 남고, Phase 7이 이를 검증해 `data.json`을 원자적으로 게시한다. 읽기용 Markdown은 요청 시 렌더링한다. 새 수렴 결과는 schema v1.4이며, 기존 v1.0–v1.3 결과의 호환 판독과 원본 보존도 유지한다.
|
|
369
378
|
|
|
370
379
|
Coverage critic and plan-body verification remain separate from finding convergence. The critic audits the integrated Round 0 analysis, while implementation-planning's plan-body gate validates the later report draft through its own `P-*` queue and state file. Neither path changes the engine's `F-*` queue.
|
|
371
380
|
|
|
@@ -800,7 +809,7 @@ The default for an `implementation-planning` clarification rerun is **full re-ve
|
|
|
800
809
|
|
|
801
810
|
```bash
|
|
802
811
|
okstra incremental-scope --prev-data <prev data.json> --cur-base-sha <sha> --prev-base-sha <sha> --impacted 2,3
|
|
803
|
-
okstra incremental-carry --prev-data <prev data.json> --cur-narrative <
|
|
812
|
+
okstra incremental-carry --run-manifest <run-manifest> --prev-data <prev data.json> --cur-narrative <current writer input> --state <cur plan state.json> --prev-seq <prev-seq> --carry-stages <csv> --reverify-stages <csv> --out-state <cur plan state.json>
|
|
804
813
|
```
|
|
805
814
|
|
|
806
815
|
When `mode == "incremental"`, worker dispatch is narrowed to `reverify_stages` (see *Cross-verification mode* in `scripts/okstra_ctl/phases/implementation_planning/profile.md`), and workers do not reopen or rejudge `carry_stages`. The report writer preserves carried stage rows in its narrative. After plan-item seeding, `okstra incremental-carry` verifies those rows and copies their previous `P-Step-*` and `P-Prep-*` verdicts, plus unchanged `P-Val-*` / `P-Req-*` / `P-Rb-*` rows, into the convergence-owned state with a `carriedForwardFromSeq` tag. It exits nonzero on a changed or omitted carried stage, missing item, or conflicting scope and falls back to full. If a reverified stage concludes that a plan item must be **deleted**, that indicates nonlocal impact and likewise triggers a full rerun. `verdictCard` / `finalVerdict` are never carried and are recomputed on every run.
|
|
@@ -894,7 +903,9 @@ Resume decision rules:
|
|
|
894
903
|
|
|
895
904
|
## Final report structure
|
|
896
905
|
|
|
897
|
-
|
|
906
|
+
새 태스크도 final-report 데이터 계약은 `schemas/final-report-v3.0.schema.json`의 `3.0`을 유지한다. 작성자는 `humanSummary`와 태스크별 허용 필드를 manifest가 선언한 입력에 작성한다. 새 실행은 `reportAuthoringFormat: "json-v1"`과 `.json` 경로를 사용하며, 설명 문자열 안에는 일반 Markdown을 쓸 수 있다. 형식 필드가 없는 기존 실행은 `markdown-v1` 줄 문법과 기존 `.md` 경로를 유지한다. 확장자나 내용으로 형식을 추측하지 않으며, 알 수 없는 형식은 오류다. 보고서 조립기는 기계 소유 입력을 결합해 `data.json`을 원자적으로 게시하고, 두 렌더러가 이를 독립적으로 소비한다. 기존 v1·v2 보고서의 호환 판독도 유지한다.
|
|
907
|
+
|
|
908
|
+
`reportNarrativePath`라는 manifest 키는 두 형식에서 그대로 사용한다. 작성자 입력의 최상위·중첩 소유권과 스키마·태스크 계약을 검사하며, JSON을 작성할 수 있다는 이유로 승인·실행 증거·수렴·사용량 같은 기계 소유 값을 작성할 권한이 생기지는 않는다. 준비 시 형식과 경로를 고정하고 compact context에도 보존하므로, 재개 시 최신 설치본의 기본값으로 바꾸지 않는다.
|
|
898
909
|
|
|
899
910
|
- `templates/reports/final-report-v2.template.md` produces the full reading copy Markdown spine in a fixed order: handoff summary, decision context, next-task contract, clarifications, evidence ledger, one task deliverable, cross-verification audit, execution audit, and token/cost audit. The task deliverable body comes from `templates/reports/md/tasks/<task-type>.template.md`, the Markdown sibling of the HTML task template below. Human narrative fields are excluded from this artifact.
|
|
900
911
|
- Section bodies are rendered as Markdown — headings, tables for uniform row sets, prose for narrative fields — by `scripts/okstra_ctl/report_markdown.py`, never serialized as JSON. Field order within a section comes from the record's versioned schema, whose properties are authored in reading order (a decision draft reads `context → decision → consequences`).
|
|
@@ -982,7 +993,9 @@ Errors that occur while provider workers, the report writer, or the Okstra lead
|
|
|
982
993
|
|
|
983
994
|
## Token usage and cost accounting
|
|
984
995
|
|
|
985
|
-
|
|
996
|
+
각 실행의 사용량은 리더·워커 세션 기록에서 수집해 team-state의 `leadUsage`·`workers[].usage`에 저장한다. 새 실행은 manifest에 `usageAccountingPolicy: "advisory"`를 고정하며, 필드가 없는 기존 실행은 `strict`를 유지한다. 정책을 모르는 값은 오류이며, 재개 시 기존 정책을 새 기본값으로 바꾸지 않는다.
|
|
997
|
+
|
|
998
|
+
`advisory`에서는 수집을 수행한 뒤 세션 부재·CLI 청구량 부재처럼 원인이 확인된 부재를 진단으로 기록한다. 수집기의 기존 카운터는 유지하고, 보고서를 조립할 때 미수집 값과 불완전 합계를 `null`로 투영한다. 그 부재만으로 실제 작업 검증을 실패시키지는 않는다. 수집 생략, 잘못된 수치, 모호한 세션 귀속이나 예상하지 못한 집계 오류는 계속 오류로 남는다. 수집기·보고서 투영·`validate-run`은 같은 정책을 사용한다. 이미 게시한 실행을 재수집하면 결과를 team-state에 보존하고 advisory로 알리며, 게시된 `data.json`·HTML과 digest는 바꾸지 않는다. `strict` 실행은 기존 판정과 갱신 경로를 유지한다.
|
|
986
999
|
|
|
987
1000
|
- Helper CLI: `scripts/okstra-token-usage.py`
|
|
988
1001
|
- Collection sources:
|