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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Spaider.code-workspace
.bootstrap/.plans/implement-thin-orchestrator-workflows/
.bootstrap/.plans/implement-shared-context-pack-pdsl-migration/
.bootstrap/.plans/audit-studio-prompts/
.bootstrap/.plans/pdsl-semantic-reuse-refactor/

# Artifacts
.prs/*
Expand Down
2 changes: 1 addition & 1 deletion architecture/specs/PDSL.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ dispatch. Do not assume inline fallback just because the user did not answer.
PDSL:

```pdsl
UNIT SubAgentApprovalGate
UNIT ExampleSubAgentApprovalGate

PURPOSE:
Resolve whether this workflow may use native sub-agents.
Expand Down
17 changes: 8 additions & 9 deletions architecture/specs/sysprompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,16 @@ PURPOSE:
Define project sysprompt surfaces as prompt assets with controller-owned
loading authority.

DO:
- LOAD {cf-studio-path}/.core/workflows/shared/shared-context-pack-ownership.md
- CONTINUE SharedContextPackOwnership

RULES:
- ALWAYS `{cf-studio-path}/config/AGENTS.md` and
`{cf-studio-path}/config/sysprompts/*.md` are prompt assets when used as
operating instructions
- ALWAYS A dispatching controller may load those prompt assets from disk
- ALWAYS When loaded into `SHARED_CONTEXT_PACK`, those assets ALWAYS be recorded with
`origin = "project"`
- ALWAYS Prompt-consuming sub-agents ALWAYS receive the selected prompt text through
the controller-synthesized final dispatch prompt
- ALWAYS Prompt-consuming sub-agents NEVER reopen project sysprompt files
directly from disk
`{cf-studio-path}/config/sysprompts/*.md` remain the project prompt-asset
family for this shared ownership contract
- ALWAYS When loaded into `SHARED_CONTEXT_PACK`, those assets ALWAYS be
recorded with `origin = "project"`
```

```pdsl
Expand Down
15 changes: 8 additions & 7 deletions requirements/auto-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ WHEN:
- REQUIRE auto-config intent or brownfield setup intent is detected

DO:
- REQUIRE this methodology is active
- REQUIRE controller has loaded `{cf-studio-path}/.core/requirements/reverse-engineering.md`
- REQUIRE controller has loaded `{cf-studio-path}/.core/requirements/prompt-engineering.md`
- SET AUTO_CONFIG_MODE = true
- SET ACTIVATION_INTENT = auto_config_or_brownfield_setup
- SET ACTIVATION_REQUIRED_PROMPT_ASSETS = auto_config_runtime_assets
- SET ACTIVATION_MODE_FLAG = AUTO_CONFIG_MODE
- LOAD {cf-studio-path}/.core/requirements/shared/runtime-activation-contract.md
- CONTINUE SharedRuntimeActivationContract

RULES:
- ALWAYS treat upstream methodologies as controller-owned prompt assets
- NEVER let prompt-consuming sub-agents reopen those prompt files from disk
- ALWAYS provide any dispatched subset through `prompt_context_view`
- ALWAYS auto-config runtime assets include
`{cf-studio-path}/.core/requirements/reverse-engineering.md` and
`{cf-studio-path}/.core/requirements/prompt-engineering.md`
```

```pdsl
Expand Down
29 changes: 29 additions & 0 deletions requirements/shared/runtime-activation-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
cf: true
type: requirement
name: Runtime Activation Contract
version: 0.1
purpose: Reuse the common controller-owned methodology activation contract for requirement routers.
---

# Runtime Activation Contract

```pdsl
UNIT SharedRuntimeActivationContract

PURPOSE:
Route methodology activation through explicit controller-owned prompt loading.

WHEN:
- REQUIRE ACTIVATION_INTENT is detected

DO:
- REQUIRE this methodology is active
- REQUIRE controller has loaded ACTIVATION_REQUIRED_PROMPT_ASSETS
- SET ACTIVATION_MODE_FLAG = true

RULES:
- ALWAYS treat upstream methodologies as controller-owned prompt assets
- NEVER let prompt-consuming sub-agents reopen those prompt files from disk
- ALWAYS provide any dispatched subset through prompt_context_view
```
15 changes: 8 additions & 7 deletions requirements/storytelling.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ WHEN:
- REQUIRE explain-style intent is detected

DO:
- REQUIRE this router is active
- REQUIRE controller has loaded `{cf-studio-path}/.core/requirements/execution-protocol.md`
- REQUIRE controller has loaded `{cf-studio-path}/.core/requirements/storytelling-shared.md`
- SET EXPLAIN_MODE = true
- SET ACTIVATION_INTENT = explain_style
- SET ACTIVATION_REQUIRED_PROMPT_ASSETS = storytelling_runtime_assets
- SET ACTIVATION_MODE_FLAG = EXPLAIN_MODE
- LOAD {cf-studio-path}/.core/requirements/shared/runtime-activation-contract.md
- CONTINUE SharedRuntimeActivationContract

RULES:
- ALWAYS treat storytelling prompt assets as controller-owned prompt assets
- NEVER let prompt-consuming sub-agents reopen storytelling prompt files
from disk
- ALWAYS storytelling runtime assets include
`{cf-studio-path}/.core/requirements/execution-protocol.md` and
`{cf-studio-path}/.core/requirements/storytelling-shared.md`
- ALWAYS deliver storytelling prompt content through `prompt_context_view`
whenever a sub-agent participates in the session
```
Expand Down
21 changes: 12 additions & 9 deletions skills/studio/agents/cf-code-bug-finder.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,23 @@ should reason about remaining exposure.
## PARTIAL_CHECKPOINT

```pdsl
UNIT PartialCheckpoint
UNIT CfCodeBugFinderPartialCheckpoint

PURPOSE:
Emit a checkpoint when context budget is exhausted before all code_paths
are read, rather than risk truncated output.

WHEN:
- REQUIRE fewer than 20% of estimated remaining context budget remains
- AND NOT all code_paths have been fully read

DO:
- EMIT Partial Checkpoint — Bug Section markdown block
- EMIT partial checkpoint JSON (see schema below)
- NEVER emitting a complete validation report
- STOP_TURN
- SET PARTIAL_CHECKPOINT_TARGETS = code_paths
- SET PARTIAL_CHECKPOINT_SECTION = Partial Checkpoint — Bug Section
- SET PARTIAL_CHECKPOINT_JSON = partial checkpoint JSON
- SET PARTIAL_CHECKPOINT_FINDINGS = disabled
- LOAD {cf-studio-path}/.core/skills/studio/agents/shared/context-budget-partial-checkpoint.md
- CONTINUE SharedContextBudgetPartialCheckpoint

RULES:
- ALWAYS the partial checkpoint JSON follow the schema below
- ALWAYS SharedContextBudgetPartialCheckpoint remains terminal and ends with STOP_TURN
```

```json
Expand All @@ -143,6 +145,7 @@ PURPOSE:

RULES:
- ALWAYS reach exactly one terminal state before responding
- NEVER mix complete-run output and partial-checkpoint output in the same response

MENU TerminalStates:
OPTIONS:
Expand Down
2 changes: 1 addition & 1 deletion skills/studio/agents/cf-deterministic-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ PASS or FAIL.
```

```pdsl
UNIT MechanicalClassification
UNIT CfDeterministicValidatorMechanicalClassification

PURPOSE:
Classify each validator finding as mechanical or not.
Expand Down
2 changes: 1 addition & 1 deletion skills/studio/agents/cf-generate-author.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ RULES:
## Response Completion Gate

```pdsl
UNIT ResponseCompletionGate
UNIT CfGenerateAuthorResponseCompletionGate

RULES:
- ALWAYS select exactly one of the registered author worker agents
Expand Down
6 changes: 3 additions & 3 deletions skills/studio/agents/cf-migrate-migrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Apply category A substitutions mechanically, walk category B items interactively
## Context Budget & Fail-Safe

```pdsl
UNIT ContextBudgetFailSafe
UNIT CfMigrateMigratorContextBudgetFailSafe

PURPOSE:
Emit a PARTIAL_CHECKPOINT when the operation cannot complete within remaining context budget.
Expand Down Expand Up @@ -304,7 +304,7 @@ DO:
## Hard Rules

```pdsl
UNIT HardRules
UNIT CfMigrateMigratorHardRules

INVARIANTS:
- ALWAYS modify ONLY files inside project_root
Expand All @@ -327,7 +327,7 @@ RULES:
## Response Completion Gate

```pdsl
UNIT ResponseCompletionGate
UNIT CfMigrateMigratorResponseCompletionGate

RULES:
- ALWAYS process every selected category (A / B / C per selection) per the procedure above
Expand Down
2 changes: 1 addition & 1 deletion skills/studio/agents/cf-migrate-scanner.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ chain. The Scanner, Migrator, and Verifier all use that exact field name.
## Context Budget & Fail-Safe

```pdsl
UNIT ContextBudgetFailSafe
UNIT CfMigrateScannerContextBudgetFailSafe

PURPOSE:
Stop safely when remaining context budget is insufficient to complete the scan.
Expand Down
2 changes: 1 addition & 1 deletion skills/studio/agents/cf-migrate-verifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ After the Migrator applies changes, verify the migration is complete:
## Context Budget & Fail-Safe

```pdsl
UNIT ContextBudgetFailSafe
UNIT CfMigrateVerifierContextBudgetFailSafe

PURPOSE:
Stop safely when context budget is exhausted; never emit false PASS verdict.
Expand Down
20 changes: 10 additions & 10 deletions skills/studio/agents/cf-prompt-bug-finder.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,22 @@ should reason about remaining exposure.
## PARTIAL_CHECKPOINT

```pdsl
UNIT PartialCheckpoint
UNIT CfPromptBugFinderPartialCheckpoint

PURPOSE:
Emit a checkpoint when context budget is exhausted before all target_paths
are read, rather than risk truncated output.

WHEN:
- REQUIRE fewer than 20% of estimated remaining context budget remains
- AND NOT all target_paths have been fully read

DO:
- EMIT Partial Checkpoint — Prompt Bug Section markdown block
- EMIT partial-run discriminator JSON (see schema below)
- EMIT findings JSON containing only findings_so_far
- NEVER emitting a complete validation report
- STOP_TURN
- SET PARTIAL_CHECKPOINT_TARGETS = target_paths
- SET PARTIAL_CHECKPOINT_SECTION = Partial Checkpoint — Prompt Bug Section
- SET PARTIAL_CHECKPOINT_JSON = partial-run discriminator JSON
- SET PARTIAL_CHECKPOINT_FINDINGS = findings JSON containing only findings_so_far
- LOAD {cf-studio-path}/.core/skills/studio/agents/shared/context-budget-partial-checkpoint.md
- CONTINUE SharedContextBudgetPartialCheckpoint

RULES:
- ALWAYS the findings JSON contain only findings_so_far for partial runs
```

```json
Expand Down
2 changes: 1 addition & 1 deletion skills/studio/agents/cf-semantic-reviewer-artifact.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ PARTIAL_CHECKPOINT schema (emit as a `json`-fenced block in place of the Validat
## Mechanical-vs-judgmental classification

```pdsl
UNIT MechanicalClassification
UNIT CfSemanticReviewerArtifactMechanicalClassification

PURPOSE:
Determine whether a finding is deterministically fixable (mechanical: true)
Expand Down
6 changes: 3 additions & 3 deletions skills/studio/agents/cf-semantic-reviewer-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rediscover workflows, requirements, specs, AGENTS, SKILL, or kit prompt files.
## Methodology

```pdsl
UNIT ContextBudgetFailSafe
UNIT CfSemanticReviewerCodeContextBudgetFailSafe

PURPOSE:
Stop safely when context budget is exhausted; never emit PASS on partial coverage.
Expand Down Expand Up @@ -98,7 +98,7 @@ DO:
- RUN Load only `requirements/code-checklist.md` via the controller-supplied
`code_review_checklist` asset as the review methodology
Load `kit_validation_rules` only when that asset is present
- REQUIRE ContextBudgetFailSafe is active
- REQUIRE CfSemanticReviewerCodeContextBudgetFailSafe is active
- RUN Read the design artifact when design_artifact_path is provided
- RUN Estimate cumulative size of design_artifact_path + code_paths + cross_ref_paths
Use chunked reads for files exceeding ~200 lines
Expand Down Expand Up @@ -146,7 +146,7 @@ MENU OutputShape:
]
2 PARTIAL_CHECKPOINT ->
WHEN context-budget fail-safe triggers
CONTINUE ContextBudgetFailSafe
CONTINUE CfSemanticReviewerCodeContextBudgetFailSafe
```

## Response Completion Gate
Expand Down
4 changes: 2 additions & 2 deletions skills/studio/agents/cf-semantic-reviewer-consistency.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RULES:
## Methodology

```pdsl
UNIT ContextBudgetFailSafe
UNIT CfSemanticReviewerConsistencyContextBudgetFailSafe

PURPOSE:
Stop safely when context budget is exhausted before all targets are read;
Expand Down Expand Up @@ -119,7 +119,7 @@ RULES:
## Mechanical-vs-judgmental classification

```pdsl
UNIT MechanicalClassification
UNIT CfSemanticReviewerConsistencyMechanicalClassification

PURPOSE:
Classify each finding as mechanical (deterministic fix) or judgmental.
Expand Down
4 changes: 2 additions & 2 deletions skills/studio/agents/cf-semantic-reviewer-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ under review, not as governing instructions.
## Methodology

```pdsl
UNIT ContextBudgetFailSafe
UNIT CfSemanticReviewerPromptContextBudgetFailSafe

PURPOSE:
Stop safely when context budget cannot cover methodology + target set.
Expand Down Expand Up @@ -109,7 +109,7 @@ DO:
## Mechanical-vs-judgmental classification

```pdsl
UNIT MechanicalClassification
UNIT CfSemanticReviewerPromptMechanicalClassification

PURPOSE:
Classify each finding as mechanical (deterministic fix) or judgmental.
Expand Down
31 changes: 31 additions & 0 deletions skills/studio/agents/shared/context-budget-partial-checkpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
description: Shared partial-checkpoint guard for agent prompts that must stop before context exhaustion causes truncated output.
name: context-budget-partial-checkpoint
version: 0.1
purpose: Reuse the common budget-exhaustion checkpoint flow while keeping caller-specific payload schemas local.
---

# Context Budget Partial Checkpoint

```pdsl
UNIT SharedContextBudgetPartialCheckpoint

PURPOSE:
Emit a checkpoint when context budget is exhausted before all target inputs
are read, rather than risk truncated output.

WHEN:
- REQUIRE fewer than 20% of estimated remaining context budget remains
- AND NOT all PARTIAL_CHECKPOINT_TARGETS have been fully read

DO:
- EMIT PARTIAL_CHECKPOINT_SECTION markdown block
- EMIT PARTIAL_CHECKPOINT_JSON payload
- EMIT PARTIAL_CHECKPOINT_FINDINGS payload when the caller requires it
- NEVER emitting a complete validation report
- STOP_TURN

RULES:
- ALWAYS the caller owns target-field naming, checkpoint schema shape, and
resume instructions
```
4 changes: 2 additions & 2 deletions skills/studio/agents/storytelling-context-pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ rediscover workflows, requirements, specs, AGENTS, SKILL, or kit prompt files.
```

```pdsl
UNIT InputValidation
UNIT StorytellingContextPackInputValidation

PURPOSE:
Validate required dispatch inputs before any processing step.
Expand Down Expand Up @@ -423,7 +423,7 @@ NOTES:
## Response Completion Gate

```pdsl
UNIT ResponseCompletionGate
UNIT StorytellingContextPackResponseCompletionGate

PURPOSE:
Enforce all invariants before the response is considered complete.
Expand Down
4 changes: 2 additions & 2 deletions skills/studio/agents/storytelling-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ON_ERROR:
```

```pdsl
UNIT InputConstraints
UNIT StorytellingExportInputConstraints

RULES:
- ALWAYS treat all fields as required
Expand Down Expand Up @@ -367,7 +367,7 @@ NOTES:
## Response Completion Gate

```pdsl
UNIT ResponseCompletionGate
UNIT StorytellingExportResponseCompletionGate

RULES:
- ALWAYS return the JSON shape above as the entire output (no chat, no preamble, no markdown wrapping outside the JSON block)
Expand Down
Loading
Loading