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

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 đó.
$ 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
- Impact3 dependents, all VALID3 object phụ thuộc, đều VALID
- PreviewThe diff, as the database will get itDiff đúng như database sẽ nhận
- SnapshotToday's version kept, before anything runsGiữ bản hiện tại, trước khi chạy gì
- ApproveDuyệtA person says yes; the grant is single useMột người đồng ý; grant chỉ dùng một lần
- WriteGhiExactly what was previewedĐúng nội dung đã preview
- 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.
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
- Restart the Claude Code session so the hooks and the MCP server load.
pythia doctor: no fail line means the guard and both chat doors work on this machine.- Prefer a plugin?
/plugin marketplace add thaildhe172591/pythiabrings the skills, hooks and approver.
- Khởi động lại phiên Claude Code để hook và MCP server có hiệu lực.
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.- Muốn dùng plugin?
/plugin marketplace add thaildhe172591/pythiamang theo skill, hook và approver.
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
- Trust the pieces once:
/mcp(the pythia server) and/hooks(the project's.codexlayer). - Restart the Codex session so the new
AGENTS.mdloads;/skillslists the skills and/mcpshowspythia: connected. - Never run it under
danger-full-access: that sandbox approves elicitations by itself and skips your Approve.
- Tin cậy các phần một lần:
/mcp(server pythia) và/hooks(lớp.codexcủa dự án). - Khởi động lại phiên Codex để nạp
AGENTS.mdmới;/skillsliệt kê skill và/mcphiệnpythia: connected. - Đừng chạy dưới
danger-full-access: sandbox đó tự duyệt elicitation và bỏ qua nút Approve của bạn.
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>npx skills add thaildhe172591/pythiainstalls the skills for the agents it supports.pythia guide --briefis the session preamble;pythia guideprints the whole contract.- Approve each write at your own terminal with
pythia approve <token>.
npx skills add thaildhe172591/pythiacài skill cho các agent mà nó hỗ trợ.pythia guide --brieflà phần mở đầu phiên;pythia guidein hợp đồng đầy đủ.- Duyệt từng lần ghi ở terminal của bạn bằng
pythia approve <token>.
| What the agent getsAgent nhận được | Claude Code | Codex | Any agentAgent khác |
|---|---|---|---|
| Rules loaded every sessionBộ luật nạp ở mọi phiên | ✓CLAUDE.md | ✓AGENTS.md | AGENTS.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ối | 11 / 11 | 7 / 11 | 4 / 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.
Pick an object. See what it would break.Chọn một object. Xem nó kéo theo những gì.
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 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.
Tune it, document it, ship it.Tối ưu, ghi chú, đưa lên.
$ 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 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 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 đủ.
Ask the database, never the dump.Hỏi database, đừng đọc file dump.
- Read the live schema:
ls,src,cols,ddl,plscope. impactbefore 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. impacttrướ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.
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.
One way in. Evidence out.Một cửa vào. Ra bằng bằng chứng.
- Writes go through
applyordeployonly. - Exit codes are the verdict, read unpiped.
- No "done" without
errors,invalidagainst the baseline and a cleanlint.
- Chỉ ghi qua
applyhoặcdeploy. - Exit code là kết luận, không đọc qua pipe.
- Không nói "xong" khi chưa có
errors,invalidso với lúc đầu vàlintsạ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.
- SnapshotKeep what is there now, so there is a way backLưu bản hiện tại để có đường quay lại
- ImpactCount what depends on itĐếm object phụ thuộc
- PreviewDiff, lint, warnings, anything destructiveDiff, lint, cảnh báo, lệnh nguy hiểm
- ApproveDuyệtOne person, one single-use grantMột người thật, một grant dùng một lần
- WriteGhiExactly what was previewedĐúng nội dung đã preview
- VerifyKiểm traCompile errors, objects newly INVALIDLỗi biên dịch, object mới bị INVALID
Clean. Written and verified.
Sạch. Đã ghi và kiểm tra không có lỗi mới.
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.
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 group | Nhóm câu lệnh | Default | Mặc định | Covers | Gồm |
|---|---|---|---|---|---|
plsql_source | confirm | CREATE OR REPLACE package, procedure, function, trigger, type, view | |||
comments | confirm | COMMENT ON TABLE / COLUMN — with a real undo— có undo thật | |||
data_dml | deny | INSERT UPDATE DELETE MERGE | |||
structural | deny | CREATE ALTER DROP TRUNCATE RENAME | |||
grants | deny | GRANT REVOKE | |||
session | allow | ALTER 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.
$ 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.
$ 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ự
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.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õ.The developer's terminal
Terminal của dev
pythia approve <token>. IndontAskmode 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.
- 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
- A connection marked
"protected": trueor"env": "prod" - Destructive statements, unless the card said so
- A file with lint errors
GRANT … TO PUBLIC,ANYprivileges, grant options- DML touching more than 1,000 rows
- Connection có
"protected": truehoặ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ềnANY, 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,SPOOLare skipped and listed.@include,EXEC,HOST,CONNECT,ALTER SESSIONare 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 SESSIONbị 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 Nto 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.
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.
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.
claude -p or codex execChưa có lần chạy nào được ghi; bench chạy claude -p hoặc codex execBENCHMARK.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.
Or, with Node.js: npx pythia-plsql does both.Hoặc, nếu có Node.js: npx pythia-plsql làm cả hai.
pythia installin the project root writes the rules intoCLAUDE.mdandAGENTS.md, wires the hooks and the MCP approver, installs the skills, and creates.pythia/connections.json, readable by its owner only.- The developer fills in
connections.json(below). The agent never opens it. pythia checktests the connection;pythia doctorchecks the harness. No fail line means the guard and the approval doors work on this machine.- Restart the Claude Code session so the hooks load.
pythia installở gốc dự án ghi luật vàoCLAUDE.mdvàAGENTS.md, cài hook và MCP approver, cài skill, và tạo.pythia/connections.jsonvới quyền chỉ chủ file đọc được.- Dev điền
connections.json(hướng dẫn bên dưới). Agent không bao giờ mở file này. pythia checkthử kết nối;pythia doctorkiể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.- Khởi động lại phiên Claude Code để hook có hiệu lực.
pythia installin the project root writes the rules intoAGENTS.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.- The developer fills in
connections.json(below). The agent never opens it. - In Codex, trust the pieces once:
/mcpfor the pythia server,/hooksfor the project's.codexlayer. - Restart the Codex session.
/skillslists the pythia skills and/mcpshowspythia: connected. Approval in the chat needs Codex v0.120 or later.
pythia installở gốc dự án ghi luật vàoAGENTS.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.jsonvới quyền chỉ chủ file đọc được.- Dev điền
connections.json(hướng dẫn bên dưới). Agent không bao giờ mở file này. - Trong Codex, tin cậy các phần một lần:
/mcpcho server pythia,/hookscho lớp.codexcủa dự án. - Khởi động lại phiên Codex.
/skillsliệt kê skill của pythia và/mcphiệnpythia: connected. Duyệt trong chat cần Codex v0.120 trở lên.
Filling in connections.jsonĐiền 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.
| Field | Trường | Meaning | Ý nghĩa |
|---|---|---|---|
default | The 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 / sid | Where 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. | ||
dsn | Instead 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 password | app_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. | ||
schema | The 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. |
- Fill in at least one connection and set
"default". - Give the agent its own account:
pythia agent-user --save, exactly once. It prints three statements for the DBA and saves a<name>_agententry as the new default; the password is new on every run, so the SQL and the file must come from the same run. - Keep it private.
installcreates it mode600and, 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. pythia connectionslists the entries without secrets;pythia checkconnects. Using the owner account directly makescheckwarn — by design.
- Điền ít nhất một connection và đặt
"default". - 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>_agentlà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. - Giữ file riêng tư.
installtạo file với quyền600và, từ 0.15.4, ghi nó vào.gitignorecủ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. pythia connectionsliệt kê các entry mà không in mật khẩu;pythia checkthử kết nối. Dùng thẳng tài khoản owner thìchecksẽ cảnh báo — đó là chủ ý.
$ 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.