Skip to content

Commit a53e72f

Browse files
alex-mextnerclaude
andauthored
feat(mobile): Linear ticket client + fix OAuth URL scheme regression (#10)
* feat(mobile): improve Linear ticket client * chore(agent): configure haft local tooling * fix(mobile): allow device signing * fix(mobile): preserve OAuth URL scheme through xcodegen regeneration mobile/project.yml's targets.HyperGit.info.properties did not declare CFBundleURLTypes, so `xcodegen generate` treats App/Info.plist as a generated artifact and silently drops any key not listed there. This clobbered the manually-added hypergit:// URL scheme registration on every regeneration (including CI, which runs xcodegen generate on every mobile/** push per .github/workflows/mobile.yml). OAuthService.swift uses ASWebAuthenticationSession with callbackURLScheme: "hypergit" for both GitHub and Linear OAuth (redirect URI hypergit://oauth-callback). Per Apple's documented pattern, the scheme must be registered in CFBundleURLTypes even when using ASWebAuthenticationSession, or iOS has no way to route the callback back into the app — the OAuth flow breaks silently on-device and in CI, with nothing currently asserting the callback works. Adds CFBundleURLTypes to project.yml's info.properties so the generated Info.plist keeps the registration on every future regeneration. Verified with xcodegen 2.45.4: regenerating with the fix reproduces the committed Info.plist's CFBundleURLTypes block byte-for-byte; reverting the fix and regenerating strips the block (negative control), confirming the causal link. Blocks shipping the mobile Linear client work tracked in #3 (OAuth must work before that PR ships). Refs #3 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 987f787 commit a53e72f

89 files changed

Lines changed: 5615 additions & 124 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/h-char/SKILL.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: h-char
3+
description: "Define comparison dimensions for a framed problem"
4+
---
5+
6+
## Codex Invocation
7+
8+
This skill is explicit-only. Use it only when the user invokes $h-char; treat the text after the skill name as the request context.
9+
10+
# Characterize
11+
12+
Define the characteristic space — what dimensions matter and how they're measured. Without this, comparisons are arbitrary.
13+
14+
Current runtime persists characterization on the ProblemCard via `haft_problem(action="characterize")`. Define dimensions once, keep parity rules explicit, then carry that same characterized space into `$h-explore` and `$h-compare`.
15+
16+
Recommended fields to define in your reasoning:
17+
- `name`: dimension name (e.g., "throughput", "ops complexity")
18+
- `scale_type`: ordinal, ratio, nominal
19+
- `unit`: measurement unit
20+
- `polarity`: higher_better or lower_better
21+
- `how_to_measure`: measurement procedure
22+
- `parity_rules`: what must be equal across variants for fair comparison
23+
24+
Use the user's explicit skill invocation text as the request context.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
policy:
2+
allow_implicit_invocation: false
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
name: h-commission
3+
description: "Create WorkCommissions from active DecisionRecords without starting the harness"
4+
---
5+
6+
## Codex Invocation
7+
8+
This skill is explicit-only. Use it only when the user invokes $h-commission; treat the text after the skill name as the request context.
9+
10+
# Commission
11+
12+
Create or reuse WorkCommissions from Haft DecisionRecords. This is the
13+
authorization step only: it must not start Open-Sleigh or any long-running
14+
runtime. Plugin mode does not own runtime lifecycle; CLI or Desktop operates
15+
the harness runtime after the operator chooses to run it.
16+
17+
Operator recovery path:
18+
19+
```bash
20+
haft commission list --selector stale
21+
haft commission show wc-...
22+
haft commission requeue wc-... --reason stale_operator_recovery
23+
haft commission cancel wc-... --reason no_longer_relevant
24+
```
25+
26+
Use cancellation instead of deleting a WorkCommission. A WorkCommission is an
27+
audit/authority record; "remove it from work" means move it to `cancelled` with
28+
a reason.
29+
30+
Default path:
31+
32+
```bash
33+
haft harness run --all-active-decisions --prepare-only
34+
```
35+
36+
This explicitly selects active DecisionRecords, generates an inspectable
37+
`.haft/plans/*.yaml`, creates bounded WorkCommissions, and stops before
38+
execution. A bare `haft harness run` only runs existing runnable commissions; it
39+
does not select decisions by itself.
40+
41+
Use explicit selectors only when the user asks for a narrower set:
42+
43+
```bash
44+
haft harness run dec-a dec-b --prepare-only
45+
haft harness run --problem prob-... --prepare-only
46+
haft harness run --context harness-mvp --prepare-only
47+
haft harness run --all-active-decisions --prepare-only
48+
haft harness run --plan .haft/plans/implementation.yaml --prepare-only
49+
```
50+
51+
If the user supplies exact DecisionRecord ids and asks for the low-level MCP
52+
tool instead of the packaged operator path, use `haft_commission`:
53+
54+
- `action="create_from_decision"` for one decision
55+
- `action="create_batch_from_decisions"` for several decisions
56+
- `action="create_from_plan"` for a prepared ImplementationPlan
57+
- `action="list", selector="stale"` to find old or blocked commissions
58+
- `action="show"` with `commission_id` to inspect one commission and operator hints
59+
- `action="requeue"` with `commission_id` and `reason` to return a recoverable
60+
commission to queued
61+
- `action="cancel"` with `commission_id` and `reason` to close unfinished work
62+
without deleting the record
63+
64+
Delivery policy (apply-authority gate, since v7.x):
65+
66+
The `delivery_policy` field on a WorkCommission controls who applies the
67+
workspace diff after the runtime terminates with `verdict=pass`. Two values:
68+
69+
- `workspace_patch_manual` (default) — diff stays in the workspace clone after
70+
terminal+pass. Operator decides whether to apply via
71+
`haft harness apply <commission-id>`. Use this for commissions touching
72+
load-bearing code, security-sensitive paths, or anything where pre-apply
73+
human review is required.
74+
- `workspace_patch_auto_on_pass` — opt-in. On terminal+pass, the harness drain
75+
loop calls the same scope-checked apply path automatically and emits
76+
`auto_apply_succeeded: commission=... files=N` (or `auto_apply_failed: ...`)
77+
on operator stdout. Use this for low-risk commissions (docs, formatting,
78+
mechanical refactors) where the verdict gate is sufficient.
79+
80+
Per V3 drain invariants, carried here as external Haft runtime rules rather
81+
than as a local HyperGit DecisionRecord:
82+
83+
- AutonomyEnvelope evaluates at create / preflight / execute, NOT at apply.
84+
A missing envelope snapshot does not block auto-apply on pass.
85+
- An EXPLICITLY blocked envelope decision still keeps the manual path even
86+
on `workspace_patch_auto_on_pass`, because that represents a concrete
87+
operator decision rather than a missing snapshot.
88+
- Lockset enforcement at claim time does not change under drain mode.
89+
- Per-commission apply remains a discrete revertable git operation; drain
90+
performs no remote operations (no push, no PR, no comments).
91+
92+
Drain mode (long-running batch operator path):
93+
94+
```bash
95+
haft harness run --drain --concurrency N
96+
```
97+
98+
Keeps the runtime alive while runnable WorkCommissions remain, runs up to N
99+
codex sessions in parallel, exits cleanly when the queue is empty. Emits
100+
`auto_apply_succeeded` / `auto_apply_failed` lines on stdout for terminal
101+
commissions whose `delivery_policy=workspace_patch_auto_on_pass`. Stale leases
102+
older than the configured cap (default 24h, override via
103+
`OPEN_SLEIGH_STALE_LEASE_MAX_AGE_S` env) are skipped at intake with typed
104+
`lease_too_old` reason and surfaced in `haft harness status` for operator
105+
action. `--drain` requires the operator stream — do not combine with
106+
`--detach`.
107+
108+
Single-commission baseline behavior (no `--drain`) is unchanged: operator
109+
runs `haft harness run` with explicit selectors, monitors progress, applies
110+
diffs manually after terminal+pass.
111+
112+
Lifecycle contract:
113+
114+
- `list` and `show` are read-only; they must not change commission state.
115+
- `requeue` is for stale-but-still-current or blocked/failed work after the
116+
cause is fixed. It is allowed only from `queued`, `ready`, `preflighting`,
117+
`running`, `blocked_stale`, `blocked_policy`, `blocked_conflict`,
118+
`needs_human_review`, or `failed`; it clears the lease, refreshes
119+
`fetched_at`, records the reason, and moves the commission to `queued`.
120+
- Do not requeue a commission whose `valid_until` has expired. Cancel it and
121+
create a fresh commission from the current DecisionRecord/scope if work is
122+
still needed.
123+
- `cancel` is for obsolete, duplicate, unauthorized, or expired unfinished work.
124+
It records the reason, clears the lease, and moves the commission to
125+
`cancelled`.
126+
- `completed`, `completed_with_projection_debt`, `cancelled`, and `expired`
127+
commissions are audit records; do not requeue or cancel them again.
128+
- `external_required` does not make tracker publication semantic authority. If
129+
local RuntimeRun evidence passes but the external publish is missing or
130+
failed, the commission must enter `completed_with_projection_debt` and keep a
131+
separate `projection_debt` record naming carrier, target, last error, and
132+
retry policy.
133+
- `local_only` commissions complete from local evidence alone; do not require
134+
tracker credentials or publication state for correctness.
135+
136+
Required discipline:
137+
138+
- Do not treat a DecisionRecord as scheduled work until a WorkCommission exists.
139+
- Do not create a WorkCommission for a stale, superseded, deprecated, or
140+
ambiguous DecisionRecord.
141+
- Preserve the boundary: DecisionRecord = chosen direction;
142+
WorkCommission = bounded permission to execute; RuntimeRun = actual attempt.
143+
- Treat `autonomy_envelope_snapshot`, when supplied, as a limiter only. It may
144+
block out-of-envelope repos, paths, actions, modules, expired/revoked state,
145+
or exhausted concurrency/budget, but it never skips freshness, scope,
146+
evidence, lease, lockset, or one-way-door gates.
147+
- Do not physically delete WorkCommissions during normal operation; cancel or
148+
requeue them so status/verify can explain what happened.
149+
- Prefer default scope derived from `affected_files`; add explicit
150+
`--allowed-path`, `--lock`, or `--evidence` only when the user gives them or
151+
the DecisionRecord is too broad to run safely.
152+
- Report the generated plan path and whether commissions were created or reused.
153+
154+
Use the user's explicit skill invocation text as the request context.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
policy:
2+
allow_implicit_invocation: false

‎.agents/skills/h-compare/SKILL.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: h-compare
3+
description: "Compare solution variants fairly on the Pareto front"
4+
---
5+
6+
## Codex Invocation
7+
8+
This skill is explicit-only. Use it only when the user invokes $h-compare; treat the text after the skill name as the request context.
9+
10+
# Compare Solutions
11+
12+
Run a parity comparison across variants using defined dimensions. Identifies the Pareto front (non-dominated set).
13+
14+
## Fit in the canonical interaction matrix
15+
16+
- **Direct response / direct action**: do not use `$h-compare`; answer directly or do the packaging task.
17+
- **Research / prepare-and-wait**: gather context and stop; the human may invoke `$h-compare` later when ready.
18+
- **Delegated reasoning**: use `$h-compare` after frame/explore, present the Pareto front and recommendation, then stop for the human's choice.
19+
- **Autonomous execution**: use the same comparison standard, but continue into `$h-decide` and implementation only when full autonomy is explicitly enabled.
20+
21+
Use `haft_solution` tool with `action="compare"` and:
22+
- `portfolio_ref`: SolutionPortfolio ID (auto-detected if only one active)
23+
- `dimensions`: comparison dimension names
24+
- `scores`: scores per variant — `{"V1": {"throughput": "100k/s", "cost": "$200"}}`
25+
- `non_dominated_set`: variant IDs on the Pareto front (REQUIRED)
26+
- `dominated_variants`: persisted elimination notes — `[{"variant":"V3","dominated_by":["V1"],"summary":"Lower throughput with no compensating cost or simplicity win."}]`
27+
- `pareto_tradeoffs`: persisted frontier trade-off notes — `[{"variant":"V1","summary":"Best throughput, but highest ops cost."}]`
28+
- `policy_applied`: selection policy that was used
29+
- `selected_ref`: advisory recommendation variant ID. In delegated reasoning this is not the human's selection; it is the candidate you recommend the human consider.
30+
- `recommendation_rationale`: why that advisory recommendation wins under the declared policy
31+
32+
State the selection policy BEFORE seeing results. Ensure parity — same inputs, same scope across all options.
33+
34+
## After the tool call — what to show the user
35+
36+
The user needs to understand the reasoning, not just see a grid of scores. Do NOT compress into a table alone.
37+
Do NOT jump from the score grid straight to "pick X".
38+
39+
Present:
40+
1. **Score table** — all dimensions x variants, for quick scanning
41+
2. **Per-dimension justification** — for each dimension, briefly explain WHY each variant scored the way it did. "Medium-High" means nothing without "because every whitespace change triggers a flag"
42+
3. **Elimination reasoning** — for each dominated variant, state which variant dominates it and on which dimensions. The user should understand WHY a variant was eliminated, not just that it was
43+
4. **Pareto front analysis** — for non-dominated variants, explain the trade-off: what does each sacrifice for what it gains?
44+
5. **Recommendation rationale** — which variant you recommend, the decisive dimension(s), and what risk the user accepts by choosing it. Make clear this recommendation is advisory, not the user's choice
45+
6. **Choice prompt** — only after the Pareto-front explanation and advisory recommendation, ask the human which non-dominated variant to take forward
46+
47+
If there are comparison warnings (missing dimensions, expired measurements, parity violations), surface them — these are decision-quality signals.
48+
49+
Use the user's explicit skill invocation text as the request context.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
policy:
2+
allow_implicit_invocation: false

‎.agents/skills/h-decide/SKILL.md‎

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
name: h-decide
3+
description: "Finalize a decision with full rationale"
4+
---
5+
6+
## Codex Invocation
7+
8+
This skill is explicit-only. Use it only when the user invokes $h-decide; treat the text after the skill name as the request context.
9+
10+
# Decide
11+
12+
Create a DecisionRecord — the crown jewel artifact. Must include what was chosen, why, and what to watch for.
13+
14+
## Investigation-first discipline (BEFORE asking the user)
15+
16+
If the chosen variant title or rationale uses umbrella words
17+
("service", "process", "ready", "queue", etc.), do NOT bounce back to
18+
the operator. Ground the term first:
19+
20+
- Call `haft_query(action="resolve_term", term="<umbrella>")` to get
21+
term-map entries + spec sections + past mentions in one round-trip.
22+
- Read the `spec_section_refs` field returned by the resolver; pass those IDs
23+
as `section_refs` when calling
24+
`haft_decision(decide)`.
25+
- Use repository-native file search and reads (`rg --files`, `rg`, and normal
26+
file reads) to ground the chosen variant in actual code paths so
27+
`affected_files` is concrete, not aspirational.
28+
- Only if a term is genuinely ambiguous after that sweep, ask ONE
29+
concrete question naming the candidates the resolver returned.
30+
31+
If `haft_decision(decide)` returns a `Project readiness` warning that the
32+
project is `needs_onboard`, the resulting DecisionRecord cannot link to
33+
SpecSection refs — and downstream `haft_commission(create_from_decision)`
34+
will block until the spec set is in place. Prefer onboarding first
35+
(`$h-onboard`); if the decision is intentionally tactical, proceed and
36+
record it as out-of-spec so `haft spec coverage` reports it correctly.
37+
38+
Use `haft_decision` tool with `action="decide"` and:
39+
- `selected_title`: name of chosen variant (required)
40+
- `why_selected`: rationale (required)
41+
- `selection_policy`: explicit rule used to choose among the compared variants (required)
42+
- `counterargument`: strongest argument against the chosen option (required)
43+
- `why_not_others`: at least one key rejected alternative with the reason it lost (required)
44+
- `problem_ref`: problem ID
45+
- `problem_refs`: additional problem IDs this decision also addresses when one decision closes multiple linked problem statements
46+
- `portfolio_ref`: portfolio ID
47+
- `pre_conditions`: conditions that must already hold before implementation starts
48+
- `invariants`: what MUST hold at all times
49+
- `post_conditions`: checklist after (definition of done)
50+
- `admissibility`: what is NOT acceptable
51+
- `evidence_requirements`: explicit evidence the implementation/review loop must gather
52+
- `refresh_triggers`: concrete future conditions that should trigger re-evaluation
53+
- `section_refs`: SpecSection IDs governed by this DecisionRecord when accepting or recording a spec-linked decision
54+
- `search_keywords`: compact retrieval aliases for later recall
55+
- `task_context`: optional task/context text for the DecisionRecord filename slug; sanitized before it is inserted into the ID
56+
- `predictions`: falsifiable claims to verify later; each item MUST include `claim`, `observable`, and `threshold`
57+
- `weakest_link`: selected variant weakest link; what most plausibly breaks this choice (required)
58+
- `rollback.triggers`: at least one concrete trigger that would force reversal (required)
59+
- `rollback.steps`: rollback actions to take when a trigger fires
60+
- `valid_until`: expiry date (YYYY-MM-DD)
61+
- `affected_files`: files affected
62+
63+
The tool should reject DecisionRecords that omit these anti-self-deception fields. A polished winner story is not enough.
64+
65+
## Verification Gate (before recording)
66+
67+
Before calling `haft_decision`, run a verification check. The agent that generates a decision cannot be its sole validator (FPF A.12 — External Transformer Principle).
68+
69+
### Tactical mode — one challenge
70+
71+
Present ONE line to the user:
72+
73+
> **Counter-argument:** [strongest argument against this decision in one sentence]
74+
>
75+
> Proceed? (If the counter-argument kills the decision → go back to $h-explore)
76+
77+
Then record the decision. Persist the strongest attack in `counterargument` either way; `weakest_link` names the bounding fragility, while `counterargument` preserves the strongest adversarial case against the choice.
78+
79+
### Standard/deep mode — full verification
80+
81+
Present ALL five probes to the user BEFORE calling the tool:
82+
83+
**1. Deductive consequences** (FPF B.5:4.2)
84+
> "If this decision is correct, these 3 things must be true:"
85+
> - [consequence 1]
86+
> - [consequence 2]
87+
> - [consequence 3]
88+
> Check: do any contradict known constraints or existing decisions?
89+
90+
**2. Strongest counter-argument** (FPF A.12)
91+
> "The strongest argument against this decision:"
92+
> [genuine counter-argument — not a strawman]
93+
94+
**3. Self-evidence check** (FPF CC-A12.5)
95+
> "Evidence sourced solely from this conversation: [yes/no]"
96+
> If yes: flag it. Evidence from the same agent session that generated the options is CL1 at best, not CL3.
97+
98+
**4. Tail failure scenarios** (Verbalized Sampling, τ<0.10)
99+
> "Low-probability, high-impact failure modes (<10% each):"
100+
> - [scenario 1]
101+
> - [scenario 2]
102+
103+
**5. WLNK challenge**
104+
> "Stated weakest link: [X]. Is this actually the weakest, or is there something weaker hiding behind it?"
105+
106+
After presenting: if the user confirms, record the decision. If any probe kills the decision, go back to $h-explore.
107+
108+
**Incorporate findings:** Persist the strongest attack in `counterargument`, keep the bounding fragility in `weakest_link`, record the selection rule in `selection_policy`, keep at least one concrete rejected alternative in `why_not_others`, and capture reversal conditions in `rollback.triggers` — don't just display them, persist them in the decision record.
109+
110+
## ALIVE decision contract
111+
112+
When the decision is important enough to govern implementation rather than merely document a choice, persist the operational contract too:
113+
114+
- `pre_conditions`: use for prerequisites such as "benchmark reproduced in CI" or "schema freeze approved"
115+
- `evidence_requirements`: use for proof obligations such as "p99 latency < 20ms in replay benchmark"
116+
- `refresh_triggers`: use for future drift/reopen triggers such as "error budget breached for two releases"
117+
- `predictions`: use for measurable expectations that `haft_decision(action="measure")` can later confirm or weaken
118+
119+
Good prediction example:
120+
121+
```text
122+
predictions=[
123+
{
124+
"claim": "Throughput stays above 100k events/sec",
125+
"observable": "throughput",
126+
"threshold": "> 100k events/sec"
127+
}
128+
]
129+
```
130+
131+
## Evidence workflow after deciding
132+
133+
- Use `haft_decision(action="evidence", artifact_ref="<decision-id>", evidence_content="...", evidence_type="benchmark|test|research|audit", evidence_verdict="supports|weakens|refutes", claim_refs=[...], claim_scope=[...], valid_until="...")` when you have explicit supporting or contradictory artifacts and their freshness matters.
134+
- Use `haft_decision(action="baseline", decision_ref="<decision-id>")` before `measure` when the decision has `affected_files`.
135+
- Use `haft_decision(action="measure", ...)` for post-implementation outcome. Attached evidence complements measure; it does not replace it.
136+
137+
Attach evidence to the narrowest justified scope:
138+
139+
- `claim_refs`: explicit claim identifiers when the evidence targets a named claim
140+
- `claim_scope`: semantic scope labels when the evidence targets a slice such as `latency`, `throughput`, or `migration-safety`
141+
142+
Use `claim_scope` even when stable claim IDs are not available yet. This keeps later audit/projection views anchored to the same semantic state instead of free-form narration.
143+
144+
Use the user's explicit skill invocation text as the request context.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
policy:
2+
allow_implicit_invocation: false

0 commit comments

Comments
 (0)