Skip to content

Change piighost's code

This page is for whoever changes the code of piighost. For each common change, it points first to the page of the domain documentation that describes the rules involved, then to the files and tests to open. Read the rule before touching the code that applies it.

Start locally

  • Stack: Python 3.11 or later, uv package manager. The core depends only on typing-extensions. Everything else is an extra of pyproject.toml (langchain, redis, gliner2, config…), and all gathers them.
  • Install: uv sync at the root of the repository.
  • Test: uv run pytest, then make lint before any merge. Details in Run and write tests.
  • Try: uv run piighost anonymize "Write to claire.dubois@example.com". The first run downloads the catalog group catalog:piighost/generic.
  • Services: none for the tests. Redis, an SQL database or piighost-api are used only in operation. See Store conversations and Configure a pipeline.
  • Examples: standalone scripts in examples/, run with uv run examples/<script>.py.

Find where to change

Type of changeRead firstThen
Add a detectorAdd or replace a componentcomponents/detector/regex.py or components/detector/ner/spacy.py, config/models/detector_model.py, tests/components/detector/test_contract.py
Change how overlaps are arbitratedProtect a messagecomponents/overlap_resolver/, tests/components/overlap_resolver/
Change the form of the placeholdersGlossary, Add or replace a componentcomponents/placeholder/, tags.py, tests/components/placeholder/
Touch the conversation or the human correctionFollow a conversationpipeline/thread.py, tests/pipeline/test_thread.py, test_thread_hitl.py
Change the deny list or the allow listImpose a deny list and an allow listcomponents/override/, tests/components/override/test_override.py
Change how tool calls are handledLet a tool actintegrations/langchain/middleware.py (awrap_tool_call), integrations/pydantic_ai/hooks.py, tests/integrations/langchain/test_middleware.py
Change the stream restorationShow a streamed replycomponents/placeholder/streaming.py, tests/components/placeholder/test_streaming*.py
Add an acceptance testAcceptance teststests/acceptance/, an AT-<need>-<n> identifier in the docstring
Add a configuration keyConfigure a pipelineconfig/models/, config/settings.py, tests/config/
Change the piighost commandConfigure a pipelinecli/__init__.py, tests/cli/test_cli.py
Add a storage or change the encryptionStore conversationsconversation_memory/, crypto/, tests/conversation_memory/
Change the LangChain middleware or another integrationPlug the protection into an agentintegrations/, integrations/_deidentify.py, tests/integrations/
Add a tool to the Claude Code hooksPlug the protection into an agentintegrations/claude_code/hooks.py (_TOOL_OUTPUT_TEXT_FIELDS), tests/integrations/test_claude_code_hooks.py

For how a contribution goes (branch, commits, review), see Contributing.