From d7856f67a3dbe329974e6f9c197c5fac52d4992f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20S=C3=B6derlund?= Date: Thu, 12 Nov 2026 17:12:12 +0100 Subject: [PATCH 1/3] feat(slack): turn off slackcli update notice - mise pins and updates slackcli through mise.lock. - The notice suggests `slackcli update`, which bypasses mise. --- env.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/env.sh b/env.sh index 936a0809..18e7175b 100644 --- a/env.sh +++ b/env.sh @@ -52,6 +52,9 @@ export PATH="$CARGO_HOME/bin:$PATH" # shellcheck source=/dev/null [ -f "$CARGO_HOME/env" ] && . "$CARGO_HOME/env" +# slackcli: mise owns updates; the notice suggests `slackcli update` +export SLACKCLI_NO_UPDATE_NOTIFIER=1 + # ssh — needed for non-fish shells (e.g. Claude Code's zsh) where # fish's refresh_ssh_auth_sock doesn't run; without this, jj sign-on-push hangs. if [ -z "$SSH_AUTH_SOCK" ]; then From bf44fdb7938104eb56006887cfaa3a65f2ac4a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20S=C3=B6derlund?= Date: Sun, 15 Nov 2026 11:39:39 +0100 Subject: [PATCH 2/3] feat(claude): deny cloud Artifacts - Deny the Artifact tool in global Claude settings - Keep deliverables as files in the repo where the work happens - Note the rule in the global AGENTS.md so other agents follow it --- agents/AGENTS.md | 3 +++ claude/settings.json | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/agents/AGENTS.md b/agents/AGENTS.md index 955543f1..ab009937 100644 --- a/agents/AGENTS.md +++ b/agents/AGENTS.md @@ -39,6 +39,9 @@ Interactive/auth: `agent-browser-odsod connect`, then `agent-browser open|read|c Public URL for a local server (webhooks, external callers): `tailscale funnel --bg --https=8443 `; `tailscale funnel --https=8443 off` when done. Not cloudflared or ngrok. +No cloud Artifacts (denied). Write deliverables as files in the repo if instructed. +Put temporary or ephemeral artifacts in `/tmp`. + `gh` always `-R /` (jj workspaces have no git remotes). Owner/repo from `~/Code///`, `~/Workspaces////`, or `jj git remote list`. diff --git a/claude/settings.json b/claude/settings.json index d1686a68..7915cdde 100644 --- a/claude/settings.json +++ b/claude/settings.json @@ -11,7 +11,9 @@ "pr": "" }, "permissions": { - "defaultMode": "bypassPermissions" + "defaultMode": "bypassPermissions", + "//": "Deny cloud Artifacts. Agents write deliverables as repo files if instructed, and temporary or ephemeral artifacts in /tmp.", + "deny": ["Artifact"] }, "model": "opus", "hooks": { From c2b1e6fefa3be79ddf475d877575f013956aa7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20S=C3=B6derlund?= Date: Sun, 15 Nov 2026 11:39:39 +0100 Subject: [PATCH 3/3] feat(agents): add Linear context to workspace agents - Workspaces need the related Linear items in every agent's context, with rules to post progress and link PRs. - A session-start hook refreshes .linear-context.md from its frontmatter and prints it for claude, codex, agy, and pi. - start-workspace asks for Linear issues or a project as the last step of a Workspace launch and writes the frontmatter. - A global git ignore keeps the file out of commits; add yq to parse the frontmatter. --- agents/hooks/linear-context.sh | 108 +++++++++++++++++++++++++++++++ antigravity/hooks.json | 6 ++ claude/settings.json | 10 +++ codex/config.toml | 6 ++ git/ignore | 3 + herdr/start-workspace | 49 ++++++++++++++ herdr/tests/start-workspace.fish | 5 +- mise.lock | 47 ++++++++++++++ mise.toml | 1 + mise/conf.d/git.toml | 1 + mise/conf.d/pi.toml | 1 + pi/extensions/linear-context.ts | 22 +++++++ 12 files changed, 258 insertions(+), 1 deletion(-) create mode 100755 agents/hooks/linear-context.sh create mode 100644 git/ignore create mode 100644 pi/extensions/linear-context.ts diff --git a/agents/hooks/linear-context.sh b/agents/hooks/linear-context.sh new file mode 100755 index 00000000..c39a397a --- /dev/null +++ b/agents/hooks/linear-context.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# Session-start hook: refresh the nearest .linear-context.md from Linear and +# print it as agent context. The frontmatter names the Linear items; the body +# is generated. On a failed fetch, keep and print the old file. +# +# Usage: linear-context.sh [--agy] +# --agy print agy's {"inject_steps": [...]} JSON instead of plain markdown. +set -uo pipefail + +name=.linear-context.md + +cwd=$PWD +if [ ! -t 0 ]; then + in_cwd=$(jq -r '.cwd // empty' 2>/dev/null || true) + [ -n "$in_cwd" ] && cwd=$in_cwd +fi + +file= +dir=$cwd +while :; do + if [ -f "$dir/$name" ]; then + file=$dir/$name + break + fi + [ "$dir" = / ] && break + dir=$(dirname "$dir") +done +[ -n "$file" ] || exit 0 + +emit() { + if [ "${1:-}" = --agy ]; then + jq -n --rawfile body "$file" '{inject_steps: [{ephemeral_message: $body}]}' + else + cat "$file" + fi +} + +project=$(yq --front-matter=extract '.linear.project // ""' "$file" 2>/dev/null) +mapfile -t issues < <(yq --front-matter=extract '.linear.issues // [] | .[]' "$file" 2>/dev/null) + +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +pids=() +for i in "${!issues[@]}"; do + timeout 10 linear issue view "${issues[$i]}" --no-pager --no-download --no-input \ + >"$tmp/issue-$i.md" 2>/dev/null & + pids+=($!) +done +if [ -n "$project" ]; then + timeout 10 linear project view "$project" --no-pager --no-input \ + >"$tmp/project.md" 2>/dev/null & + pids+=($!) + timeout 10 linear project-update list "$project" --limit 3 --no-input \ + >"$tmp/updates.md" 2>/dev/null & + pids+=($!) +fi + +ok=1 +for pid in "${pids[@]}"; do + wait "$pid" || ok=0 +done + +if [ "$ok" = 0 ]; then + emit "$@" + exit 0 +fi + +# Demote markdown headings one level, outside fenced code blocks. +demote() { + awk '/^```/ { fence = !fence } !fence && /^#/ { $0 = "#" $0 } { print }' "$1" +} + +{ + # yq prints the opening "---" itself. + yq --front-matter=extract ".refreshed = \"$(date -Iseconds)\"" "$file" + echo --- + cat <<'EOF' + +# Linear context + +This workspace tracks the Linear items below. Use the /linear-cli skill to +work with them. + +- When you start work on an issue, run + `linear issue update --state started`. +- At each milestone and when you stop, post progress with + `linear issue comment add --body-file `. +- Link each PR to its issue with `linear issue link `. +- Do not set an issue to Done or Canceled. The user does that. +- A hook regenerates this file at session start. Do not edit the body. To + change the tracked items, edit the `linear:` frontmatter. +EOF + for i in "${!issues[@]}"; do + echo + demote "$tmp/issue-$i.md" + done + if [ -n "$project" ]; then + echo + demote "$tmp/project.md" + echo + echo "## Recent project updates" + echo + demote "$tmp/updates.md" + fi +} >"$tmp/out" && cp "$tmp/out" "$file.tmp" && mv "$file.tmp" "$file" + +emit "$@" diff --git a/antigravity/hooks.json b/antigravity/hooks.json index 51db2af9..dd420915 100644 --- a/antigravity/hooks.json +++ b/antigravity/hooks.json @@ -1,5 +1,11 @@ { "machine": { + "SessionStart": [ + { + "type": "command", + "command": "$HOME/.agents/hooks/linear-context.sh --agy" + } + ], "PostToolUse": [ { "matcher": "write_to_file|replace_file_content", diff --git a/claude/settings.json b/claude/settings.json index 7915cdde..7dd12d1b 100644 --- a/claude/settings.json +++ b/claude/settings.json @@ -18,6 +18,16 @@ "model": "opus", "hooks": { "PreToolUse": [], + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "$HOME/.agents/hooks/linear-context.sh" + } + ] + } + ], "PostToolUse": [ { "matcher": "Write|Edit", diff --git a/codex/config.toml b/codex/config.toml index ca9eefa1..da4da3d7 100644 --- a/codex/config.toml +++ b/codex/config.toml @@ -22,3 +22,9 @@ matcher = "Write|Edit|apply_patch" [[hooks.PostToolUse.hooks]] type = "command" command = "$HOME/.agents/hooks/format.sh" + +[[hooks.SessionStart]] + +[[hooks.SessionStart.hooks]] +type = "command" +command = "$HOME/.agents/hooks/linear-context.sh" diff --git a/git/ignore b/git/ignore new file mode 100644 index 00000000..63399fec --- /dev/null +++ b/git/ignore @@ -0,0 +1,3 @@ +**/.claude/settings.local.json +.linear-context.md +.linear-context.md.tmp diff --git a/herdr/start-workspace b/herdr/start-workspace index 26d5ffeb..ab16b185 100755 --- a/herdr/start-workspace +++ b/herdr/start-workspace @@ -336,6 +336,54 @@ function select_agent _write_state last-agent "$agent_kind" end +# --- Linear context --- + +# Ask which Linear issues or project the workspace tracks and write them to +# .linear-context.md, which agents/hooks/linear-context.sh reads at session +# start. Skip when the file exists, linear is missing, or nothing is picked. +function _pick_linear_context --argument-names dir + set -l file "$dir/.linear-context.md" + test -e "$file"; and return 0 + command -q linear; or return 0 + + _status_show "Loading Linear issues..." + set -l lines (timeout 10 linear issue list -s started -s unstarted --json --no-input 2>/dev/null \ + | jq -r '.[] | "\(.identifier)\t\(.title)"' 2>/dev/null) + _status_clear + + set -l picked (printf '%s\n' $lines | fzf --prompt="Linear> " --height=100% --reverse \ + --multi --print-query --delimiter=\t --bind='enter:accept-or-print-query' \ + --header='tab: select · type issue IDs or a project slug · esc: skip') + test $status -le 1; or return 0 + + # Selected list lines win; otherwise read issue IDs and one project from the query. + set -l issues + set -l project + set -l selected (string match -- '*'\t'*' $picked[2..-1]) + if test (count $selected) -gt 0 + for line in $selected + set -a issues (string split -f1 \t -- "$line") + end + else + for token in (string split -n ' ' -- "$picked[1]") + if string match -rq '^[A-Za-z]+-[0-9]+$' -- "$token" + set -a issues (string upper -- "$token") + else if test -z "$project" + set project "$token" + end + end + end + test (count $issues) -gt 0 -o -n "$project"; or return 0 + + begin + echo --- + echo linear: + test -n "$project"; and echo " project: $project" + test (count $issues) -gt 0; and echo " issues: ["(string join ', ' -- $issues)"]" + echo --- + end >"$file" +end + # --- Workspace trust --- # Trust the workspace in every harness, so agent-team siblings of any kind @@ -785,6 +833,7 @@ if test "$space_type" = Workspace _status_clear _trace "workspace: selecting agent" select_agent; or exit 0 + _pick_linear_context "$workspace_path" _trace "workspace: launching" set ws_label (_workspace_label "$repo_name" "$bookmark") diff --git a/herdr/tests/start-workspace.fish b/herdr/tests/start-workspace.fish index 2274a2a0..297d067c 100755 --- a/herdr/tests/start-workspace.fish +++ b/herdr/tests/start-workspace.fish @@ -68,6 +68,8 @@ function write_stubs --argument-names home ' else' \ ' echo "$bm_lines[1]"' \ ' end' \ + ' case "Linear> "' \ + ' exit 130' \ ' case "Agent> "' \ ' if test -n "$FZF_AGENT_CHOICE"' \ ' echo "$FZF_AGENT_CHOICE"' \ @@ -118,6 +120,7 @@ function write_stubs --argument-names home printf '%s\n' "#!$real_fish --no-config" 'exit 0' >"$stub_bin/claude" printf '%s\n' "#!$real_fish --no-config" 'exit 0' >"$stub_bin/agy" printf '%s\n' "#!$real_fish --no-config" 'exit 0' >"$stub_bin/pi" + printf '%s\n' "#!$real_fish --no-config" 'exit 1' >"$stub_bin/linear" printf '%s\n' "#!$real_fish --no-config" 'exit 1' >"$stub_bin/timeout" if test -n "$real_setsid" printf '%s\n' \ @@ -128,7 +131,7 @@ function write_stubs --argument-names home end chmod +x "$stub_bin/fzf" "$stub_bin/herdr" "$stub_bin/jj" \ "$stub_bin/ssh" "$stub_bin/codex" "$stub_bin/claude" \ - "$stub_bin/agy" "$stub_bin/pi" "$stub_bin/timeout" + "$stub_bin/agy" "$stub_bin/pi" "$stub_bin/linear" "$stub_bin/timeout" end function setup_case --argument-names name diff --git a/mise.lock b/mise.lock index 98653143..91fbe802 100644 --- a/mise.lock +++ b/mise.lock @@ -1799,3 +1799,50 @@ checksum = "sha256:0cdc5b38fe5a8168ed6a25814f5ba43c21d313dd3187314fccb37b7cec46e url = "https://github.com/astral-sh/uv/releases/download/0.13.7/uv-x86_64-pc-windows-msvc.zip" url_api = "https://api.github.com/repos/astral-sh/uv/releases/assets/704009796" provenance = "github-attestations" + +[[tools.yq]] +version = "4.54.3" +backend = "aqua:mikefarah/yq" +specifiers = ["latest"] + +[tools.yq."platforms.linux-arm64"] +checksum = "sha256:89f69310b61b68d1245065a1241d1fc843f7a36cd6103ffd77ad987613bd1b67" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_linux_arm64" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219924" +provenance = "cosign" + +[tools.yq."platforms.linux-arm64-musl"] +checksum = "sha256:89f69310b61b68d1245065a1241d1fc843f7a36cd6103ffd77ad987613bd1b67" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_linux_arm64" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219924" +provenance = "cosign" + +[tools.yq."platforms.linux-x64"] +checksum = "sha256:129534601871538efe0ba4c5e62a34fb1d5f469bcb975c4fddeb467d82974973" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_linux_amd64" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219936" +provenance = "cosign" + +[tools.yq."platforms.linux-x64-musl"] +checksum = "sha256:129534601871538efe0ba4c5e62a34fb1d5f469bcb975c4fddeb467d82974973" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_linux_amd64" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219936" +provenance = "cosign" + +[tools.yq."platforms.macos-arm64"] +checksum = "sha256:a2aebb93b5bdcb61bb76f630e42a0ef6a3ee10842a6516cd7b9e4080786ec593" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_darwin_arm64" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219940" +provenance = "cosign" + +[tools.yq."platforms.macos-x64"] +checksum = "sha256:96d5105ffd693d6845c54fbd825b2d1bbdb8619e0a2ce6af95e5654e841e0984" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_darwin_amd64" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219934" +provenance = "cosign" + +[tools.yq."platforms.windows-x64"] +checksum = "sha256:066ea0a09a282e47588ec1e1867280ff5ede458f7183617a2d99012e4e34f18a" +url = "https://github.com/mikefarah/yq/releases/download/v4.54.3/yq_windows_amd64.exe" +url_api = "https://api.github.com/repos/mikefarah/yq/releases/assets/726219881" +provenance = "cosign" diff --git a/mise.toml b/mise.toml index 1641bb6d..d527886b 100644 --- a/mise.toml +++ b/mise.toml @@ -64,6 +64,7 @@ ln -fsT "$nvim_path" "$HOME/.local/bin/vi" pi = "latest" ruff = "latest" usage = "latest" +yq = "latest" # Python dependency graphs need uv >= 0.12.10; Fedora 44 ships 0.12.9, so dnf # cannot satisfy it. dnf:uv stays for the post-packages hook that runs before diff --git a/mise/conf.d/git.toml b/mise/conf.d/git.toml index 7206c1e0..e9e07645 100644 --- a/mise/conf.d/git.toml +++ b/mise/conf.d/git.toml @@ -1,5 +1,6 @@ [dotfiles] "~/.gitconfig" = "../../git/gitconfig" +"~/.config/git/ignore" = "../../git/ignore" [bootstrap.packages] "dnf:git" = "latest" diff --git a/mise/conf.d/pi.toml b/mise/conf.d/pi.toml index 037f0713..a20956bb 100644 --- a/mise/conf.d/pi.toml +++ b/mise/conf.d/pi.toml @@ -3,4 +3,5 @@ "~/.pi/agent/models.json" = "../../pi/models.json" "~/.pi/agent/themes/nord-dark.json" = "../../pi/themes/nord-dark.json" "~/.pi/agent/themes/nord-claude.json" = "../../pi/themes/nord-claude.json" +"~/.pi/agent/extensions/linear-context.ts" = "../../pi/extensions/linear-context.ts" diff --git a/pi/extensions/linear-context.ts b/pi/extensions/linear-context.ts new file mode 100644 index 00000000..2bbb9861 --- /dev/null +++ b/pi/extensions/linear-context.ts @@ -0,0 +1,22 @@ +// Add the workspace's .linear-context.md to the system prompt. +// Runs the shared session-start hook once per session and caches its output. +import { execFileSync } from "node:child_process"; +import { homedir } from "node:os"; + +export default function (pi: any) { + let context = ""; + pi.on("session_start", async () => { + try { + context = execFileSync(`${homedir()}/.agents/hooks/linear-context.sh`, [], { + input: "", + timeout: 20000, + }).toString(); + } catch { + context = ""; + } + }); + pi.on("before_agent_start", async (event: any) => { + if (!context) return; + return { systemPrompt: `${event.systemPrompt}\n\n${context}` }; + }); +}