Logo de Branch Context

Branch Context

Organização
pydantic
branch-context

Branch-local durable PR state -- issue brief, decisions log, and session handoffs. Read the brief, decisions, and latest handoff at session start; append decisions as you work; write a handoff only on user request or explicit session turnover.

Visão geral

Publicado porpydantic
Repositóriopydantic-ai-harness
Nome da habilidadebranch-context
Estrelas
954
Forks
150
Arquivos incluídos
6
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 6 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por pydantic no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Branch Context no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/pydantic/pydantic-ai-harness/tree/main/.agents/skills/branch-context
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pydantic/pydantic-ai-harness.git /tmp/pydantic-ai-harness
mkdir -p .claude/skills
cp -r /tmp/pydantic-ai-harness/.agents/skills/branch-context .claude/skills/branch-context
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Branch Context em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Branch Context automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Branch Context não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Branch Context

This directory is the home for durable PR/branch state that outlives a single session. Three surfaces:

File / dirRoleLifetime
issue-brief.mdSynthesis of the issue(s) this branch addressesRewritten only when adopting or re-syncing a branch
pr-decisions.mdAppend-only log of non-obvious PR-shaping decisionsAppend forever; supersede, never edit
handoffs/ + handoffs-index.mdAppend-only session handoffs for the next agentNever overwrite a handoff file; index points at the latest

The instances (issue-brief.md, pr-decisions.md, handoffs-index.md, handoffs/) are per-branch and git-ignored. The scaffolding (this file, the scripts, the *.template.md files) is committed. Instantiate the instances from the templates, or via /adopt-pr when a PR already exists.

Session defaults

On start, before coding:

  1. Confirm the branch matches the brief's branch: field (git rev-parse --abbrev-ref HEAD).
  2. Read issue-brief.md, pr-decisions.md, and handoffs-index.md.
  3. Read the latest handoff -- the last entry in handoffs-index.md points at its file under handoffs/. That is what the previous session left for you. If the index has no entries, there is no handoff yet; start from the brief.
  4. If the brief is still the unfilled template, populate it first: run /adopt-pr when a PR already exists, or write it from the linked issue when starting fresh.

While working -- persist without being asked:

  • A non-obvious decision (picking path A over B, a plan deviation, an ambiguous thread resolution) goes into pr-decisions.md via append-pr-decision.sh in the same turn you make it, not "later".
  • Disk in this directory is the continuity channel, not chat history. Do not rely on the conversation surviving a context clear or a new session.
  • Do not write a handoff because the context "feels full" -- that misjudges and primes an early stop. Write a handoff only when the user asks, or when session turnover is already decided (the user is clearing, switching tools, or ending the sitting).

When to write each surface

issue-brief.md

Rewritten only when adopting a branch (/adopt-pr) or re-syncing after new issue activity. Do not freestyle-edit it mid-session.

pr-decisions.md

Append whenever you make a decision the issue did not already spell out:

bash
.claude/skills/branch-context/append-pr-decision.sh \
  --title "<short title>" \
  --decision "<one-line decision>" \
  --why "<one-line why>" \
  --source "<source url -- mandatory>" \
  [--iter N] [--supersedes "<earlier title>"]

Named flags are preferred (they resist arg-order mistakes). Positional order is title decision why source [iter] [supersedes] -- do not pass iter as the second argument.

Entry shape (the script writes this):

## YYYY-MM-DD · <short title> · iter <N or "-">
- Decision: <one line>
- Why: <one line>
- Source: <link -- mandatory>
- Supersedes: <earlier title, if applicable>

When the decision restates a modal claim (always / never / only if / must / unless), quote that clause verbatim instead of paraphrasing -- "always X unless Y" compressed to "always X" is a different instruction.

Handoffs

One handoff per session, newest last. Never overwrite another session's handoff.

bash
.claude/skills/branch-context/append-handoff.sh [--writer <name>] "<one-line summary>" [path-to-body.md]

--writer tags the index line with the skill that produced the handoff. If you omit the body path, the script writes a stub you must fill in via Write/Edit before stopping; prefer writing the full body first and passing its path. To revise a handoff you already wrote this session, edit the file in place rather than appending a second index entry.

Handoff body sections (required):

markdown
# Handoff · YYYY-MM-DD · <summary>

## Done
- ...

## Next
- ... (ordered; first item is what the next agent starts on)

## Commitments & constraints carried forward
- ... (verbatim; or "none")

## Key paths
- `path` -- why

## Open questions
- ... (or "none")

## Branch-context pointers
- Brief: issue-brief.md (still valid? yes/no)
- Decisions appended this session: <titles or "none">
- Related plan file (if any): <path>

Commitments & constraints is a required check, not an optional extra. Before writing the handoff, sweep the session for two things and quote them verbatim -- do not paraphrase, the modality is the payload:

  • Constraints the user stated that are not already in the brief's Constraints section. "Always X unless Y" and "always X" are different instructions, and a one-line paraphrase is where the qualifier gets dropped.
  • Promises you made and have not kept -- to the user ("I'll add the regression test next"), or on the record in a PR/review comment ("I'll file a follow-up issue", "I'll re-run this once CI clears"). A promise made to a reviewer and then dropped across a session boundary is the expensive kind: the next agent cannot know it exists, and the reviewer is still waiting.

A longer, accurate handoff beats a short lossy one. Do not compress this section to save space.

Session turnover

Write the handoff (and any unlogged decisions) when the user turns the session over. If the harness has a plan mode, capture the remaining work as a concrete plan (next steps, files, verification), persist the handoff, then exit plan mode so the fresh session inherits it. If the harness has no plan mode, persist the handoff and tell the user to start a new session in this worktree whose first action is to read handoffs-index.md and the latest handoff.

Scope boundary

  • Not for research notes or repro scripts -- those belong outside this directory.
  • Not for durable codebase facts that outlive the PR -- those belong in longer-lived project docs or memory. Rule of thumb: if removing the linked thread would make this PR's diff confusing, it is a decision; if the fact still helps after merge, it belongs elsewhere.

Helpers

bash
.claude/skills/branch-context/status.sh              # JSON: brief/decisions/handoffs state
.claude/skills/branch-context/append-pr-decision.sh ...
.claude/skills/branch-context/append-handoff.sh ...

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Branch Context faz?

Branch-local durable PR state -- issue brief, decisions log, and session handoffs. Read the brief, decisions, and latest handoff at session start; append decisions as you work; write a handoff only on user request or explicit session turnover.

Por que usar Branch Context no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Branch Context é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Branch Context no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/pydantic/pydantic-ai-harness/tree/main/.agents/skills/branch-context. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Branch Context?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Branch Context?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Branch Context com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Branch Context é gratuita?

Sim. A habilidade é publicada no GitHub por pydantic sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇