AGENT SKILL

python-and-cli

Enables Porcupine Python SDK usage, low-level engine control, file and microphone demo patterns, device enumeration, and safe local checks.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
python-and-cli
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Enables Porcupine Python SDK usage, low-level engine control, file and microphone demo patterns, device enumeration, and safe local checks.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

python-and-cli

Use this sub-skill when you need to:

  • install pvporcupine and confirm the import
  • create a Porcupine engine in Python
  • inspect version, frame_length, or sample_rate
  • process a .wav file for wake-word detections
  • enumerate inference devices safely
  • read PorcupineError and message_stack failures
  • adapt the packaged Python file demo into a reusable checker

Included workflow

  • Python SDK install and import.
  • Low-level engine creation, processing, and cleanup.
  • Built-in keyword selection and custom keyword paths.
  • Sensitivity handling and frame/sample-rate validation.
  • File-based detection.
  • Device enumeration and safe preflight checks.
  • Reference-only microphone recipe.

Excluded workflow

  • Custom wake-word training and asset selection.
  • Language/platform matching for .ppn and .pv files.
  • Node, web, React Native, Android, iOS, Flutter, Java, .NET, or C SDK details.

If the task is about training or model/keyword asset selection, route it to ../custom-keywords-and-assets/SKILL.md.

Read first

  • references/python-api-reference.md for verified signatures, object behavior, device strings, and exception classes.
  • references/python-workflows.md for the file recipe, optional demo CLI notes, and the hardware-required microphone flow.
  • references/troubleshooting.md for import, AccessKey, model, keyword, WAV, frame, device, and cleanup failures.

Run the bundled helper

  • scripts/porcupine_file_check.py --help shows the safe parser without requiring an AccessKey.
  • scripts/porcupine_file_check.py --list-devices prints the inference devices advertised by the native library.
  • scripts/porcupine_file_check.py --access-key "$ACCESS_KEY" --input-wav sample.wav --keyword picovoice scans a file with a built-in keyword.
  • scripts/porcupine_file_check.py --access-key "$ACCESS_KEY" --input-wav sample.wav --keyword-path /path/to/custom.ppn --model-path /path/to/porcupine_params.pv scans a file with custom assets.

Practical boundaries

  • pvporcupine.create still needs a valid AccessKey at initialization.
  • Porcupine.process only accepts 16-bit, single-channel PCM frames sized exactly to frame_length.
  • available_devices() is the safe no-AccessKey check for loading the native library and discovering inference targets.
  • If you need to choose .ppn / .pv assets or train a wake word, move to the sibling asset skill before coming back here.
  • If a task only needs the packaged demo CLI, the bundled helper and workflow notes are usually enough; you do not need the original repository checkout.

Quick routing guide

  • Ask for scripts/porcupine_file_check.py when the user wants a file-based wake-word check, a parser/help smoke test, or a path-safe example for the Python binding.
  • Ask for references/python-workflows.md when the user wants the microphone recipe, available_devices() usage, or a command-line comparison point.
  • Ask for references/troubleshooting.md when the user reports an import failure, a bad AccessKey, a model or keyword path problem, a sensitivity mismatch, a WAV format issue, or an invalid device selector.
  • Ask for references/python-api-reference.md when the user needs exact signatures, Porcupine attributes, or the message_stack behavior of PorcupineError subclasses.
  • Prefer the helper script over ad hoc code when the task is only to confirm that Porcupine can load a file and emit detections.
  • Keep cleanup explicit: if you create the engine yourself, delete it in finally.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351