osquery-dev
Use when writing, testing, debugging, or verifying osquery SQL queries.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- osquery-dev
- description
- Use when writing, testing, debugging, or verifying osquery SQL queries.
03 SKILL.md 正文
osquery dev
Develop against the same runtime the query ships to, verify piece by piece, and never read an empty result as a broken join before probing.
Run the query
osqueryi -json "SELECT ..." # exits after the result
osqueryd -S -json "SELECT ..." # osqueryd needs -S to act as osqueryi
Without -S, osqueryd stays resident and the call hangs until timeout.
Writable --logger_path, --config_path, and --extensions_socket are
required; a missing one exits 78. When the binary is Orbit's:
/opt/orbit/bin/osqueryd/macos-app/stable/osquery.app/Contents/MacOS/osqueryd
pass its flags after --.
Fleet runs osqueryd as root. Test with sudo when you can; otherwise expect
zero rows from root-only paths and read that as a privilege artifact, not a
broken join.
Empty result != broken query
Decompose the query into one labeled probe per table and run them as separate statements first. The first empty probe is the answer; the joined query is only rerun after every probe returns.
SELECT 'users' AS src, username, uid, directory FROM users WHERE uid >= 501;
SELECT 'file' AS src, path, size, mtime FROM file WHERE path LIKE '/Users/%/...';
SELECT 'apps' AS src, bundle_identifier, last_opened_time
FROM apps WHERE bundle_identifier = '...';
Then mirror each probe in the joined query — JOIN order, LEFT JOINs, and WHERE clauses that restate probe filters.
Table traps
appssees bundles outside standard app dirs, but a launchd-execed bundle reportslast_opened_time = -1.0: EXISTS only, never join on it.processes.start_timeis unix time on macOS but seconds-since-boot on Linux — normalize beforedatetime()when a query must run on both.pkg_receiptsdoes not exist on macOS builds: install time comes fromfile.mtimeon the bundle, which moves on every update, so read it as latest-install, never first-install.userswraps negative uids to4294967294(nobody,/var/empty), and those rows passuid >= 501— filter ondirectory LIKE '/Users/%'too.plistemits one row per matching path;IN (...)across several paths is valid, and a missing path just returns no rows.- Fractional epochs return as strings (
"1788276135.21331"):CAST(col AS INTEGER)before mtime arithmetic,ABS(a - b)for freshness deltas. - Scalar subqueries with
CASE WHEN EXISTSstay uncorrelated and evaluate once; correlated ones re-run per row.
Ship it
A query is verified when every probe returns, the joined query returns, and each threshold heuristic (staleness windows, size floors) cites its observed cadence or measurement rather than a guess.
04 同仓库更多 Skills
writing-for-agents
Write or revise documents that agents consume, including skills, AGENTS.md, CLAUDE.md, specifications, prompts, and README files. Use when authoring or reviewing agent-facing instructions.
windows-test-rig
Drive libvirt Windows 11 test VMs on this host or other Linux hosts - list and select VMs, boot, reset to a clean snapshot, run PowerShell over SSH, launch GUI apps on the visible desktop, send keys, screenshot, and tunnel host services into the guest. Use when a change must be validated on real Windows, or when creating the VM on a new host.
unslop
Cut AI tells from any writing. Must always apply.
teach
Teach the user a new skill or concept, within this workspace.
subagent
Spawns pi as a separate subagent process for edits, verification, reviews, research, or any delegated task whenever the user mentions a subagent, asks to delegate work, or invokes /skill:subagent.
review
Run a read-only subagent review of the current branch diff against main or master.