Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
日本語の概要は準備中です。原文の説明を表示しています。
Guide for adding a new RPC to personhog-replica and personhog-router. Covers eligibility checks, proto definition, code generation for Python and Node.js clients, Rust implementation (storage trait, postgres queries, service handler, router wiring), and index compatibility validation. Use when adding a new gRPC endpoint to personhog, migrating a Django ORM query to personhog, or extending the personhog service API.
日本語の概要は準備中です。原文の説明を表示しています。
実行スコア 未検証
インストール方法を見るインストールする前に、エージェントに与えられる指示の中身を確認できます。
This skill walks through adding a new RPC end-to-end: proto definition, code generation, Rust implementation, and client updates.
Personhog serves person, distinct ID, group, group type mapping, cohort membership, and feature flag hash key override data. If the data being accessed doesn't live in one of these tables, this RPC doesn't belong in personhog:
| Table | Data category | Routing |
|---|---|---|
posthog_person | PersonData | Reads: replica (eventual) or leader (strong). Writes: leader |
posthog_persondistinctid | PersonData | Same as person |
posthog_group | NonPersonData | All ops: replica |
posthog_grouptypemapping | NonPersonData | All ops: replica |
posthog_cohortpeople | NonPersonData | All ops: replica |
posthog_featureflaghashkeyoverride | NonPersonData | All ops: replica |
posthog_personoverride | PersonData | Reads/writes follow person routing |
posthog_personlessdistinctid | PersonData | Same as person |
If the table is not listed above, stop — this data should not go through personhog.
Before writing any proto, figure out the SQL query you need. Then validate it against the available indexes — see references/database-indexes.md.
Key questions:
All proto files live in proto/personhog/.
See references/proto-conventions.md for message conventions and a worked example.
proto/personhog/types/v1/<domain>.proto (person.proto, group.proto, cohort.proto, feature_flag.proto, or common.proto)proto/personhog/service/v1/service.proto (the public API clients call)proto/personhog/replica/v1/replica.proto (the internal API the router delegates to)proto/personhog/leader/v1/leader.proto (only if this is a person-data write routed to leader)The service and replica protos must both declare the RPC with identical signature. The router delegates from service → replica (or leader) transparently.
A leader-path request can be delivered more than once: clients retry UNAVAILABLE after ambiguous failures,
and the router internally replays fence- and transport-bounced requests.
Every leader RPC must therefore converge under redelivery —
read-only lookups, merges that re-apply to the same state, tombstone-style deletes, max-merge version floors —
or carry explicit operation identity so duplicates can be detected.
Note the precise contract: a convergent merge still loses to interleaving
(a replay can clobber a same-field write another caller made in between);
that residual is accepted today and closes with operation identity (see personhog-leader's README).
An RPC that neither converges nor carries identity (an unguarded increment, an append) must not be added.
If the operation you need fits neither shape, redesign it to carry an idempotency key before defining the proto.
bin/generate_personhog_proto.sh
Then update three files:
posthog/personhog_client/proto/__init__.py — add re-exports for new request/response message typesposthog/personhog_client/client.py — add a wrapper method matching the pattern of existing methodsposthog/personhog_client/fake_client.py — implement the method for test usecd nodejs && pnpm run generate:personhog-proto
Then update:
nodejs/src/common/personhog/groups.ts or persons.ts — add a wrapper method to the
matching operations class (PersonHogGroupOperations / PersonHogPersonOperations),
following the pattern of existing methods. client.ts only constructs and exposes
these operation objects; it holds no RPC wrappers itself.nodejs/src/common/personhog/client.test.ts — add a default stub to SERVICE_DEFAULTS for the new RPCNo generation step needed — tonic regenerates on cargo build.
But you must implement the RPC (next step), or the build will fail.
The compiler guides you — once the proto is defined, cargo build errors tell you exactly which trait methods are missing.
rust/personhog-replica/src/storage/traits/<domain>.rsrust/personhog-replica/src/storage/postgres/<domain>.rs
sqlx::query_as! or sqlx::query! macrosDB_QUERY_DURATION and DB_ROWS_RETURNED metricsself.replica_pool for reads, self.primary_pool for writesrust/personhog-replica/tests/storage_tests.rsrust/personhog-replica/src/service/mod.rs
Status codesrust/personhog-replica/tests/service_tests.rsrust/personhog-router/src/router/mod.rs
route_request function (imported from routing.rs) with the correct DataCategory and OperationTypecall_backend! macro for instrumentationrust/personhog-router/src/service/mod.rs
route_request! macro (defined at the top of this file) to delegate to the routerrust/personhog-router/src/backend/mod.rs and implement in replica.rsrust/personhog-router/tests/Use rstest parameterized tests where multiple variations of the same behavior are being tested.
cargo build -p personhog-proto
cargo build -p personhog-replica
cargo build -p personhog-router
cargo test -p personhog-replica
cargo test -p personhog-router
types/v1/<domain>.protoservice.proto and replica.proto (and leader.proto if needed)proto/__init__.py updated, client.py method added, fake_client.py updatedclient.test.ts SERVICE_DEFAULTS updatedcargo build and cargo test pass for all three cratesまだレビューはありません。使ってみた感想をお寄せください。
ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。
まだコメントはありません。最初のコメントを書いてみませんか。
Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
日本語の概要は準備中です。原文の説明を表示しています。
Automate 2chat tasks via Rube MCP (Composio). Always search tools first for current schemas.
日本語の概要は準備中です。原文の説明を表示しています。
Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.
日本語の概要は準備中です。原文の説明を表示しています。
Build integrated IS/BS/CF financial workbooks in Excel.
日本語の概要は準備中です。原文の説明を表示しています。
Entry point for 9Router — local/remote AI gateway with OpenAI-compatible REST for chat, image, TTS, embeddings, web search, web fetch. Use when the user mentions 9Router, NINEROUTER_URL, or wants AI without writing provider boilerplate. This skill covers setup + indexes capability skills; fetch the relevant capability SKILL.md from the URLs below when needed.
日本語の概要は準備中です。原文の説明を表示しています。
Chat / code generation via 9Router using OpenAI /v1/chat/completions or Anthropic /v1/messages format with streaming + auto-fallback combos. Use when the user wants to ask an LLM, generate code, summarize text, or run prompts through 9Router.
日本語の概要は準備中です。原文の説明を表示しています。