Fix cross-project target grounding and add handoff note

This commit is contained in:
Bill
2026-03-08 10:53:30 -06:00
parent 9f9d9590c3
commit a09fc55325
6 changed files with 670 additions and 22 deletions

View File

@@ -336,6 +336,15 @@ if [[ "$SEMANTIC_PLANNING_BRIDGE" == "1" && "$SEMANTIC_REQUIREMENT_INJECTION" ==
SEM_REQS="$(jq -nc --argjson packet "$(cat "$OUT_DIR/00b_semantic_planning_annotations.json")" '
def mk($kind; $text; $id):
{requirementId:$id, kind:$kind, normalizedText:$text, anchor:"semantic_packet", sourceLine:0, ambiguous:false};
def backticks($s):
($s | split("`")) as $parts
| [ range(1; ($parts|length); 2) as $i | $parts[$i] ];
def normalize_path($p):
($p | gsub("^\\s+|\\s+$"; "")) as $t
| if ($t|startswith("/home/bill/Documents/")) then ($t | sub("^/home/bill/Documents/"; ""))
else $t end;
def is_file_path($p):
($p | test("/") and test("\\.[A-Za-z0-9]{1,8}$") and (contains(" ")|not) and (contains("<")|not) and (contains(">")|not));
[
(if ($packet.annotations[]? | select(.type=="intent") | .fields.summary // "" | length) > 0
then mk("goal"; ($packet.annotations[] | select(.type=="intent") | .fields.summary); "semantic-intent-summary")
@@ -347,8 +356,15 @@ if [[ "$SEMANTIC_PLANNING_BRIDGE" == "1" && "$SEMANTIC_REQUIREMENT_INJECTION" ==
(($packet.annotations[]? | select(.type=="contract") | .fields.constraints[]?) as $c
| mk("constraint"; ("semantic contract clause: " + $c); ("semantic-contract-" + ($c|gsub("[^A-Za-z0-9]+";"_"))))),
(($packet.annotations[]? | select(.type=="capability_requirement") | .fields.capability?) as $cap
| mk("dependency"; ("semantic capability requirement: " + $cap); ("semantic-capability-" + ($cap|gsub("[^A-Za-z0-9]+";"_")))))
] | map(select(.normalizedText | length > 0))
| mk("dependency"; ("semantic capability requirement: " + $cap); ("semantic-capability-" + ($cap|gsub("[^A-Za-z0-9]+";"_"))))),
(($packet.annotations[]? | select(.type=="contract") | .fields.required_artifacts[]?) as $a
| backticks($a)[]?
| normalize_path(.)
| select(is_file_path(.))
| mk("requirement"; ("explicit target file: " + .); ("semantic-artifact-file-" + (. | gsub("[^A-Za-z0-9]+";"_")))))
]
| map(select(.normalizedText | length > 0))
| unique_by(.requirementId)
')"
printf '%s\n' "$SEM_REQS" > "$OUT_DIR/01c_semantic_injected_requirements.json"
NORMALIZED_REQS="$(jq -nc --argjson base "$NORMALIZED_REQS" --argjson sem "$SEM_REQS" '$base + $sem')"