Skip to content

Commit 5d3cf42

Browse files
authored
feat: per-way redisclose field for re-disclosure tuning (#107)
* feat: per-way redisclose field for re-disclosure frequency tuning Add `redisclose` frontmatter field — context window % before a way re-fires (default 25%). Lower = more frequent. Parsed from YAML at display time and passed to token_distance_exceeded(). Set `redisclose: 10` on Makefile way so it re-fires after 10% of context instead of 25%, keeping build conventions visible during build-heavy sessions. * feat: set redisclose on high-frequency action ways 10% (macro + interception — stale context = wrong decisions): - delivery/github: macro + gh interception, PR cleanup - delivery/branching: macro injects branch name 15% (procedural guidance that drifts): - code/quality: macro scans file sizes - delivery/commits: conventional format enforcement - delivery/release: multi-step publish workflow - environment/deps: package install gate
1 parent 1bb5877 commit 5d3cf42

11 files changed

Lines changed: 22 additions & 5 deletions

File tree

hooks/ways/frontmatter-schema.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ way:
2828
required: optional
2929
default: 0.35
3030
role: Cosine similarity threshold for embedding engine (0.0-1.0, higher = stricter)
31-
# embed_model: removed — derived automatically by corpus builder
32-
# (.md ways → en model, .locales.jsonl entries → multilingual model)
31+
redisclose:
32+
type: number
33+
required: optional
34+
default: 25
35+
role: Context window % before re-disclosure (lower = more frequent, default 25)
3336
pattern:
3437
type: regex
3538
required: optional

hooks/ways/softwaredev/code/quality/quality.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: code quality, refactoring, SOLID principles, code review standards,
33
vocabulary: refactor quality solid principle decompose extract method responsibility coupling cohesion maintainability readability
44
threshold: 2.0
55
pattern: solid.?principle|refactor|code.?review|code.?quality|clean.?up|simplify|decompos|extract.?method|tech.?debt
6+
redisclose: 15
67
macro: append
78
scan_exclude: \.md$|\.lock$|\.min\.(js|css)$|\.generated\.|\.bundle\.|vendor/|node_modules/|dist/|build/|__pycache__/
89
scope: agent, subagent

hooks/ways/softwaredev/delivery/branching/branching.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
description: Git branch awareness and branching guidance when editing files
33
vocabulary: branch checkout worktree main trunk feature fix refactor
44
files: \.(md|rs|sh|py|js|ts|json|yaml|yml|toml|go|rb|java|c|cpp|h|hpp|css|html|sql)$
5+
redisclose: 10
56
macro: prepend
67
scope: agent, subagent
78
---

hooks/ways/softwaredev/delivery/commits/commits.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ vocabulary: commit message branch conventional feat fix refactor scope atomic sq
44
threshold: 2.0
55
pattern: commit|push.*(remote|origin|upstream)
66
commands: git\ commit
7+
redisclose: 15
78
scope: agent, subagent
89
---
910
<!-- epistemic: convention -->

hooks/ways/softwaredev/delivery/github/github.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ vocabulary: pr pullrequest issue review checks ci label milestone fork repositor
44
threshold: 2.0
55
pattern: github|\ issue|pull.?request|\ pr\ |\ pr$|review.?(pr|comment)|merge.?request|ship.?(it|this|the)|land.?(it|this)|merge.?(it|this)
66
commands: ^gh\ |^gh$
7+
redisclose: 10
78
macro: prepend
89
scope: agent, subagent
910
---

hooks/ways/softwaredev/delivery/release/release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
description: software releases, changelog generation, version bumping, semantic versioning, tagging
33
vocabulary: release changelog version bump semver tag publish ship major minor breaking
44
threshold: 2.0
5+
redisclose: 15
56
pattern: release|changelog|tag|version.?bump|bump.?version|npm.?publish|cargo.?publish
67
scope: agent, subagent
78
---

hooks/ways/softwaredev/environment/deps/deps.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ vocabulary: dependency package library install upgrade outdated audit vulnerabil
44
threshold: 2.0
55
pattern: dependenc|package|library|npm.?install|pip.?install|upgrade.*version
66
commands: npm\ install|yarn\ add|pip\ install|cargo\ add|go\ get
7+
redisclose: 15
78
scope: agent, subagent
89
---
910
<!-- epistemic: heuristic -->

hooks/ways/softwaredev/environment/makefile/makefile.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ vocabulary: makefile make target build lint linter test format clean install pub
44
files: Makefile$|makefile$|GNUmakefile$|\.mk$
55
commands: make
66
threshold: 1.5
7+
redisclose: 10
78
scope: agent, subagent
89
macro: append
910
---

tools/ways-cli/src/cmd/show/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ pub fn way(id: &str, session_id: &str, trigger: &str) -> Result<String> {
4040
}
4141

4242
// Session marker check + token-gated re-disclosure (ADR-104)
43+
let redisclose_pct: Option<u64> = extract_field(&content, "redisclose")
44+
.and_then(|s| s.parse().ok());
4345
let is_redisclosure;
4446
if session::way_is_shown(id, session_id) {
45-
match session::token_distance_exceeded(id, session_id) {
47+
match session::token_distance_exceeded(id, session_id, redisclose_pct) {
4648
Some(_distance) => {
4749
is_redisclosure = true;
4850
}

tools/ways-cli/src/frontmatter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ pub struct Frontmatter {
1616
pub scope: Option<String>,
1717
#[serde(default)]
1818
pub embed_threshold: Option<f64>,
19+
#[serde(default)]
20+
#[allow(dead_code)] // parsed for serde compat, read via extract_field in show/mod.rs
21+
pub redisclose: Option<u64>,
1922
}
2023

2124
/// Extract YAML frontmatter from a way file.

0 commit comments

Comments
 (0)