pythia 0.15.7 · PL/SQL for AI agentspythia 0.15.7 · PL/SQL cho AI agent

Ask first.Write with a way back.Hỏi trước.Ghi luôn có đường lui.

A CLI and skill pack for AI coding agents on Oracle. Your agent reads the live schema, asks a person before it writes, and every write lands with a snapshot, a verify step and a journal.CLI và bộ skill cho AI agent làm việc với Oracle. Agent đọc schema thật, hỏi người trước khi ghi, và mọi lần ghi đều có snapshot, bước kiểm tra và nhật ký.

For Oracle PL/SQL developers and data engineers · MIT licensed · Python stdlib + python-oracledb, nothing elseCho dev Oracle PL/SQL và data engineer · giấy phép MIT · chỉ cần thư viện chuẩn Python và python-oracledb

pythia logo: a black cat oracle holding a glowing database
35 commandslệnh 17 skills 23 SQL files you can readfile SQL đọc được 39 lint rulesrule lint 1 write path, for every writecon đường ghi cho mọi lần ghi

ReplayXem lại

Watch one write.Xem một lần ghi.

What the agent runs to change one package body, start to finish. The person appears once, in the middle — and nothing reaches the database before that.Những lệnh agent chạy để sửa một package body, từ đầu đến cuối. Con người xuất hiện một lần, ở giữa — và không gì chạm tới database trước lúc đó.

~/orders · claude code
$ pythia impact PKG_ORDER
APP_OWNER.PKG_ORDER
  APP_OWNER.PKG_ORDER_API (PACKAGE BODY)
  APP_OWNER.PKG_BILLING (PACKAGE BODY)
    APP_OWNER.PKG_BILLING_JOB (PACKAGE BODY)
-- impact: 3 dependent objects, 3 currently VALID
$ pythia lint db/pkg_order_body.sql
-- 1 file(s): 0 error(s), 0 warning(s), 0 info
$ pythia apply db/pkg_order_body.sql

  PKG_ORDER (PACKAGE BODY) in APP_OWNER — 2 lines changed
  impact: 3 dependent objects, 3 currently VALID

  @@ -13,1 +13,1 @@
  -    UPDATE t_order SET status = 'C'
  +    UPDATE t_order SET status = 'C', confirmed_at = SYSDATE

  Snapshot saved: .pythia/journal/2026-10-15T09-12-04_PKG_ORDER_PACKAGE-BODY

  To apply — the developer approves, then the agent confirms:
    the agent calls the pythia_approve tool (MCP) with token 3f9a2c
# the developer reads the card in the prompt, and approves
  Grant minted — single use, expires in 15 minutes.
$ pythia apply db/pkg_order_body.sql --confirm 3f9a2c

  Applied PKG_ORDER (PACKAGE BODY).
  Compiled clean. No new INVALID objects.
$ echo $?
0
  1. Impact3 dependents, all VALID3 object phụ thuộc, đều VALID
  2. PreviewThe diff, as the database will get itDiff đúng như database sẽ nhận
  3. SnapshotToday's version kept, before anything runsGiữ bản hiện tại, trước khi chạy gì
  4. ApproveDuyệtA person says yes; the grant is single useMột người đồng ý; grant chỉ dùng một lần
  5. WriteGhiExactly what was previewedĐúng nội dung đã preview
  6. VerifyKiểm traExit 0: compiled, nothing newly INVALIDExit 0: biên dịch sạch, không object nào mới INVALID

A replay on the sample schema; each output line uses the CLI's own wording, shortened.Phát lại trên schema mẫu; mỗi dòng output dùng đúng câu chữ của CLI, có rút gọn.

Agents

Deepest in Claude Code. Wired for Codex.Sâu nhất trong Claude Code. Nối sẵn cho Codex.

One pythia install in the project root sets up both. Claude Code gets every piece: a hook around each tool call, two approval doors inside the chat and a native plugin. Codex gets the rules, the skills, the session guide and the MCP approval door. Any agent that can run a shell gets the CLI, and since the write gate lives in the CLI, it holds in every client.Một lần pythia install ở gốc dự án cấu hình cả hai. Claude Code nhận đủ mọi phần: hook quanh mỗi lần gọi tool, hai cửa duyệt ngay trong chat và plugin gốc. Codex nhận bộ luật, skill, guide đầu phiên và cửa duyệt MCP. Agent nào chạy được shell cũng dùng được CLI, và vì cổng ghi nằm trong CLI nên nó giữ nguyên ở mọi client.

pythia install · Claude Code
CLAUDE.md
  the 13 rules, in a marked block
.claude/settings.json
  SessionStart · PreToolUse · PostToolUse
.mcp.json
  pythia_approve, the write-free approver
.claude/skills/
  17 skills
.pythia/
  connections.json, mode 600, git-ignored
# a venv install: settings.local.json, local MCP scope
  1. Restart the Claude Code session so the hooks and the MCP server load.
  2. pythia doctor: no fail line means the guard and both chat doors work on this machine.
  3. Prefer a plugin? /plugin marketplace add thaildhe172591/pythia brings the skills, hooks and approver.
  1. Khởi động lại phiên Claude Code để hook và MCP server có hiệu lực.
  2. pythia doctor: không còn dòng fail là guard và cả hai cửa duyệt trong chat đều chạy trên máy này.
  3. Muốn dùng plugin? /plugin marketplace add thaildhe172591/pythia mang theo skill, hook và approver.
pythia install · Codex
AGENTS.md
  the 13 rules, in a marked block
.codex/config.toml
  pythia_approve, the write-free approver
.codex/hooks.json
  SessionStart: the guide and the live state
.agents/skills/
  17 skills
.pythia/
  connections.json, mode 600, git-ignored
# chat approval needs Codex ≥ v0.120; older ones use the terminal
  1. Trust the pieces once: /mcp (the pythia server) and /hooks (the project's .codex layer).
  2. Restart the Codex session so the new AGENTS.md loads; /skills lists the skills and /mcp shows pythia: connected.
  3. Never run it under danger-full-access: that sandbox approves elicitations by itself and skips your Approve.
  1. Tin cậy các phần một lần: /mcp (server pythia) và /hooks (lớp .codex của dự án).
  2. Khởi động lại phiên Codex để nạp AGENTS.md mới; /skills liệt kê skill và /mcp hiện pythia: connected.
  3. Đừng chạy dưới danger-full-access: sandbox đó tự duyệt elicitation và bỏ qua nút Approve của bạn.
pythia install · any agent
AGENTS.md
  the rules, for agents that read it
skills
  npx skills add thaildhe172591/pythia
pythia <command>
  the CLI and its write gate, from any shell
.pythia/
  connections.json, mode 600, git-ignored
# approvals: the developer runs pythia approve <token>
  1. npx skills add thaildhe172591/pythia installs the skills for the agents it supports.
  2. pythia guide --brief is the session preamble; pythia guide prints the whole contract.
  3. Approve each write at your own terminal with pythia approve <token>.
  1. npx skills add thaildhe172591/pythia cài skill cho các agent mà nó hỗ trợ.
  2. pythia guide --brief là phần mở đầu phiên; pythia guide in hợp đồng đầy đủ.
  3. Duyệt từng lần ghi ở terminal của bạn bằng pythia approve <token>.
What the agent getsAgent nhận đượcClaude CodeCodexAny agentAgent khác
Rules loaded every sessionBộ luật nạp ở mọi phiên✓CLAUDE.md✓AGENTS.mdAGENTS.md, if it reads itAGENTS.md, nếu agent đọc
The 17 skills17 skill✓.claude/skills✓.agents/skills✓npx skills add
Session guide and live stateGuide và trạng thái đầu phiên✓SessionStart✓.codex/hooks.json—pythia guide --brief
Guard before every tool callGuard trước mỗi lần gọi tool✓PreToolUse——
Verdict rules beside each write resultLuật đọc kết quả cạnh mỗi lần ghi✓PostToolUse——
Approve in chat: pythia_approveDuyệt trong chat: pythia_approve✓every mode but dontAskmọi mode trừ dontAsk✓Codex ≥ v0.120—
Approve in chat: AskUserQuestion cardDuyệt trong chat: thẻ AskUserQuestion✓approve --card——
Native pluginPlugin gốc✓/plugin marketplace add——
Approve at the developer's terminalDuyệt ở terminal của dev✓pythia approve✓pythia approve✓pythia approve
Write gate inside the CLICổng ghi nằm trong CLI✓token · policy · verifytoken · policy · verify✓token · policy · verifytoken · policy · verify✓token · policy · verifytoken · policy · verify
Headless behavior benchBench hành vi chạy headless✓--agent claude✓--driver "codex exec …"✓--driver "<cli> …"
Pieces wiredSố phần được nối11 / 117 / 114 / 11

The behavior bench drives either agent headless and grades its call log, with no model judging a model: python bench/agent_bench.py --agent claude, or --agent codex --driver "codex exec {prompt}". 18 of its 27 scenarios run on their own. No run is recorded yet, so the scoreboard shows n/a.Bench hành vi chạy headless với cả hai agent và chấm từ log lời gọi, không có model nào chấm model: python bench/agent_bench.py --agent claude, hoặc --agent codex --driver "codex exec {prompt}". 18 trong 27 kịch bản tự chạy. Chưa có lần chạy nào được ghi, nên bảng điểm ghi n/a.

Oracle · Data

For the people who own the schema.Cho người giữ schema.

PL/SQL developers change packages that other code leans on. Data engineers ship releases and tune the queries under their pipelines. The agent asks the data dictionary what either of them would check by hand, and changes to data wait behind the strictest gate pythia has.Dev PL/SQL sửa package mà code khác đang dựa vào. Data engineer đưa release lên và tối ưu các truy vấn nằm dưới pipeline. Agent hỏi data dictionary đúng những gì họ vẫn tự kiểm tra, còn thay đổi dữ liệu thì phải qua cổng chặt nhất của pythia.

Oracle developerDev Oracle

Pick an object. See what it would break.Chọn một object. Xem nó kéo theo những gì.

T_ORDERTABLET_ORDER_LINETABLET_ORDER_AUDITTABLEPKG_ORDERPACKAGEV_ORDER_TOTALSVIEWTRG_ORDER_AUDITTRIGGERPKG_ORDER_APIPACKAGE BODYPKG_BILLINGPACKAGE BODYPKG_BILLING_JOBPACKAGE BODY

Click or tap an object in the sample schema; pythia walks three levels by default.Bấm vào một object trong schema mẫu; mặc định pythia đi sâu ba tầng.

pythia impact
$ pythia impact PKG_ORDER
APP_OWNER.PKG_ORDER
  APP_OWNER.PKG_ORDER_API (PACKAGE BODY)
  APP_OWNER.PKG_BILLING (PACKAGE BODY)
    APP_OWNER.PKG_BILLING_JOB (PACKAGE BODY)
-- impact: 3 dependent objects, 3 currently VALID

Ten or more dependents, or one in another schema, and the developer sees this list before any code is written.Từ 10 object phụ thuộc trở lên, hoặc có object ở schema khác, thì dev được xem danh sách này trước khi viết code.

Data engineer

Tune it, document it, ship it.Tối ưu, ghi chú, đưa lên.

pythia explain
$ pythia explain "select * from t_order where customer_id = :c"
---------------------------------------------------------------
| Id  | Operation         | Name    | Rows  | Cost (%CPU)|
---------------------------------------------------------------
|   0 | SELECT STATEMENT  |         |    42 |   311   (1)|
|*  1 |  TABLE ACCESS FULL| T_ORDER |    42 |   311   (1)|
---------------------------------------------------------------
-- note: full scan of T_ORDER — fine for small tables or most of the rows;
   otherwise check the predicate is indexable (`pythia stats <TABLE>`)
pythia stats
$ pythia stats T_ORDER
-- table
TABLE_NAME  NUM_ROWS  BLOCKS  LAST_ANALYZED     STALE_STATS  …
T_ORDER     1840233   24310   2026-09-02 22:10  YES          …
-- indexes
INDEX_NAME  COLUMNS   UNIQUENESS  STATUS  …
PK_ORDER    ORDER_ID  UNIQUE      VALID   …
-- unindexed fks
CONSTRAINT_NAME    COLUMNS      PARENT_TABLE
FK_ORDER_CUSTOMER  CUSTOMER_ID  T_CUSTOMER
-- note: statistics are STALE
-- note: unindexed foreign keys lock this table on parent DELETE/UPDATE of the key
pythia comments
$ pythia comments T_ORDER
TABLE_NAME  COLUMN_NAME   DATA_TYPE     COMMENTS
T_ORDER                   TABLE         Customer orders, one row each
T_ORDER     ORDER_ID      NUMBER(12,0)  Order key
T_ORDER     CUSTOMER_ID   NUMBER(12,0)
T_ORDER     STATUS        VARCHAR2(1)   N new, C confirmed, X cancelled
T_ORDER     CONFIRMED_AT  DATE
-- 2 of 5 without a comment; pythia comments T_ORDER --scaffold writes the statements to fill in
$ pythia comments T_ORDER --scaffold
COMMENT ON COLUMN T_ORDER.CUSTOMER_ID IS '';
COMMENT ON COLUMN T_ORDER.CONFIRMED_AT IS '';
  • explainParsed, never run. PLAN_TABLE only: no V$ views, no AWR or ASH, so nothing to license.
  • statsStale statistics and the foreign keys that lock, before anyone rewrites the query.
  • data_dmlDenied by default. Where a policy allows it, the approval names the rows: a count, a fingerprint and a sample. Other rows need a new approval.
  • deployA release folder in its natural order, approved once, stopped at the first broken statement, resumed with --from N.
  • explainChỉ phân tích, không chạy. Chỉ dùng PLAN_TABLE: không V$, không AWR hay ASH, nên không cần thêm license.
  • statsThống kê đã cũ và các foreign key gây khoá, trước khi ai đó viết lại truy vấn.
  • data_dmlMặc định bị chặn. Khi policy cho phép, lần duyệt gọi tên đúng các dòng: số dòng, fingerprint và dữ liệu mẫu. Tập dòng khác phải duyệt lại.
  • deployCả thư mục release theo thứ tự tự nhiên, duyệt một lần, dừng ở câu lệnh hỏng đầu tiên, chạy tiếp bằng --from N.

Sample schema; outputs use the CLI's own wording, columns shortened.Schema mẫu; output dùng đúng câu chữ của CLI, có lược bớt cột.

How it worksCách làm việc

Learn → Ask → DoHọc → Hỏi → Làm

Every task moves through three movements, in this order. The 13 standing rules in AGENTS.md are those movements in enforceable form; pythia guide prints the whole contract.Mỗi việc đi qua ba bước theo thứ tự này. 13 luật trong AGENTS.md là dạng kiểm tra được của ba bước đó; pythia guide in hợp đồng đầy đủ.

LearnHọc

Ask the database, never the dump.Hỏi database, đừng đọc file dump.

  • Read the live schema: ls, src, cols, ddl, plscope.
  • impact before any change. Ten or more dependents, or any in another schema, go to the developer first.
  • Read the LEAD's house style before writing an object.
  • Đọc schema thật: ls, src, cols, ddl, plscope.
  • impact trước mọi thay đổi. Từ 10 object phụ thuộc trở lên, hoặc có phụ thuộc ở schema khác, thì cho dev xem trước.
  • Đọc quy ước của LEAD trước khi viết object.
AskHỏi

Settle the spec. Show every preview.Chốt yêu cầu. Cho xem mọi preview.

  • Open decisions become questions with options and a recommendation, before any code.
  • Every preview is relayed verbatim; then a real yes.
  • Dependents that break are reported with a proposal, never auto-fixed.
  • Điểm còn mở thành câu hỏi có lựa chọn và đề xuất, trước khi viết code.
  • Chuyển nguyên văn preview cho dev, rồi chờ một lần duyệt thật.
  • Object phụ thuộc bị hỏng thì báo kèm đề xuất, không tự sửa.
DoLàm

One way in. Evidence out.Một cửa vào. Ra bằng bằng chứng.

  • Writes go through apply or deploy only.
  • Exit codes are the verdict, read unpiped.
  • No "done" without errors, invalid against the baseline and a clean lint.
  • Chỉ ghi qua apply hoặc deploy.
  • Exit code là kết luận, không đọc qua pipe.
  • Không nói "xong" khi chưa có errors, invalid so với lúc đầu và lint sạch.

SafetyAn toàn

One write, six steps.Một lần ghi, sáu bước.

There is one write path, and a restore takes it too. Each step is a place where a mistake stops instead of landing.Chỉ có một con đường ghi, và restore cũng đi đường đó. Mỗi bước là một chỗ lỗi bị chặn lại thay vì lọt vào database.

  1. SnapshotKeep what is there now, so there is a way backLưu bản hiện tại để có đường quay lại
  2. ImpactCount what depends on itĐếm object phụ thuộc
  3. PreviewDiff, lint, warnings, anything destructiveDiff, lint, cảnh báo, lệnh nguy hiểm
  4. ApproveDuyệtOne person, one single-use grantMột người thật, một grant dùng một lần
  5. WriteGhiExactly what was previewedĐúng nội dung đã preview
  6. VerifyKiểm traCompile errors, objects newly INVALIDLỗi biên dịch, object mới bị INVALID
0

Clean. Written and verified.

Sạch. Đã ghi và kiểm tra không có lỗi mới.

1

Refused. Nothing written. The reason is relayed, never routed around.

Bị từ chối. Không ghi gì. Agent báo lý do, không đi vòng.

3

Written but broken. Never reported as success: the errors and the printed restore come first.

Đã ghi nhưng hỏng. Không bao giờ báo là thành công: hiện lỗi và lệnh restore đã in sẵn.

Statement groupNhóm câu lệnhDefaultMặc địnhCoversGồm
plsql_sourceconfirmCREATE OR REPLACE package, procedure, function, trigger, type, view
commentsconfirmCOMMENT ON TABLE / COLUMN — with a real undo— có undo thật
data_dmldenyINSERT UPDATE DELETE MERGE
structuraldenyCREATE ALTER DROP TRUNCATE RENAME
grantsdenyGRANT REVOKE
sessionallowALTER SESSION

Anonymous blocks and anything unrecognised are refused. --yes, loosening a policy and turning autopilot on are the developer's own acts: the CLI refuses them without a terminal.Block ẩn danh và câu lệnh không nhận ra được đều bị từ chối. --yes, nới policy và bật autopilot là việc của chính dev: CLI từ chối khi không có terminal của dev.

the agent tries to go around the gateagent thử đi vòng qua cổng
$ sqlplus app_owner/…@dev @db/01_t_order.sql
PreToolUse:Bash hook error: Writes go through `pythia apply <file>` (one statement)
or `pythia deploy <files>` (a script): snapshot, preview, approval, verify, journal.
sqlplus/SQLcl here would write with none of them (AGENTS.md rule 3). …

Recorded from a real Claude Code session on a sample project, October 2026.Ghi lại từ một phiên Claude Code thật trên dự án mẫu, tháng 10/2026.

Try the guardThử guard

Pick what the agent runs. The verdict is what pythia's PreToolUse hook and the CLI answer, word for word, shortened.Chọn lệnh agent chạy. Kết quả là đúng câu trả lời của hook PreToolUse và CLI của pythia, có rút gọn.

the verdictkết quả
$ pythia impact PKG_ORDER
PreToolUse → allow
pythia read-only command — it cannot write
# no prompt: a read cannot change the database

Three doors to a yes, in orderBa cửa để được duyệt, theo thứ tự

  1. pythia_approve (MCP)

    Prompts in every permission mode but dontAsk; no allow rule skips it, and it shows pythia's own card.

    Hỏi ở mọi chế độ quyền trừ dontAsk; không allow rule nào bỏ qua được, và hiện đúng thẻ duyệt của pythia.

  2. AskUserQuestion

    The question is exactly pythia approve --card <token>. Pre-filled answers are refused; a missing answer is named.

    Câu hỏi đúng nguyên văn pythia approve --card <token>. Câu trả lời điền sẵn bị từ chối; không có câu trả lời thì hook nói rõ.

  3. The developer's terminal

    Terminal của dev

    pythia approve <token>. In dontAsk mode this is the door that remains.

    pythia approve <token>. Ở chế độ dontAsk, chỉ còn cửa này.

Each yes mints a grant: single use, fifteen minutes, bound to the connection and to the content that was previewed. Edit the file and it is a new preview.Mỗi lần duyệt sinh một grant: dùng một lần, hết hạn sau 15 phút, gắn với connection và đúng nội dung đã preview. Sửa file thì phải preview lại.

Autopilot

One approval for a whole session.Duyệt một lần cho cả buổi làm việc.

Twenty identical approvals teach a person to click without reading. A lease replaces them with one honest act: the developer reads a card naming the connection, the statement groups, the hours and a write budget, and approves it once. Every write inside it is still snapshotted, journaled and verified.Hai mươi lần duyệt giống nhau dạy người ta bấm mà không đọc. Lease thay chúng bằng một lần duyệt đúng nghĩa: dev đọc thẻ ghi rõ connection, nhóm câu lệnh, số giờ và số lần ghi tối đa, rồi duyệt một lần. Mọi lần ghi trong lease vẫn có snapshot, nhật ký và kiểm tra.

A lease namesLease gồm
  • One connection
  • The statement groups it covers
  • Hours, at most 24
  • A write budget
  • Một connection
  • Các nhóm câu lệnh được phép
  • Số giờ, tối đa 24
  • Số lần ghi tối đa
Never coveredKhông bao giờ áp cho
  • A connection marked "protected": true or "env": "prod"
  • Destructive statements, unless the card said so
  • A file with lint errors
  • GRANT … TO PUBLIC, ANY privileges, grant options
  • DML touching more than 1,000 rows
  • Connection có "protected": true hoặc "env": "prod"
  • Lệnh nguy hiểm, trừ khi thẻ duyệt ghi rõ
  • File còn lỗi lint
  • GRANT … TO PUBLIC, quyền ANY, grant option
  • DML đụng tới hơn 1.000 dòng

The lease pauses itself when another object goes INVALID or after five failed writes in a row, and the agent stops to show the developer. pythia autopilot report lists every write with its undo.Lease tự dừng khi có object khác bị INVALID hoặc sau 5 lần ghi lỗi liên tiếp, và agent dừng lại cho dev xem. pythia autopilot report liệt kê mọi lần ghi kèm lệnh undo.

Release scripts, run like SQL*Plus would read themScript release, đọc đúng như SQL*Plus

  • One statement per ;; a PL/SQL unit ends at a line holding only /; a ; inside a literal or a comment is text.
  • SET, PROMPT, SPOOL are skipped and listed. @include, EXEC, HOST, CONNECT, ALTER SESSION are refused.
  • Mỗi câu lệnh kết thúc ở ;; PL/SQL unit kết thúc ở dòng chỉ có /; ; trong chuỗi hay comment không tính.
  • SET, PROMPT, SPOOL được bỏ qua và liệt kê. @include, EXEC, HOST, CONNECT, ALTER SESSION bị từ chối.
  • Numbered files run in natural order (01_, V3__); otherwise by what each creates.
  • The whole set is previewed and approved once, then runs in order and stops at the first broken step — with the undo list and --from N to resume.
  • File có số thứ tự chạy theo thứ tự tự nhiên (01_, V3__); nếu không thì theo loại object.
  • Preview và duyệt cả bộ một lần, chạy tuần tự, dừng ở bước hỏng đầu tiên — kèm danh sách undo và --from N để chạy tiếp.

Skills

An Oracle build pack in 17 skills.Bộ phát triển Oracle trong 17 skill.

Workflows the agent opens at the right moment. using-pythia routes; the rest each own one kind of job, held to the LEAD's conventions.Các quy trình mà agent tự mở đúng lúc. using-pythia điều hướng; mỗi skill còn lại lo một loại việc, theo đúng quy ước của LEAD.

Say it the way you wouldNói như bạn vẫn nói

Pick a request: using-pythia opens the skill it routes to.Chọn một yêu cầu: using-pythia mở skill tương ứng.

using-pythiaRoutes each request to the right skillMở đúng skill cho từng yêu cầu
pythia-specSettles open decisions before any codeChốt các điểm còn mở trước khi viết code
pythia-exploreExplains the code and schema that existGiải thích code và schema đang có
pythia-impactMeasures the blast radius before a changeĐo tầm ảnh hưởng trước khi đổi
pythia-reviewReviews from the database's own signalsReview dựa trên tín hiệu của chính database
pythia-tableTables, columns, constraints, comments to standardBảng, cột, constraint, comment theo chuẩn
pythia-packagePackages, procedures, functions, triggersPackage, procedure, function, trigger
pythia-writePL/SQL written like its neighboursViết PL/SQL theo các object xung quanh
pythia-commentComments on tables and columnsComment cho bảng và cột
pythia-tuneQuery tuning with before-and-after numbersTối ưu truy vấn, có số liệu trước và sau
pythia-applyThe write gate for one statementCổng ghi một câu lệnh
pythia-deployA release, previewed and approved onceCả bộ release, preview và duyệt một lần
pythia-autopilotWorking inside a leaseLàm việc trong một lease
pythia-verifyEvidence before "done"Bằng chứng trước khi nói "xong"
pythia-conventionsThe LEAD's house style, machine-checkedQuy ước của LEAD, kiểm tra bằng máy
pythia-setupThe Oracle environment: charset, PL/Scope, utPLSQLMôi trường Oracle: charset, PL/Scope, utPLSQL
pythia-skill-authorHelps your team write its own skillsGiúp team viết thêm skill riêng

A harness that checks itselfHarness tự kiểm tra chính nó

CLAUDE.md · AGENTS.md

The rules go into the files Claude Code and Codex load every session, in a marked block. Your own text is untouched.

Luật được ghi vào file mà Claude Code và Codex nạp ở mọi phiên, trong một khối có đánh dấu. Nội dung riêng của bạn giữ nguyên.

Hooks

SessionStart prints the live state. PreToolUse blocks writes around the gate and forged approvals. PostToolUse reads the answer and the exit code.

SessionStart in trạng thái hiện tại. PreToolUse chặn lệnh ghi đi vòng và lần duyệt giả. PostToolUse đọc câu trả lời và exit code.

A launcher that starts

Launcher chạy được thật

A system install gets a shared python -m pythia. A venv, pipx or conda install gets this machine's absolute interpreter, in settings.local.json and Claude Code's local MCP scope only — and every command pythia prints, and the session's RUN line, spell it that way.

Cài toàn hệ thống thì dùng python -m pythia trong file chung. Cài trong venv, pipx hay conda thì dùng đường dẫn tuyệt đối của máy, chỉ trong settings.local.json và local scope của MCP — mọi lệnh pythia in ra và dòng RUN đầu phiên cũng viết theo cách đó.

pythia doctor

Starts every launcher it finds and names what is lost: a gate is a fail; the session guide alone, or the team's copy failing where your own already works, is a warning. A password file git tracks is a fail too.

Chạy thử từng launcher và gọi tên thứ bị mất: mất một cổng là fail; chỉ mất guide đầu phiên, hoặc bản chung của team lỗi trong khi bản riêng đã chạy, là warning. File mật khẩu bị git theo dõi cũng là fail.

pythia doctor
  ok   claude hooks    PreToolUse guard (reads, approved writes, bypass block): wired
  warn hook launch     .claude/settings.json: `python -m pythia` cannot start pythia here (…) — these hooks
                  show an error on every call they match, while .claude/settings.local.json serves the
                  same hooks with a launcher that starts. Teammates may rely on them — keep them, or remove …
  ok   hook launch     .claude/settings.local.json: `"…/venv/bin/python3" -m pythia` starts pythia
  ok   approval door   pythia_approve MCP tool registered in Claude Code's local scope (overrides .mcp.json)
  ok   claude.md       CLAUDE.md carries the pythia block

An excerpt from 0.15.3 on a sample project upgraded from 0.15.1, paths shortened.Trích từ bản 0.15.3 trên một dự án mẫu nâng cấp từ 0.15.1, đường dẫn được rút gọn.

Benchmark

Scored on every release.Chấm điểm ở mọi bản phát hành.

bench/bench.py scores four axes and keeps a row per version; CI fails on any regression. These are the 0.15.7 numbers; axes without data say so.bench/bench.py chấm bốn trục và lưu một dòng cho mỗi phiên bản; CI báo lỗi khi có bất kỳ regression nào. Đây là số của bản 0.15.7; trục chưa có dữ liệu được ghi đúng như vậy.

ReliabilityĐộ tin cậy
100/100
267 of 267 suite tests, 18 of 18 safety probes267/267 test trong các suite, 18/18 safety probe
PerformanceHiệu suất
100/100
104–110 ms median for the no-database commands104–110 ms (trung vị) cho các lệnh không cần database
Agent behaviorHành vi agent
n/a
No recorded run yet; the bench drives claude -p or codex execChưa có lần chạy nào được ghi; bench chạy claude -p hoặc codex exec
Code qualityChất lượng code
n/a
No generated samples yetChưa có mẫu code nào

BENCHMARK.md · CI runs Ubuntu, Windows and macOS on Python 3.9 and 3.13.CI chạy trên Ubuntu, Windows và macOS với Python 3.9 và 3.13.

InstallCài đặt

Two lines.Hai dòng.

pip install pythia-plsql
pythia install

Or, with Node.js: npx pythia-plsql does both.Hoặc, nếu có Node.js: npx pythia-plsql làm cả hai.

  1. pythia install in the project root writes the rules into CLAUDE.md and AGENTS.md, wires the hooks and the MCP approver, installs the skills, and creates .pythia/connections.json, readable by its owner only.
  2. The developer fills in connections.json (below). The agent never opens it.
  3. pythia check tests the connection; pythia doctor checks the harness. No fail line means the guard and the approval doors work on this machine.
  4. Restart the Claude Code session so the hooks load.
  1. pythia install ở gốc dự án ghi luật vào CLAUDE.md và AGENTS.md, cài hook và MCP approver, cài skill, và tạo .pythia/connections.json với quyền chỉ chủ file đọc được.
  2. Dev điền connections.json (hướng dẫn bên dưới). Agent không bao giờ mở file này.
  3. pythia check thử kết nối; pythia doctor kiểm tra harness. Không còn dòng fail là guard và các cửa duyệt đều chạy trên máy này.
  4. Khởi động lại phiên Claude Code để hook có hiệu lực.
  1. pythia install in the project root writes the rules into AGENTS.md, registers the MCP approver in .codex/config.toml, adds the session guide to .codex/hooks.json, puts the skills in .agents/skills, and creates .pythia/connections.json, readable by its owner only.
  2. The developer fills in connections.json (below). The agent never opens it.
  3. In Codex, trust the pieces once: /mcp for the pythia server, /hooks for the project's .codex layer.
  4. Restart the Codex session. /skills lists the pythia skills and /mcp shows pythia: connected. Approval in the chat needs Codex v0.120 or later.
  1. pythia install ở gốc dự án ghi luật vào AGENTS.md, đăng ký MCP approver trong .codex/config.toml, thêm guide đầu phiên vào .codex/hooks.json, đặt skill vào .agents/skills, và tạo .pythia/connections.json với quyền chỉ chủ file đọc được.
  2. Dev điền connections.json (hướng dẫn bên dưới). Agent không bao giờ mở file này.
  3. Trong Codex, tin cậy các phần một lần: /mcp cho server pythia, /hooks cho lớp .codex của dự án.
  4. Khởi động lại phiên Codex. /skills liệt kê skill của pythia và /mcp hiện pythia: connected. Duyệt trong chat cần Codex v0.120 trở lên.

Filling in connections.jsonĐiền connections.json

.pythia/connections.json
{
  "default": "agent_dev",
  "agent_dev": {
    "host": "db-dev", "port": 1521, "service_name": "orclpdb",
    "user": "app_agent[app_owner]", "password": "…",
    "schema": "APP_OWNER"
  },
  "dev": {
    "dsn": "db-dev:1521/orclpdb",
    "user": "app_owner", "password": "…",
    "schema": "APP_OWNER"
  },
  "uat": {
    "dsn": "db-uat:1521/orclpdb",
    "user": "app_agent[app_owner]", "password": "…",
    "schema": "APP_OWNER",
    "protected": true
  }
}

Host and service names are placeholders.db-dev, db-uat và orclpdb là tên giả định.

FieldTrườngMeaningÝ nghĩa
defaultThe connection used when nothing else names one.Connection được dùng khi không có gì chỉ định connection khác.
host port service_name / sidWhere the database is. port defaults to 1521; give service_name (usually the PDB) or sid.Địa chỉ database. port mặc định 1521; điền service_name (thường là PDB) hoặc sid.
dsnInstead of the above: an EZConnect string such as db-dev:1521/orclpdb, or a TNS alias. When present, it wins.Thay cho bộ trên: chuỗi EZConnect như db-dev:1521/orclpdb hoặc alias TNS. Có dsn thì pythia dùng dsn.
user passwordapp_agent[app_owner] is a proxy login: the agent signs in with its own account and works in the owner's schema without ever knowing the owner's password. Revoking it is one statement.app_agent[app_owner] là đăng nhập proxy: agent dùng tài khoản riêng và làm việc trong schema của owner mà không biết mật khẩu owner. Thu hồi chỉ cần một câu lệnh.
schemaThe schema the commands read and write, e.g. APP_OWNER.Schema mà các lệnh đọc và ghi, ví dụ APP_OWNER.
"protected": true · "env": "prod"Autopilot never covers it; every write there is approved on its own. Safer still: leave production out of the file.Autopilot không bao giờ áp cho connection này; mỗi lần ghi phải duyệt riêng. An toàn hơn nữa: không đưa production vào file.
  1. Fill in at least one connection and set "default".
  2. Give the agent its own account: pythia agent-user --save, exactly once. It prints three statements for the DBA and saves a <name>_agent entry as the new default; the password is new on every run, so the SQL and the file must come from the same run.
  3. Keep it private. install creates it mode 600 and, since 0.15.4, writes it into the project's .gitignore — commit that line, so every clone keeps it out. Never paste the file into a chat or a screenshot.
  4. pythia connections lists the entries without secrets; pythia check connects. Using the owner account directly makes check warn — by design.
  1. Điền ít nhất một connection và đặt "default".
  2. Cho agent tài khoản riêng: pythia agent-user --save, chạy đúng một lần. Lệnh in ba câu SQL cho DBA và lưu entry <tên>_agent làm default mới; mật khẩu sinh lại mỗi lần chạy, nên SQL và file phải từ cùng một lần chạy.
  3. Giữ file riêng tư. install tạo file với quyền 600 và, từ 0.15.4, ghi nó vào .gitignore của dự án — hãy commit dòng đó để mọi bản clone đều bỏ qua file. Không dán file vào chat hay ảnh chụp.
  4. pythia connections liệt kê các entry mà không in mật khẩu; pythia check thử kết nối. Dùng thẳng tài khoản owner thì check sẽ cảnh báo — đó là chủ ý.
the password file stays out of gitfile mật khẩu nằm ngoài git
$ pythia install
Created .pythia/connections.json
Added .pythia/connections.json to .gitignore — it holds passwords; commit the .gitignore so every clone keeps it out
$ pythia doctor
  ok   credentials     .pythia/connections.json is git-ignored (.gitignore)
# and where an earlier commit already took it in:
  fail credentials     git tracks .pythia/connections.json — its passwords are in the repository; `git rm --cached
                  .pythia/connections.json`, commit, then change those passwords (the history keeps the old ones)

From 0.15.4 on a sample project, paths shortened.Trích từ bản 0.15.4 trên một dự án mẫu, đường dẫn được rút gọn.

Which connection runs, never a guess: --conn NAME → PYTHIA_CONNECTION → PYTHIA_USER / PYTHIA_PASSWORD / PYTHIA_DSN (skips the file) → the file: one entry is used as is; with several, the folder directly under the project root picks (DEV/… → entry DEV), then "default"; still ambiguous is an error that lists the options.Chọn connection nào, không bao giờ đoán: --conn NAME → PYTHIA_CONNECTION → PYTHIA_USER / PYTHIA_PASSWORD / PYTHIA_DSN (bỏ qua file) → file: một entry thì dùng luôn; nhiều entry thì thư mục ngay dưới gốc dự án quyết định (DEV/… → entry DEV), rồi tới "default"; vẫn mơ hồ thì báo lỗi kèm danh sách.

Upgrading: pip install -U pythia-plsql, then pythia install again in each project — pip runs nothing after an install. A re-run changes nothing that is already right.Nâng cấp: pip install -U pythia-plsql, rồi chạy lại pythia install trong từng dự án, vì pip không tự chạy gì sau khi cài. Chạy lại không đổi gì nếu mọi thứ đã đúng.