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
7 changes: 5 additions & 2 deletions hooks/ways/frontmatter-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ way:
required: optional
default: 0.35
role: Cosine similarity threshold for embedding engine (0.0-1.0, higher = stricter)
# embed_model: removed — derived automatically by corpus builder
# (.md ways → en model, .locales.jsonl entries → multilingual model)
redisclose:
type: number
required: optional
default: 25
role: Context window % before re-disclosure (lower = more frequent, default 25)
pattern:
type: regex
required: optional
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/code/quality/quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description: code quality, refactoring, SOLID principles, code review standards,
vocabulary: refactor quality solid principle decompose extract method responsibility coupling cohesion maintainability readability
threshold: 2.0
pattern: solid.?principle|refactor|code.?review|code.?quality|clean.?up|simplify|decompos|extract.?method|tech.?debt
redisclose: 15
macro: append
scan_exclude: \.md$|\.lock$|\.min\.(js|css)$|\.generated\.|\.bundle\.|vendor/|node_modules/|dist/|build/|__pycache__/
scope: agent, subagent
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/delivery/branching/branching.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
description: Git branch awareness and branching guidance when editing files
vocabulary: branch checkout worktree main trunk feature fix refactor
files: \.(md|rs|sh|py|js|ts|json|yaml|yml|toml|go|rb|java|c|cpp|h|hpp|css|html|sql)$
redisclose: 10
macro: prepend
scope: agent, subagent
---
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/delivery/commits/commits.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vocabulary: commit message branch conventional feat fix refactor scope atomic sq
threshold: 2.0
pattern: commit|push.*(remote|origin|upstream)
commands: git\ commit
redisclose: 15
scope: agent, subagent
---
<!-- epistemic: convention -->
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/delivery/github/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vocabulary: pr pullrequest issue review checks ci label milestone fork repositor
threshold: 2.0
pattern: github|\ issue|pull.?request|\ pr\ |\ pr$|review.?(pr|comment)|merge.?request|ship.?(it|this|the)|land.?(it|this)|merge.?(it|this)
commands: ^gh\ |^gh$
redisclose: 10
macro: prepend
scope: agent, subagent
---
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/delivery/release/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
description: software releases, changelog generation, version bumping, semantic versioning, tagging
vocabulary: release changelog version bump semver tag publish ship major minor breaking
threshold: 2.0
redisclose: 15
pattern: release|changelog|tag|version.?bump|bump.?version|npm.?publish|cargo.?publish
scope: agent, subagent
---
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/environment/deps/deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vocabulary: dependency package library install upgrade outdated audit vulnerabil
threshold: 2.0
pattern: dependenc|package|library|npm.?install|pip.?install|upgrade.*version
commands: npm\ install|yarn\ add|pip\ install|cargo\ add|go\ get
redisclose: 15
scope: agent, subagent
---
<!-- epistemic: heuristic -->
Expand Down
1 change: 1 addition & 0 deletions hooks/ways/softwaredev/environment/makefile/makefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vocabulary: makefile make target build lint linter test format clean install pub
files: Makefile$|makefile$|GNUmakefile$|\.mk$
commands: make
threshold: 1.5
redisclose: 10
scope: agent, subagent
macro: append
---
Expand Down
4 changes: 3 additions & 1 deletion tools/ways-cli/src/cmd/show/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ pub fn way(id: &str, session_id: &str, trigger: &str) -> Result<String> {
}

// Session marker check + token-gated re-disclosure (ADR-104)
let redisclose_pct: Option<u64> = extract_field(&content, "redisclose")
.and_then(|s| s.parse().ok());
let is_redisclosure;
if session::way_is_shown(id, session_id) {
match session::token_distance_exceeded(id, session_id) {
match session::token_distance_exceeded(id, session_id, redisclose_pct) {
Some(_distance) => {
is_redisclosure = true;
}
Expand Down
3 changes: 3 additions & 0 deletions tools/ways-cli/src/frontmatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub struct Frontmatter {
pub scope: Option<String>,
#[serde(default)]
pub embed_threshold: Option<f64>,
#[serde(default)]
#[allow(dead_code)] // parsed for serde compat, read via extract_field in show/mod.rs
pub redisclose: Option<u64>,
}

/// Extract YAML frontmatter from a way file.
Expand Down
6 changes: 4 additions & 2 deletions tools/ways-cli/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,16 @@ pub fn stamp_way_tokens(way_id: &str, session_id: &str, position: u64) {

/// Check if token distance exceeds re-disclosure threshold.
/// Returns Some(distance) if exceeded, None if not.
pub fn token_distance_exceeded(way_id: &str, session_id: &str) -> Option<u64> {
/// `redisclose_pct` overrides the global default when set (per-way frontmatter).
pub fn token_distance_exceeded(way_id: &str, session_id: &str, redisclose_pct: Option<u64>) -> Option<u64> {
let tokens_path = session_dir(session_id).join("way-tokens").join(way_id).join(".value");
let last_tokens = read_u64_path(&tokens_path);
let current = get_token_position(session_id);
let distance = current.saturating_sub(last_tokens);

let pct = redisclose_pct.unwrap_or(REDISCLOSE_PCT);
let context_window = detect_context_window(session_id);
let threshold = context_window * REDISCLOSE_PCT / 100;
let threshold = context_window * pct / 100;

if distance >= threshold {
Some(distance)
Expand Down
Loading