Logo de Homoiconic Meta Schema

Homoiconic Meta Schema

Comunidade
AnthonyAlcaraz
homoiconic-meta-schema

Homoiconic knowledge representation (Ch3) — code and data share the same representation so an agent can inspect and modify its own knowledge structures with the same machinery it uses for regular data. Two constructs: (1) meta- knowledge structures (Example 3-6) — validate an entity-type against the metaschema AND a data instance against its entity-type using the SAME validator at both levels; (2) executable knowledge patterns (Example 3-7) — parse, validate, and evaluate Rule entities with a tiered WHEN/THEN/ELSE action against facts. Use when building self-evolving agents that reason about / modify their own schema, when storing business rules as queryable graph data instead of hidden application code, or when validating agent-proposed schema extensions. NOT for static schemas that never change (a plain class/struct is simpler), NOT for executing arbitrary code (this evaluates a constrained tiered-rule grammar, not a general interpreter), NOT for the schema PATTERN choice (use schema-pattern-selector).

Visão geral

Publicado porAnthonyAlcaraz
Repositórioagentic-graph-rag-skills
Nome da habilidadehomoiconic-meta-schema
Estrelas
29
Forks
9
Arquivos incluídos
2
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

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

  • Arquivos incluídos: 2

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

  • Código aberto

    Publicada por AnthonyAlcaraz no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Homoiconic Meta Schema 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 abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/knowledge-representation/homoiconic-meta-schema
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do 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/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/knowledge-representation/homoiconic-meta-schema .claude/skills/homoiconic-meta-schema
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Homoiconic Meta Schema 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 Homoiconic Meta Schema 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, Homoiconic Meta Schema 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á.

Homoiconic Meta-Schema

Overview

Agent-friendly knowledge graphs need homoiconicity: code and data in the same representation, so agents can inspect and modify their own operational logic. Ch3 gives two constructs.

Meta-knowledge structures (Example 3-6). A metaschema describes the schema itself — it defines what an EntityType is (a name, a description, a list of property definitions). Then domain knowledge is stored using the same representation: a Person entity-type is just data with name, birth_date, occupation properties. The syntax of schema and data is identical. This skill runs the same validation at both levels: validate_entity_type checks a type against the metaschema; validate_data_against_type checks an instance against its type. Same machinery, two levels — that is the homoiconic property doing real work. It lets agents reason about knowledge completeness, dynamically update schemas as they learn, and self-evolve without external reprogramming.

Executable knowledge patterns (Example 3-7). Operational rules become first-class graph entities. A Rule has descriptive metadata, a condition (graph pattern match), and an action (tiered WHEN ... THEN SET ... / ELSE). Because the rule is data, agents can reason about rules, not just follow them — discover, modify, create rules, and explain decisions by citing the rule. This skill parses the tiered action, validates the rule has a parseable clause, and evaluates it in source order against facts (DetermineCustomerSegment: 25 purchases -> Premium, 15 -> Regular, 3 -> Basic). The DevOps OperationalRule (ValidateProductionDeployment) is the same construct applied to infrastructure.

When to Use

  • Building agents that reason about or modify their own schema (Ch7 self-evolution)
  • Storing business/operational rules as queryable graph data, not hidden code
  • Validating agent-proposed schema extensions before applying them
  • Representing the ontology itself as data the agent can query

Phrases: "homoiconic", "metaschema", "schema as data", "entity-type definition", "executable knowledge", "rule as graph entity", "self-evolving schema", "meta-knowledge".

When NOT to Use

  • Static schemas. If the schema never changes, a plain class/struct is simpler; homoiconicity pays off only when the agent modifies its own structure.
  • General code execution. evaluate_rule interprets a constrained tiered WHEN/THEN/ELSE grammar, NOT arbitrary code. Do not treat it as an interpreter for untrusted input.
  • Schema PATTERN selection. Use schema-pattern-selector to choose Event-Centric vs Multi-Perspective etc.; this validates the homoiconic meta-level and executable rules.

Process

StepInputActionOutputVerification
1entity-type definition dictlib.validate_entity_type(def){valid, errors}name required, property names unique, types valid
2entity-type + data instancelib.validate_data_against_type(type, instance){valid, errors}required props present, value types match (same validator level)
3Rule dict (name, condition, action)lib.validate_rule(rule){valid, errors, parsed_clauses}action must parse to >= 1 WHEN clause
4action textlib.parse_action(text){when: [...], else: {...}} in source ordertiered order preserved
5Rule + facts dictlib.evaluate_rule(rule, facts){field: value} or Nonefirst matching WHEN by source order, then ELSE

Rationalizations

Agent rationalizationDocumented rebuttal
"Schema and data are different things — keep the schema in code."That is exactly the non-homoiconic system the chapter contrasts against. When schema lives in code, the agent cannot inspect or evolve it. Storing the entity-type AS DATA (Example 3-6) is what lets the agent reason about completeness and self-evolve.
"Business rules belong in application code, not the graph."Then the agent can follow rules but never reason about them, modify them, or explain decisions by citing them. Example 3-7 makes rules first-class graph entities precisely to unlock those capabilities. Implicit procedural knowledge becomes explicit, queryable structure.
"I'll evaluate WHEN clauses in any order."Tiered rules depend on source order: >20 -> Premium must be checked before >10 -> Regular, or 25 purchases wrongly matches Regular first. parse_action and evaluate_rule preserve order on purpose.
"Duplicate property names are harmless."The chapter's AI-assisted ontology validation explicitly checks "property names are unique". Duplicates make the type ambiguous; the validator fails them.
"Skip data-instance validation — the type definition is enough."The homoiconic value is that the SAME validator works at both levels. Validating instances against their type is what catches the missing-required-field and wrong-type errors before they corrupt the graph.

Red Flags

  • Entity-type passes but instances of it keep failing required-field checks. The type declares fields the data pipeline never populates — the schema and the extractor disagree.
  • A Rule validates but evaluate_rule returns None for normal inputs. The action clauses don't cover the input range and there's no ELSE — add a default tier.
  • WHEN clauses out of order in the source. Tiered evaluation will match the wrong tier; reorder most-specific-first.
  • Agent proposes a schema extension with a property type outside the allowed set. Reject and surface — unchecked types are how schema drift enters a self-evolving system.

Non-Negotiable Verification

  1. Run the benchmark battery. python cli.py benchmark must report 10/10:
    • valid Person type passes; missing-name, duplicate-property, invalid-type fail
    • data instance: required-present passes, missing-required and wrong-type fail
    • rule parses 2 WHEN + 1 ELSE; tiered eval gives 25->Premium, 15->Regular, 3->Basic
    • rule missing action fails
  2. Run the scenario. python cli.py scenario customer-segment validates the Person type as data, validates an instance against it, and evaluates the segmentation rule across tiers.
  3. Verify CLI help. python cli.py --help exits 0 and prints this SKILL.md description (so any harness can discover the skill from --help).

Security Posture

  • Prompt injection. Entity-type definitions and Rule actions are untrusted data, often agent-proposed. The evaluator interprets only the constrained WHEN/THEN/ELSE grammar - never eval/exec - so injected text fails parsing rather than executing. A syntactically valid rule can still encode malicious LOGIC; review agent-proposed rules before storing them in the graph.
  • Data exfiltration. No network calls, no file writes. Facts passed to evaluate_rule stay in-process; results go to stdout and the caller owns downstream piping.
  • Privilege escalation. Self-modifying schemas are the escalation surface: an unchecked schema extension or rule rewrite widens what the agent may later assert. The validator rejects out-of-set property types, and rule evaluation returns a plain dict - it never mutates the graph or grants a capability; applying changes is a separate, gated step.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch3 — Knowledge Representation, section "Homoiconic Knowledge Representation": meta-knowledge structures (Example 3-6, the metaschema + Person entity-type) and executable knowledge patterns (Example 3-7, the DetermineCustomerSegment Rule). The DevOps OperationalRule (ValidateProductionDeployment) in the chapter's "Homoiconic Knowledge Representation for Agent Adaptability" section is the same construct applied to infrastructure, feeding the Ch7 self-evolution work.

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 Homoiconic Meta Schema faz?

Homoiconic knowledge representation (Ch3) — code and data share the same representation so an agent can inspect and modify its own knowledge structures with the same machinery it uses for regular data. Two constructs: (1) meta- knowledge structures (Example 3-6) — validate an entity-type against the metaschema AND a data instance against its entity-type using the SAME validator at both levels; (2) executable knowledge patterns (Example 3-7) — parse, validate, and evaluate Rule entities with a tiered WHEN/THEN/ELSE action against facts. Use when building self-evolving agents that reason abou...

Por que usar Homoiconic Meta Schema no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Homoiconic Meta Schema é escrita 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. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Homoiconic Meta Schema no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/knowledge-representation/homoiconic-meta-schema. 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 Homoiconic Meta Schema?

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 Homoiconic Meta Schema?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Homoiconic Meta Schema 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 Homoiconic Meta Schema é gratuita?

Sim. A habilidade é publicada no GitHub por AnthonyAlcaraz 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, templates 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 que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: 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 lista completa

Crie seu próprio espaço de trabalho com IA agora

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