Skip to content

feat(desktop): always-on skills injected into every new task - #76742

Draft
adboio wants to merge 4 commits into
masterfrom
posthog-code/always-on-skills-v2
Draft

feat(desktop): always-on skills injected into every new task#76742
adboio wants to merge 4 commits into
masterfrom
posthog-code/always-on-skills-v2

Conversation

@adboio

@adboio adboio commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Ports PostHog/code#4059 into products/desktop/. The source repo is frozen after the desktop import, so the PR is remade here to land, per products/desktop/MIGRATION.md.

Original problem statement:

Skills only activate today when a task's prompt explicitly references them (/name or a composer skill chip). There's no way to say "apply this skill to everything I do" — the way a channel's CONTEXT.md is injected automatically, or the way a SessionStart-hook plugin (e.g. i-have-adhd) puts its instructions in context from turn one.

Refs PostHog/code#3735 (earlier attempt, auto-closed as stale; this supersedes it).

Changes

  • Always-on toggle on installed skills (Skills settings: switch on each card + detail panel) for user/marketplace/codex/bundled sources. Repo-source skills are excluded so behavior is identical for repo and repo-less tasks. Toggles persist in the settings store as {name, source} refs and re-resolve against the live skill list at task creation, so moved/deleted skills self-heal.
  • Cloud tasks reuse the existing skill-bundle pipeline: resolved refs are appended to the transport's skillBundles (uploaded with the first message, warm and cold paths) and a <always_on_skills> manifest of /name mentions is folded into the first message, which the sandbox's existing inliner expands into each bundle's full SKILL.md. Zero sandbox/server changes.
  • Local tasks inline each SKILL.md body into the initial prompt (read via the existing skills.readFile tRPC), with per-skill/total size caps degrading to path references.
  • The injected block is stripped from the transcript and shown as an "Always-on skills (n)" chip; prompt recall and echo dedupe strip it too.
  • Composer preview: the "Using:" row on the new-task page and the strip above the channel feed composer (next to the cloud/local selector) show a chip per always-on skill the next task will carry.
  • Per-task exclusion: each chip has an X that skips that skill for the task being composed only. The exclusion rides TaskCreationInput.excludedAlwaysOnSkills through the creation saga, so the preview and the injected set stay in lockstep. Clicking the chip body opens Settings, Skills to toggle it off globally.

How did you test this code?

  • Ported the source PR's two commits with git am -3 --directory=products/desktop/, then re-applied the in-flight per-task exclusion change as a third commit. Two conflicts against newer commits in the imported tree were resolved so collapsePiSkillInvocation (fix(ui): collapse Pi skill invocations code#4056) composes with the always-on strip in UserMessage.tsx and ChatThread.tsx.
  • From products/desktop/: pnpm install --frozen-lockfile, pnpm typecheck (24/24 packages green), and full unit suites on the touched packages: @posthog/core 2994, @posthog/ui 2511, @posthog/shared 780, all passing.
  • Biome: the ported commits passed lint on the source repo's CI. The single-core port sandbox could not complete a local biome run, so the lint gate rides on this PR's desktop-quality workflow.
  • I did not manually run the app; the feature carries its unit coverage from the source PR.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

No desktop docs cover skills settings yet; nothing to update.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • I (actually Claude, via a PostHog Code cloud task) ported this from feat(skills): always-on skills injected into every new task code#4059 following the repo's porting-code-prs skill: git am --directory=products/desktop/ preserved the original commits and their authorship.
  • The third commit recreates work from the source PR's authoring session that was never pushed there (recovered from the session transcript and replayed, then re-verified here).
  • Assignee is the source PR author and driver.

Created with PostHog Code

adboio added 3 commits August 3, 2026 10:50
Per-skill "Always-on" toggle (user/marketplace/codex/bundled sources) that
injects toggled skills into every new task's first message — like a channel's
CONTEXT.md — on both cloud and local runs.

Cloud rides the existing bundle-upload pipeline: refs append to the
transport's skillBundles and a /name manifest folds into the first message so
the sandbox's existing inliner picks them up. Local inlines SKILL.md bodies
into initialPrompt via the existing skills.readFile surface. Refs persist as
{name, source} in the settings store and re-resolve at creation, so moved or
deleted skills self-heal. The transcript collapses the injected block into an
"Always-on skills (n)" chip.

Generated-By: PostHog Code
Task-Id: 4e1d8b15-54b7-4555-a21f-150eead107f4
Shows the skills that will be auto-injected into the next task as chips in
the new-task page's "Using:" row (beside the channel CONTEXT.md chip) and in
the channel feed composer's floating row next to the local/cloud selector.
Clicking a chip opens the skill in Settings; the X turns its always-on toggle
off globally. Chips render from the same resolution the saga uses at creation,
so stale refs never show.

Generated-By: PostHog Code
Task-Id: 4e1d8b15-54b7-4555-a21f-150eead107f4
The chip X in the composer "Using:" row skips that always-on skill for
the task being composed only: the exclusion rides
TaskCreationInput.excludedAlwaysOnSkills through the creation saga and
is subtracted when the host resolves the always-on set. Global toggles
are untouched; clicking the chip body opens Settings -> Skills for the
permanent off. Recreates in-flight work from the source-repo session
that never reached PostHog/code#4059.

Generated-By: PostHog Code
Task-Id: 4e1d8b15-54b7-4555-a21f-150eead107f4
@adboio adboio self-assigned this Aug 3, 2026
@trunk-io

trunk-io Bot commented Aug 3, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hey @adboio! 👋

It looks like your git author email on this PR isn't your @posthog.com address (adambowker98@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Aug 3, 2026
Biome useExhaustiveDependencies caught that handleSubmit closed over a
stale exclusion list: excluding a skill via the chip X and submitting
without a re-render would have ignored the exclusion.

Generated-By: PostHog Code
Task-Id: 4e1d8b15-54b7-4555-a21f-150eead107f4
@trunk-io

trunk-io Bot commented Aug 3, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/desktop Feature Tag: Desktop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant