Context guardian

From diegosouzapw/awesome-omni-skills · View interactive version

Context guardian is an AI agent skill from the GitHub repository diegosouzapw/awesome-omni-skills. Context Guardian workflow skill. Use this skill when the user needs Guardiao de contexto que preserva dados criticos antes da compactacao automatica. Snapshots, verificacao de integridade e zero perda de informacao and the operator should preserve the upstream workflow, copied support files, and pro

How to use this skill

Skill file

Context Guardian

Overview

This public intake copy packages plugins/antigravity-awesome-skills-claude/skills/context-guardian from https://github.com/sickn33/antigravity-awesome-skills into the native Omni Skills editorial shape without hiding its origin.

Use it when the operator needs the upstream workflow, support files, and repository context to stay intact while the public validator and private enhancer continue their normal downstream flow.

This intake keeps the copied upstream files intact and uses the external_source block in metadata.json plus ORIGIN.md as the provenance anchor for review.

Context Guardian

Imported source sections that did not map cleanly to the public headings are still preserved below or in the support files. Notable imported sections: How It Works, Por Que Isto Existe, Localizacao, Integracao Com O Ecossistema, Ativacao Automatica (O Claude Deve Iniciar Sozinho), Ativacao Manual (Usuario Solicita).

When to Use This Skill

Use this section as the trigger filter. It should make the activation boundary explicit before the operator loads files, runs commands, or opens a pull request.

Operating Table

| Situation | Start here | Why it matters |

| --- | --- | --- |

| First-time use | metadata.json | Confirms repository, branch, commit, and imported path through the external_source block before touching the copied workflow |

| Provenance review | ORIGIN.md | Gives reviewers a plain-language audit trail for the imported source |

| Workflow execution | references/extraction-protocol.md | Starts with the smallest copied file that materially changes execution |

| Supporting context | references/verification-checklist.md | Adds the next most relevant copied source file without loading the entire package |

| Handoff decision | ## Related Skills | Helps the operator switch to a stronger native skill when the task drifts |

Workflow

This workflow is intentionally editorial and operational at the same time. It keeps the imported source useful to the operator while still satisfying the public intake standards that feed the downstream enhancer flow.

  1. Confirm the user goal, the scope of the imported workflow, and whether this skill is still the right router for the task.
  2. Read the overview and provenance files before loading any copied upstream support files.
  3. Load only the references, examples, prompts, or scripts that materially change the outcome for the current request.
  4. Execute the upstream workflow while keeping provenance and source boundaries explicit in the working notes.
  5. Validate the result against the upstream expectations and the evidence you can point to in the copied files.
  6. Escalate or hand off to a related skill when the work moves out of this imported workflow's center of gravity.
  7. Before merge or closure, record what was used, what changed, and what the reviewer still needs to verify.

Imported Workflow Notes

Imported: Overview

Guardiao de contexto que preserva dados criticos antes da compactacao automatica. Snapshots, verificacao de integridade e zero perda de informacao.

Imported: How It Works

Sistema de integridade de contexto que protege projetos tecnicoss complexos contra

perda de informacao durante compactacao automatica do Claude Code. Enquanto o

context-agent atua APOS as sessoes (save/load), o context-guardian atua DURANTE

a sessao, detectando quando a compactacao esta proxima e executando protocolos de

preservacao com verificacao redundante.

Examples

Example 1: Ask for the upstream workflow directly

Use @context-guardian to handle <task>. Start from the copied upstream workflow, load only the files that change the outcome, and keep provenance visible in the answer.

Explanation: This is the safest starting point when the operator needs the imported workflow, but not the entire repository.

Example 2: Ask for a provenance-grounded review

Review @context-guardian against metadata.json and ORIGIN.md, then explain which copied upstream files you would load first and why.

Explanation: Use this before review or troubleshooting when you need a precise, auditable explanation of origin and file selection.

Example 3: Narrow the copied support files before execution

Use @context-guardian for <task>. Load only the copied references, examples, or scripts that change the outcome, and name the files explicitly before proceeding.

Explanation: This keeps the skill aligned with progressive disclosure instead of loading the whole copied package by default.

Example 4: Build a reviewer packet

Review @context-guardian using the copied upstream files plus provenance, then summarize any gaps before merge.

Explanation: This is useful when the PR is waiting for human review and you want a repeatable audit packet.

Best Practices

Treat the generated public skill as a reviewable packaging layer around the upstream repository. The goal is to keep provenance explicit and load only the copied source material that materially improves execution.

Imported Operating Notes

Imported: Best Practices

Troubleshooting

Problem: The operator skipped the imported context and answered too generically

Symptoms: The result ignores the upstream workflow in plugins/antigravity-awesome-skills-claude/skills/context-guardian, fails to mention provenance, or does not use any copied source files at all.

Solution: Re-open metadata.json, ORIGIN.md, and the most relevant copied upstream files. Check the external_source block first, then restate the provenance before continuing.

Problem: The imported workflow feels incomplete during review

Symptoms: Reviewers can see the generated SKILL.md, but they cannot quickly tell which references, examples, or scripts matter for the current task.

Solution: Point at the exact copied references, examples, scripts, or assets that justify the path you took. If the gap is still real, record it in the PR instead of hiding it.

Problem: The task drifted into a different specialization

Symptoms: The imported skill starts in the right place, but the work turns into debugging, architecture, design, security, or release orchestration that a native skill handles better.

Solution: Use the related skills section to hand off deliberately. Keep the imported provenance visible so the next skill inherits the right context instead of starting blind.

Related Skills

Additional Resources

Use this support matrix and the linked files below as the operator packet for this imported skill. They should reflect real copied source material, not generic scaffolding.

| Resource family | What it gives the reviewer | Example path |

| --- | --- | --- |

| references | copied reference notes, guides, or background material from upstream | references/extraction-protocol.md |

| examples | worked examples or reusable prompts copied from upstream | examples/n/a |

| scripts | upstream helper scripts that change execution or validation | scripts/context_snapshot.py |

| agents | routing or delegation notes that are genuinely part of the imported package | agents/n/a |

| assets | supporting assets or schemas copied from the source package | assets/n/a |

Imported Reference Notes

Imported: Por Que Isto Existe

O Claude Code compacta automaticamente mensagens antigas quando o contexto se

aproxima do limite da janela. Essa compactacao e heuristica — ela resume mensagens

para liberar espaco, mas inevitavelmente perde detalhes. Para projetos simples,

isso funciona bem. Mas para projetos tecnicos pesados (como ecossistemas com 21+

skills, auditorias de seguranca, refatoracoes de arquitetura), a perda de um unico

detalhe pode causar regressoes, re-trabalho ou inconsistencias graves.

O context-guardian resolve isso criando uma camada de protecao PRE-compactacao:

extrai, classifica, verifica e persiste todas as informacoes criticas ANTES que a

compactacao automatica as destrua.

Imported: Localizacao
C:\Users\renat\skills\context-guardian\
├── SKILL.md                          # Este arquivo
├── references/
│   ├── extraction-protocol.md        # Protocolo detalhado de extracao
│   └── verification-checklist.md     # Checklist de verificacao e redundancia
└── scripts/
    └── context_snapshot.py           # Script de snapshot automatico
Imported: Integracao Com O Ecossistema
context-guardian (PRE-compactacao)    context-agent (POS-sessao)
         │                                    │
         ├── Detecta contexto grande          ├── Salva resumo ao final
         ├── Extrai dados criticos            ├── Atualiza ACTIVE_CONTEXT.md
         ├── Verifica integridade             ├── Sincroniza MEMORY.md
         ├── Salva snapshot verificado        ├── Indexa busca FTS5
         └── Gera briefing de transicao       └── Arquiva sessoes antigas

O context-guardian e o context-agent sao complementares:

Imported: Ativacao Automatica (O Claude Deve Iniciar Sozinho)
  1. Limite de contexto: quando perceber que ja consumiu ~60-70% da janela de

contexto (indicadores: mensagens comecando a ser resumidas, aviso de compactacao)

  1. Projetos pesados: sessoes com muitos arquivos editados, muitas tool calls,

ou projetos com dependencias complexas entre componentes

  1. Antes de tarefas longas: quando uma proxima tarefa pode gerar output extenso

que empurraria o contexto para alem do limite

Imported: Ativacao Manual (Usuario Solicita)
Imported: Fase 1: Extracao Estruturada

Percorrer toda a conversa ate o momento e extrair categorias criticas.

Para cada categoria, classificar por prioridade (P0 = perda fatal, P1 = perda grave,

P2 = perda toleravel).

P0 — Perda Fatal (preservar com redundancia tripla)

| Categoria | O que extrair | Exemplo |

|-----------|--------------|---------|

| Decisoes tecnicas | Escolhas de arquitetura, padrao, tecnologia E motivo | "Usamos parameterized queries porque f-strings causam SQL injection" |

| Estado de tarefas | O que foi feito, o que falta, dependencias | "18/18 match OK, falta ZIP" |

| Correcoes aplicadas | Bug, causa raiz, solucao exata, arquivos afetados | "instagram/db.py: SQL injection via f-string → ? placeholders" |

| Codigo gerado/modificado | Caminho exato, linhas alteradas, natureza da mudanca | "match_skills.py:40-119: adicionou 5 categorias" |

| Erros encontrados | Mensagem exata, stack trace relevante, como resolveu | "TypeError at line 45 → cast para int" |

| Comandos que funcionaram | Comando completo que produziu resultado correto | "python verify_zips.py → 22/22 OK" |

P1 — Perda Grave (preservar com verificacao)

| Categoria | O que extrair |

|-----------|--------------|

| Padroes descobertos | Convencoes, patterns de codigo observados |

| Dependencias entre componentes | "scan_registry.py E match_skills.py devem ter categorias identicas" |

| Preferencias do usuario | Idioma, estilo, nivel de detalhe, workflow preferido |

| Contexto de projeto | Estrutura de diretorios, arquivos-chave, proposito |

| Questoes em aberto | Perguntas sem resposta, ambiguidades nao resolvidas |

P2 — Perda Toleravel (resumo compacto)

| Categoria | O que extrair |

|-----------|--------------|

| Historico de tentativas | "Tentei X, nao funcionou por Y, entao Z" |

| Metricas de progresso | Contadores, tempos, tamanhos |

| Discussoes exploratórias | Brainstorm, opcoes consideradas e descartadas |

Imported: Fase 2: Verificacao De Integridade

Apos extrair, verificar que NADA critico foi omitido.

Checklist de Verificacao (executar mentalmente para cada item):

□ Cada arquivo modificado tem: caminho, natureza da mudanca, motivo
□ Cada bug corrigido tem: sintoma, causa raiz, solucao, arquivo
□ Cada decisao tem: o que, por que, alternativas descartadas
□ Cada tarefa pendente tem: descricao, prioridade, dependencias
□ Cada padrao/convencao tem: regra, motivo, exemplos
□ Nenhuma informacao de uma secao contradiz outra
□ Referencias cruzadas estao consistentes (ex: "18 queries testadas" aparece em
  multiplos lugares com o mesmo numero)
□ Caminhos de arquivo estao completos (absolutos, nao relativos)

Se qualquer item falhar, voltar a Fase 1 e re-extrair a informacao faltante.

Para detalhes sobre verificacao avancada, ler references/verification-checklist.md.

Imported: Fase 3: Persistencia Redundante

Salvar as informacoes extraidas em 3 camadas de redundancia:

Camada 1 — Snapshot estruturado (arquivo .md)

python C:\Users\renat\skills\context-guardian\scripts\context_snapshot.py save

Gera C:\Users\renat\skills\context-guardian\data\snapshot-YYYYMMDD-HHMMSS.md com

todas as informacoes extraidas em formato estruturado.

Se o script nao estiver disponivel, criar manualmente o arquivo seguindo o formato

descrito em references/extraction-protocol.md.

Camada 2 — MEMORY.md atualizado

Atualizar C:\Users\renat\.claude\projects\C--Users-renat-Skill-JUD\memory\MEMORY.md

com as informacoes P0 mais criticas em formato ultra-compacto. O MEMORY.md e carregado

automaticamente em toda nova sessao, entao ele e a ultima linha de defesa.

Camada 3 — Context-agent save

python C:\Users\renat\skills\context-agent\scripts\context_manager.py save

Aciona o context-agent para salvar sessao completa com indexacao FTS5.

Imported: Fase 4: Briefing De Transicao

Gerar um bloco de texto formatado que serve como "cartao de visita" para o Claude

que continuar apos a compactacao. Este briefing deve ser a ULTIMA coisa escrita antes

da compactacao, para que fique no topo do contexto compactado.

Formato do briefing:


#### Imported: Estado Atual

- Projeto: [nome]
- Fase: [fase atual]
- Progresso: [X/Y tarefas completas]

#### Imported: O Que Foi Feito Nesta Sessao

1. [tarefa 1 — resultado]
2. [tarefa 2 — resultado]
...

#### Imported: O Que Falta Fazer

1. [tarefa pendente — prioridade] [dependencia se houver]
2. ...

#### Imported: Decisoes Criticas (Nao Alterar Sem Motivo)

- [decisao 1]: [motivo]
- [decisao 2]: [motivo]

#### Imported: Correcoes Aplicadas (Nao Reverter)

- [arquivo]: [correcao] — [motivo]

#### Imported: Caminhos Importantes

- [caminho 1]: [proposito]
- [caminho 2]: [proposito]

#### Imported: Alertas

- [qualquer armadilha, edge case, ou cuidado especial]

#### Imported: Onde Recuperar Mais Informacoes

- Snapshot: C:\Users\renat\skills\context-guardian\data\snapshot-[timestamp].md
- MEMORY.md: carregado automaticamente
- Context-agent: `python context_manager.py load`
- Busca historica: `python context_manager.py search "termo"`
Imported: Protocolo Rapido (Quando O Tempo E Curto)

Se a compactacao esta iminente e nao ha tempo para o protocolo completo de 4 fases:

  1. 30 segundos — Escrever um mini-briefing com: tarefas pendentes, decisoes

criticas, caminhos de arquivo modificados

  1. 1 minuto — Atualizar MEMORY.md com informacoes P0
  2. 2 minutos — Executar context-agent save

Mesmo o protocolo rapido e melhor que nenhuma protecao.

Imported: Deteccao De Completude Pos-Compactacao

Quando uma sessao continuar apos compactacao, verificar se o contexto preservado

esta completo:

  1. Ler MEMORY.md (ja estara carregado automaticamente)
  2. Se disponivel, ler o snapshot mais recente em data/
  3. Comparar com o briefing de transicao (se visivel no contexto compactado)
  4. Se encontrar lacunas, executar:

```bash

python C:\Users\renat\skills\context-agent\scripts\context_manager.py load

```

  1. Se ainda houver lacunas, buscar por termo:

```bash

python C:\Users\renat\skills\context-agent\scripts\context_manager.py search "termo"

```

Imported: Exemplo De Uso Real

Cenario: Sessao longa criando advogado-especialista (46KB), corrigindo match_skills

(5 categorias novas), auditando seguranca (10 vulnerabilidades), gerando 22 ZIPs.

Sem context-guardian:

Compactacao resume tudo em "criou skill juridica, corrigiu bugs, gerou zips".

Proximo Claude nao sabe quais categorias foram adicionadas, quais vulnerabilidades

foram corrigidas, qual o estado de cada ZIP, ou por que certas decisoes foram tomadas.

Resultado: re-trabalho, inconsistencias, regressoes.

Com context-guardian:

Antes da compactacao, executa protocolo completo:

Proximo Claude continua com precisao total, zero re-trabalho.

Imported: Consideracoes De Performance

mesmo se uma camada falhar, as outras duas preservam a informacao

Imported: Common Pitfalls
Imported: Limitations
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.