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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All notable changes to this project are documented in this file.
- Added `scripts/rules_engine.py` implementing frontmatter parsing, layered rule discovery, path-based matching, deterministic precedence sorting, and duplicate-id conflict reporting.
- Added `scripts/rules_command.py` with `/rules status`, `/rules explain`, per-rule disable/enable controls, and `/rules doctor` diagnostics.
- Added `instructions/rules_team_pack_examples.md` with practical team rule-pack layout and sample rule files.
- Added `instructions/context_resilience_policy_schema.md` defining truncation modes, protected artifacts, and resilience notification levels for Epic 11 Task 11.1.

### Changes
- Documented extension evaluation outcomes and when each tool is the better fit.
Expand Down
13 changes: 7 additions & 6 deletions IMPLEMENTATION_ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Use this map to avoid overlapping implementations.
| E8 | Keyword-Triggered Execution Modes | done | High | E1, E4 | bd-302, bd-2fb, bd-2zq, bd-3dp | Fast power-mode activation from prompt text |
| E9 | Conditional Rules Injector | done | High | E1 | bd-1q8, bd-3rj, bd-fo8, bd-2ik | Enforce project conventions with scoped rules |
| E10 | Auto Slash Command Detector | paused | Medium | E1, E8 | TBD | Resume only if intent precision stays high in prototypes |
| E11 | Context-Window Resilience Toolkit | planned | High | E4 | TBD | Improve long-session stability and recovery |
| E11 | Context-Window Resilience Toolkit | in_progress | High | E4 | bd-2tj | Improve long-session stability and recovery |
| E12 | Provider/Model Fallback Visibility | planned | Medium | E5 | TBD | Explain why model routing decisions happen |
| E13 | Browser Automation Profile Switching | planned | Medium | E1 | TBD | Toggle Playwright/agent-browser with checks |
| E14 | Plan-to-Execution Bridge Command | planned | Medium | E2, E3 | TBD | Execute validated plans with progress tracking |
Expand Down Expand Up @@ -439,7 +439,7 @@ Every command-oriented epic must ship all of the following:

## Epic 10 - Auto Slash Command Detector

**Status:** `planned`
**Status:** `in_progress`
**Priority:** Medium
**Goal:** Detect natural-language intent that maps to existing slash commands and optionally execute with guardrails.
**Depends on:** Epic 1, Epic 8
Expand Down Expand Up @@ -472,10 +472,11 @@ Every command-oriented epic must ship all of the following:
**Goal:** Improve long-session reliability with configurable truncation/pruning/recovery policies.
**Depends on:** Epic 4

- [ ] Task 11.1: Define resilience policy schema
- [ ] Subtask 11.1.1: Define truncation modes (`default`, `aggressive`)
- [ ] Subtask 11.1.2: Define protected tools/messages list
- [ ] Subtask 11.1.3: Define pruning and recovery notification levels
- [x] Task 11.1: Define resilience policy schema
- [x] Subtask 11.1.1: Define truncation modes (`default`, `aggressive`)
- [x] Subtask 11.1.2: Define protected tools/messages list
- [x] Subtask 11.1.3: Define pruning and recovery notification levels
- [x] Notes: Added `instructions/context_resilience_policy_schema.md` documenting config shape, truncation modes, protected artifact constraints, notification levels, and validation requirements.
- [ ] Task 11.2: Implement context pruning engine
- [ ] Subtask 11.2.1: Add deduplication and superseded-write pruning
- [ ] Subtask 11.2.2: Add old-error input purge with turn thresholds
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,17 @@ Recommended workflow:
- run `/rules status` after edits to validate discovery
- use `/rules explain <path> --json` to verify effective rule stack before relying on behavior

## Context resilience policy

Epic 11 Task 11.1 defines the baseline policy schema for context-window resilience:

- schema contract: `instructions/context_resilience_policy_schema.md`

Initial schema covers:
- truncation modes (`default`, `aggressive`)
- protected tools/messages to preserve critical evidence
- pruning/recovery notification levels (`quiet`, `normal`, `verbose`)

## Background jobs inside OpenCode 🧵

Use these directly in OpenCode:
Expand Down
96 changes: 96 additions & 0 deletions instructions/context_resilience_policy_schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Context Resilience Policy Schema

Epic 11 Task 11.1 defines configuration and behavior contracts for long-session context resilience.

## Objectives

- provide deterministic truncation/pruning behavior under constrained context budgets
- preserve critical evidence needed for safe continuation
- make pruning and recovery decisions visible with configurable signal levels

## Config shape

Proposed config section:

```json
{
"resilience": {
"enabled": true,
"truncation_mode": "default",
"protected_tools": ["bash", "read", "edit", "write", "apply_patch"],
"protected_message_kinds": ["error", "result", "decision"],
"notification_level": "normal"
}
}
```

Field requirements:

- `enabled`: boolean, default `true`
- `truncation_mode`: enum, one of `default` or `aggressive`
- `protected_tools`: optional list of tool ids to never prune when they contain command outcomes
- `protected_message_kinds`: optional list of semantic message categories to preserve
- `notification_level`: enum, one of `quiet`, `normal`, or `verbose`

Unknown keys should be ignored with a warning in diagnostics.

## Truncation modes

### `default`

- preserve all protected tools/messages
- prune obvious duplicates and stale superseded content
- retain at least one recent successful command outcome per active workflow

### `aggressive`

- apply `default` behavior first
- increase pruning pressure for old non-protected analysis chatter
- collapse repeated failure retries into compact summaries while preserving the latest actionable error

## Protected artifacts

Protected artifacts are never removed during pruning:

- tool results for `protected_tools` entries
- messages tagged as `protected_message_kinds`
- latest command invocation + exit outcome for each command family in session scope

If protection constraints conflict with budget limits, the system should emit a recovery warning instead of silently dropping protected evidence.

## Notification levels

### `quiet`

- notify only when resilience actions could alter execution safety

### `normal`

- notify on major pruning/recovery events and skipped actions

### `verbose`

- emit per-action diagnostics including prune reason categories and protected-preservation counts

## Validation requirements

Reject invalid config when:

- enum fields contain unsupported values
- list fields are not arrays of non-empty strings
- required booleans are non-boolean values

Diagnostics must include:

- invalid field path
- invalid value
- accepted values or shape
- remediation guidance

## Compatibility and evolution

- `truncation_mode` defaults to `default` when absent
- missing optional lists imply conservative built-in protections
- future modes/levels must remain backward compatible with current enum values

This schema is intentionally command-agnostic so Epic 11 Task 11.2 can implement pruning without changing consumer-facing config shape.