text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
"""
HTTP-level test: consent capture through the real headless signup endpoint
(`POST /auth/{client}/v1/auth/signup`).
``HEADLESS_ONLY = True`` (see ``vinta_schedule_api/settings/base.py``), so the
headless endpoint -- not a direct call to
``BaseVintaScheduleSignupForm.signup()`` -- is the only production
email/passwo... | vintasoftware/vinta-schedule-api | accounts/tests/test_signup_consent_headless.py | .py | 394812a3a730da0e | 7.95 | 7 |
import datetime
import hashlib
from unittest.mock import MagicMock
from django.conf import settings
from django.contrib.auth import get_user_model
from django.http import HttpRequest
import jwt
import pytest
from allauth.socialaccount import app_settings
from accounts.models import RefreshToken
from accounts.token_s... | vintasoftware/vinta-schedule-api | accounts/tests/test_token_strategies.py | .py | f04f101ba8753048 | 7.95 | 7 |
import datetime
import hashlib
import hmac
import secrets
from django.conf import settings
from django.http import HttpRequest
import jwt
from allauth.headless.tokens.strategies.sessions import SessionTokenStrategy
from rest_framework_simplejwt.tokens import AccessToken
from accounts.models import RefreshToken
from ... | vintasoftware/vinta-schedule-api | accounts/token_strategies.py | .py | ec9389b4ee6bb48d | 7.45 | 7 |
#!/usr/bin/env python3
"""claude-worktree-write-guard.py — Claude Code PreToolUse hook that blocks
file-tool writes escaping a worktree into the protected main checkout.
Why this exists: Claude Code runs sub-agents (the Task tool) IN-PROCESS — they
share the orchestrator's OS process and tool pipeline, so there is no ... | vintasoftware/vinta-schedule-api | ai-tools/skills/prepare-worktree/scripts/claude-worktree-write-guard.py | .py | cdde9674da21bec1 | 7.45 | 7 |
"""This project's audit vocabulary.
``vinta_audit_logs`` ships create / update / delete and nothing else, on purpose:
the set of things a project audits is the project's business. These are ours.
"""
from django.db import models
class AuditActorType(models.TextChoices):
"""The kinds of principal that act in thi... | vintasoftware/vinta-schedule-api | audit_integration/constants.py | .py | 5e0b93bc36c664ca | 7.45 | 7 |
"""Move the rows from the legacy ``audit`` app's table into the new log.
The old ``audit`` app kept one wide, organization-scoped table where the actor,
the action and the scope were all columns. ``vinta_audit_logs`` splits those into
dimensions that the log points at, so this is not a schema alteration -- it is a
rea... | vintasoftware/vinta-schedule-api | audit_integration/migrations/0002_backfill_from_legacy_audit.py | .py | fcfa1526234c27c6 | 7.45 | 7 |
"""This project's concrete audit scope and identity.
``vinta_audit_logs`` does not know what a tenant or an actor is here; these two
models are the answer, and ``AUDIT_SCOPE_MODEL`` / ``AUDIT_IDENTITY_MODEL`` point
at them.
Neither carries ``SingleOrganizationModelMixin``, and that is deliberate. The
audit log is app... | vintasoftware/vinta-schedule-api | audit_integration/models.py | .py | ea674e89dc193124 | 7.45 | 7 |
"""The migration that moves the old ``audit`` app's rows into the new log.
This runs once, against real data, and cannot be re-run to fix a bad outcome
without understanding what it already did -- so its properties are worth pinning
down rather than discovering in production.
The legacy tables are built here by hand.... | vintasoftware/vinta-schedule-api | audit_integration/tests/test_legacy_backfill.py | .py | 26aa9614e556399e | 7.95 | 7 |
"""Filtering audit records by columns that only this project's models have.
``AuditQuery`` cannot name ``users.User.email`` -- it is portable by design, and
that column exists only because this project swapped in its own identity model.
``OrganizationAuditQuery`` plus ``OrganizationAuditRepository._filtered_queryset``... | vintasoftware/vinta-schedule-api | audit_integration/tests/test_project_query.py | .py | ebc929f00ff93b06 | 7.95 | 7 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Sphinx extension: generate the confidence dashboard after build.
Hooks into ``build-finished`` to run ``scripts/generate_dashboard.py``
and place the output in the build directory under ``/dashboard/``.
Also creates a redirect from the old ``... | onnxruntime/mobius | docs/_ext/dashboard.py | .py | 27694c0c6e95a01d | 7.63 | 17 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Sphinx extension: generate feature flags documentation at build time.
Hooks into ``builder-inited`` to generate ``docs/feature-flags.md`` from
the ``_Flags`` dataclass. This extension is conditional — it only runs
when the flags module exist... | onnxruntime/mobius | docs/_ext/flags_gen.py | .py | 144582edf48acd23 | 7.63 | 17 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Sphinx extension: generate model documentation pages at build time.
Hooks into ``builder-inited`` to run the existing model page generator
(``docs/_generate_models.py``) before Sphinx processes source files.
"""
from __future__ import annota... | onnxruntime/mobius | docs/_ext/models_gen.py | .py | 2c8f59427f8288fe | 7.63 | 17 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Generate model documentation pages from the registry.
Run before building docs:
python docs/_generate_models.py
This inspects the model registry and class metadata to produce
one Markdown page per model_type, plus an index page.
"""
fro... | onnxruntime/mobius | docs/_generate_models.py | .py | a868ba1e500d2d88 | 7.63 | 17 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Shared audio preprocessing utilities for ASR examples.
Provides the LFR fbank frontend pipeline shared by Fun-ASR-Nano and
SenseVoiceSmall: audio loading, mel spectrogram, LFR stacking, and CMVN.
"""
from __future__ import annotations
impor... | onnxruntime/mobius | examples/asr_utils.py | .py | d97b13efeff6809e | 7.63 | 17 |
# ruff: noqa: RUF002
r"""End-to-end translation example for Hy-MT1.5-1.8B via ORT GenAI.
Demonstrates loading a mobius-built Hy-MT1.5 export with
``onnxruntime-genai`` (no PyTorch at inference time). The HF model_type
``hunyuan_v1_dense`` is mapped to ORT GenAI's generic ``decoder`` LLM
type (see ``onnxruntime-genai/s... | onnxruntime/mobius | examples/hy_mt1_5.py | .py | 1839664fc254ceb9 | 7.63 | 17 |
# ruff: noqa: RUF002, RUF003
r"""End-to-end parity demo for Tencent Hy-MT2-1.8B (HunYuanDenseV1).
Builds the Hy-MT2-1.8B translation model to ONNX with mobius, runs greedy
generation through ONNX Runtime, then runs the **same** greedy decode with
HuggingFace ``transformers`` and asserts the two produce *identical* tok... | onnxruntime/mobius | examples/hy_mt2.py | .py | ad297e25190ea461 | 7.63 | 17 |
#!/usr/bin/env python
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Evaluate Ministral-3-3B VLM (ONNX) vs PyTorch on AI2D.
AI2D is a multiple-choice visual QA benchmark on scientific diagrams.
Each sample has an image, a question, four answer options, and a
ground-truth answer. Accuracy ... | onnxruntime/mobius | examples/olive/ministral-3-3b-vlm/eval.py | .py | 3128d22c7a256e41 | 7.63 | 17 |
#!/usr/bin/env python
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""ONNX Runtime GenAI inference for Ministral-3-3B VLM.
Usage:
python inference.py --prompt "What is the capital of France?"
python inference.py --image photo.jpg --prompt "Describe this"
python inference.py --i... | onnxruntime/mobius | examples/olive/ministral-3-3b-vlm/inference.py | .py | ea6a7e635f104fa2 | 7.63 | 17 |
#!/usr/bin/env python
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Export Ministral-3-3B VLM to ONNX with optional Olive quantization.
Uses mobius for all 3 sub-model exports (text decoder, vision encoder,
embedding) and ORT GenAI config generation. Optionally applies Olive
ModelBuilder... | onnxruntime/mobius | examples/olive/ministral-3-3b-vlm/optimize.py | .py | d11e7e2a2bb9839d | 7.63 | 17 |
from functools import wraps
from asgiref.sync import iscoroutinefunction
from django.views.decorators import cache
def check_request(request):
"""
Check if the request is allowed to cache.
`_check_request` is available in Django > 5.0
"""
if hasattr(cache, "_check_request"):
cache._check... | trottomv/django-never-cache | django_never_cache/decorators.py | .py | 9c3045f30a13cd01 | 7.5 | 9 |
from django.utils.cache import add_never_cache_headers
class NeverCacheMiddleware:
"""Middleware to disable caching for the whole site."""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
add_nev... | trottomv/django-never-cache | django_never_cache/middlewares.py | .py | ed357877577fd4c7 | 7 | 9 |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
@method_decorator(never_cache, name="dispatch")
class NoCacheMixin:
"""Mixin to disable caching for views."""
def dispatch(self, request, *args,... | trottomv/django-never-cache | django_never_cache/mixins.py | .py | 5dff2d9b54e6f83c | 7.5 | 9 |
from http import HTTPStatus
from django.conf import settings
from django.http import HttpResponse
from django.test import RequestFactory, TestCase, override_settings
from django.utils.decorators import method_decorator
from django.views import View
from django_never_cache.decorators import allow_cache
@method_decor... | trottomv/django-never-cache | tests/test_decorators.py | .py | 999f4d54fc522528 | 8 | 9 |
from django.conf import settings
from django.test import Client, TestCase, override_settings
@override_settings(
MIDDLEWARE=settings.MIDDLEWARE
+ ["django_never_cache.middlewares.NeverCacheMiddleware"]
)
class NeverCacheMiddlewareTest(TestCase):
"""Test NeverCacheMiddleware."""
def setUp(self):
... | trottomv/django-never-cache | tests/test_middlewares.py | .py | 197c697eccab0eae | 8 | 9 |
from http import HTTPStatus
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.test import RequestFactory, TestCase
from django.views import View
from django_never_cache.mixins import NoCacheMixin, PrivateAreaMixin
cla... | trottomv/django-never-cache | tests/test_views.py | .py | 922c9ef97d00cfe5 | 8 | 9 |
#!/usr/bin/env python3
"""Check Bedrock quotas for the configured model and suggest concurrency settings.
Reads DIALEXITY_DEFAULT_MODEL from .env, determines the region from AWS config,
and queries Service Quotas for invocations/minute and tokens/minute limits.
Usage:
python scripts/check_bedrock_quotas.py
py... | dialexity/dialectical-framework | scripts/check_bedrock_quotas.py | .py | 1dc9c8d8001478df | 7.65 | 19 |
#!/usr/bin/env python3
"""Delete degenerate Cycles (and their exclusively-owned Wheels) from the graph.
A degenerate Cycle is one whose ``perspective_hashes`` list contains duplicate
perspective hashes: a cycle claiming to be "layer N" that actually references
fewer than N *distinct* perspectives. These corrupt multi-... | dialexity/dialectical-framework | scripts/cleanup_degenerate_cycles.py | .py | 28f7dc183b2988c3 | 7.65 | 19 |
"""
explore tool: Group perspectives into nexus + build pathways + synthesis.
Handles the full exploration lifecycle: nexus creation/expansion,
wheel building, transformation generation, and synthesis.
The shared body lives in `run_exploration_detailed` so the nexus-scoped advisor
variant (tools/scoped.py) can pin th... | dialexity/dialectical-framework | src/dialectical_framework/agents/advisor/tools/explore.py | .py | d3c082e2f4cb4d48 | 7.65 | 19 |
"""
record_decision tool: persist a decision the person explicitly confirmed.
The ceremony lives in conversation (propose → read back → confirm) — this
tool is called only AFTER the person's explicit yes, with the confirmed
wording passed literally. Retracting or replacing a recorded decision goes
through the standard... | dialexity/dialectical-framework | src/dialectical_framework/agents/advisor/tools/record_decision.py | .py | 7a973076c9c8f185 | 7.65 | 19 |
"""
Tool factory for the Advisor mode of an exploration session.
This is the "counsel mode" head of an Explorer↔Advisor toggle: the host
hands the Explorer conversation (messages + nexus_hash) to an Advisor so
the user can discuss what the exploration MEANS, then may hand back to
Explorer for technical work. Same conv... | dialexity/dialectical-framework | src/dialectical_framework/agents/advisor/tools/scoped.py | .py | cfd79dd0ca901907 | 7.65 | 19 |
"""
Agent context for the dialectical framework.
Provides async-safe agent name propagation using contextvars.
The framework sets the agent name inside chat methods; concerns read it
for effect logging.
Framework layer usage (inside Analyst/Explorer):
from dialectical_framework.agents.agent_context import agent_s... | dialexity/dialectical-framework | src/dialectical_framework/agents/agent_context.py | .py | d1946bae6f9312c2 | 7.65 | 19 |
"""
SurfaceTheses: Extracts theses from inputs for AnalystAgent (Phase 1 of polarity-finder).
Extraction-only — does NOT anchor literal concepts (use AnchorTheses for that).
Flow:
1. Get input text (required — returns None if no inputs)
2. Parse intent → extraction parameters (count, focus, domain_hint)
3. Extract fr... | dialexity/dialectical-framework | src/dialectical_framework/agents/analyst/skills/surface_theses.py | .py | b2b65de712d16d73 | 7.65 | 19 |
"""
BuildWheels: Main LLM-facing entry point for dialectical exploration.
Takes a Nexus (exploration context with intent and preset) and optional
Perspective hashes, then creates all structural combinations (Cycles + Wheels)
and estimates them.
The Nexus has two separate concerns:
- preset: Selects the estimator clas... | dialexity/dialectical-framework | src/dialectical_framework/agents/explorer/skills/build_wheels.py | .py | 00b0577f4dece7cf | 7.65 | 19 |
"""
PresentExploration: Concern + tool for showing exploration state within a Nexus.
Shows:
- Nexus intent and perspectives
- Wheels (with edge summaries)
- Transformations (Ac+ and Re+ highlights — the synthetic wisdom)
"""
from __future__ import annotations
from typing import Annotated
from mirascope import llm
f... | dialexity/dialectical-framework | src/dialectical_framework/agents/explorer/tools/present_exploration.py | .py | a2971d0df2b45ef0 | 7.65 | 19 |
#!/usr/bin/env python3
"""
Roles library validator.
Checks two things:
1. **Role frontmatter schema** — every `roles/*.md` except `README.md` and
`_template.md` must declare the full role schema: `name`, `role_version`
(semver), `description`, `category`, `default_model`, `tools` (list),
`requires_context` (... | jimy-r/agent-workspace-architecture | samples/roles/_validate.py | .py | 5c5d29095fb443a1 | 7.48 | 8 |
"""AI news fetcher + dedupper for morning-brief.
Pulls curated RSS/Atom feeds, filters to items published in the last 48 hours
that haven't been seen before, records the new hashes, and returns the
survivors as JSON for the agent to summarise.
Design notes:
- stdlib only (urllib + xml.etree + sqlite3). No feedparser ... | jimy-r/agent-workspace-architecture | samples/scripts/ai_news.py | .py | ce0b9cdad60b3e41 | 7.48 | 8 |
"""Email rules engine — parser, validator, and matcher for Reference/email-rules.md.
The rules file is a markdown document containing fenced YAML blocks. Each rule
describes how an email from a particular sender should be handled (label, archive,
delete, keep_in_inbox) and which downstream consumers (bill-monitor, rec... | jimy-r/agent-workspace-architecture | samples/scripts/email_rules.py | .py | f87b7a59c7b8346f | 7.48 | 8 |
"""
Create a sandbox for heartbeat-PR-agent work on a task.
Decision logic:
- If target scope is inside a git repo -> create a git worktree on a new branch.
- Otherwise -> create a staging folder alongside the source.
Usage:
python create_staging.py <task-slug> <target-path>
-> prints the staging ... | jimy-r/agent-workspace-architecture | samples/scripts/heartbeat/create_staging.py | .py | 25be7b7cd242898b | 7.48 | 8 |
"""
Count pending + reminded entries in tasks/HEARTBEAT_REVIEWS.md.
Used by the heartbeat at cycle start to enforce Rule 15 in HEARTBEAT.md:
if the active queue is >= CAP (10), pause all new `has-default` builds
this cycle — classify every new task as `needs-intent` with a "review
queue is at capacity" note until the ... | jimy-r/agent-workspace-architecture | samples/scripts/heartbeat/review_queue.py | .py | 8379d9a6d34b2267 | 7.48 | 8 |
#!/usr/bin/env python3
"""Generate docs/llms-full.txt from the repo's substantive documentation.
`docs/llms.txt` is a link map: an answer engine that reads it still has to
fetch seven more URLs to get the actual content. `llms-full.txt` is the
companion convention that inlines that content, so a model absorbs the whol... | jimy-r/agent-workspace-architecture | scripts/gen_llms_full.py | .py | 54ee14a345444450 | 7.48 | 8 |
#!/usr/bin/env python3
"""Pattern-based redaction gate for the public mirror.
Scans the ADDED lines of a pull request for the *shapes* of private content —
email addresses, absolute home paths, and credential prefixes. Deliberately
generic: it must never hardcode the private strings it guards, because this
file is pub... | jimy-r/agent-workspace-architecture | scripts/redaction_check.py | .py | 49c10839a86a32e6 | 7.48 | 8 |
#!/usr/bin/env python3
"""Validate sample files have expected frontmatter and no identifying content.
Runs in CI. Fails the job if any sample file is malformed, missing required
frontmatter, or contains patterns that suggest machine-specific paths or
personal email addresses slipped in.
Design notes
------------
- Th... | jimy-r/agent-workspace-architecture | scripts/validate_samples.py | .py | dd3f319b80bac290 | 7.48 | 8 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Per-session 429/5xx exponential back-off for the parallel CI agent (S5).
The CI tech-writer drives several Goose sessions concurrently against one
rate-limited model endpoint (the \\$30 plan). A transient ``429 Too Many
Requests`` / ``5xx`` from the provi... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/backoff.py | .py | 330a0ea5366e27d9 | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Thin CLI entrypoint CI invokes around the one harness (RFC Q5).
``python -m beadloom.ai_agents.ai_techwriter --platform github|gitlab [--dry-run]``
This is the single entrypoint BOTH CI wrappers call — only the trigger, the
secret naming, and the ``--pla... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/cli.py | .py | a81479ed7f964aad | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Thin, patchable wrappers around ``beadloom`` / ``git`` subprocess calls.
These are the only place the harness shells out to external tools. They are
kept deliberately thin so tests can patch :func:`run_command` (or the helpers)
without monkeypatching ``su... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/commands.py | .py | a1f18a77b8954a74 | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Typed, immutable data structures for the AI tech-writer harness.
Pure data — no I/O, no subprocess. Every structure that crosses a seam (agent,
publisher, run-record store) is defined here so the contract is explicit and
mypy-checked end to end.
"""
from... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/models.py | .py | 20403edf061981d8 | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Build the per-doc context packet handed to the agent seam (RFC Q4).
Deterministic assembly: current doc content + drift reason + the polish-json
slice for the ref + ctx(ref) + why(ref).
"""
from __future__ import annotations
from typing import TYPE_CHEC... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/packet.py | .py | f835e09afd50c4eb | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Goose provider config + recipe location (RFC Q2 / Q4).
The model boundary, in one typed place:
* :class:`ProviderConfig` — Qwen3.7-Plus over an **OpenAI-compatible /
DashScope** endpoint. The API key is read from a **named environment
variable** (``Q... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/provider.py | .py | 6544630cf94786ab | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Append-only run-record store (G9): ``.beadloom/ai_techwriter_runs.json``.
Mirrors the honest-by-construction ``site_metrics_history`` store: a JSON array
appended to, never interpolated. The record's ``ts`` is injected (not
``now()``) so emission is deter... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/runs_store.py | .py | 6440cd0bdbc239ac | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Discover scope: parse ``beadloom sync-check --json`` into drift items.
Deterministic. Groups the flat per-pair report into one :class:`DriftItem`
per stale ref (collecting its drift reasons + the code files involved).
"""
from __future__ import annotatio... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/scope.py | .py | 56b4771123ed141c | 7.45 | 7 |
# beadloom:domain=ai_agents
# beadloom:feature=ai-techwriter
"""Symbol-level scope narrowing (BDL-052 S4 / RFC Thread C, Decision 4).
The tech-writer's stale set is, by default, *file-level*: a single edit to a
god-file (e.g. ``cli.py``) drifts every doc that file is linked to. This module
narrows that to *symbol-leve... | zoologov/beadloom | src/beadloom/ai_agents/ai_techwriter/symbol_scope.py | .py | ed63cf12d5e5cbfc | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=debt-report
"""Debt-report value types — the frozen data model shared across the package.
Owns the dataclasses produced and consumed by collection, scoring, trend, and
rendering: per-item weights/thresholds, the raw aggregated counts, the per-node
and per-category score... | zoologov/beadloom | src/beadloom/application/debt_report/models.py | .py | c972bc34d2a85c8b | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=debt-report
"""Debt scoring — the weighted 0-100 formula, severity mapping, and top offenders.
Turns the raw :class:`DebtData` counts into a :class:`DebtReport`: per-category
weighted scores, the capped overall score, its severity label, and the ranked
worst-offender no... | zoologov/beadloom | src/beadloom/application/debt_report/scoring.py | .py | 1dd152d5ef3ba0fd | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=debt-report
"""Debt trend tracking — compare the current score against the last snapshot.
Recomputes a structural debt score from a stored ``graph_snapshots`` row (only
nodes/edges are captured there) and produces per-category deltas vs the current
report, so the report... | zoologov/beadloom | src/beadloom/application/debt_report/trend.py | .py | 7f93605934fe584d | 7.45 | 7 |
# beadloom:domain=application
# beadloom:component=doc-shape-requirements
"""Resolve a project's required document sections, for the doc-shape check.
The shape a document must keep is derived from the composed doc templates, which
live in the ``onboarding`` domain; the check that reads a document back lives in
``doc-s... | zoologov/beadloom | src/beadloom/application/doc_shape.py | .py | f7eaf6178f744681 | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""``bead-claimed`` — is this edit covered by a claimed work item? (BDL-061 S1)
The flow's first rule ("never work a bead without claiming it") has until now
been prose the model may ignore. This is that rule as a mechanism: before an
edit, ask the tracker w... | zoologov/beadloom | src/beadloom/application/guards/checks/bead_claimed.py | .py | 9d315a91cad8c77a | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""Guard configuration — the ``guards:`` block of ``.beadloom/flow.yml`` (BDL-061 S1).
.. code-block:: yaml
guards:
bead-claimed:
strictness: { default: warn, epic: block, chore: off }
options: { }
exclusions:
- p... | zoologov/beadloom | src/beadloom/application/guards/config.py | .py | 3fc6f016fb035e50 | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""The contract a guard check is written against (BDL-061 S1).
A check receives a :class:`GuardRequest` — the project root, the evaluation
context supplied by the caller (``path``, ``tool``, ``work_kind``), and the
read-only **probes** it may consult — and r... | zoologov/beadloom | src/beadloom/application/guards/contract.py | .py | b7063ef4563fd219 | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""Evaluating one guard: check outcome + strictness + exclusions -> verdict (BDL-061 S1).
This is the single decision point every caller shares — the CLI, the harness
hook adapter, and (from S2) the Gate. Keeping it here rather than in the CLI is
what makes ... | zoologov/beadloom | src/beadloom/application/guards/evaluation.py | .py | b3721e24438e8502 | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""The guard firing record — evidence that a gate actually ran (BDL-061 S1).
A gate that cannot demonstrate it ran is treated as not having run, so every
evaluation the CLI performs appends one JSON line to
``.beadloom/guard-firings.jsonl``. That file is the... | zoologov/beadloom | src/beadloom/application/guards/firing.py | .py | 4756fc070c94aa1d | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""Translating a harness hook event into guard context (BDL-061 S1).
A harness hook hands its own JSON shape to whatever it invokes. Rather than let
each adapter script dig the file path out of that payload — which would put
decisions in the one place we can... | zoologov/beadloom | src/beadloom/application/guards/hook_payload.py | .py | 8bd6c27d2941a71c | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""Liveness — which guards are actually doing anything (BDL-061 S1).
Three ways a gate stops protecting anything without anyone noticing, all
reported per guard alongside the firing evidence by ``beadloom guard
--liveness``:
* it is configured off, or exclu... | zoologov/beadloom | src/beadloom/application/guards/liveness.py | .py | 4aa9b600a437bc6c | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""The guard verdict — the one shape every harness and every caller reads (BDL-061 S1).
A guard answers a *process* question ("is this edit covered by a claimed bead?")
and returns a :class:`GuardVerdict`. The verdict is the whole contract: an
adapter needs ... | zoologov/beadloom | src/beadloom/application/guards/models.py | .py | 4ac248ba31ed79e5 | 7.45 | 7 |
# beadloom:domain=application
# beadloom:feature=flow-guards
"""Resolving the edit path a guard is asked about (BDL-061 S1 fix).
Why this is a module and not one line on the request object: the path arrives
from the harness as ``tool_input.file_path`` — i.e. from the model — and it is
the input to exclusion matching, ... | zoologov/beadloom | src/beadloom/application/guards/paths.py | .py | 9136b66fcd78beb8 | 7.45 | 7 |
"""Assemble the granite-docling-258M fast_vlm `.litertlm` bundle.
Granite chat format (from the model's own chat_template.jinja):
<|start_of_role|>user<|end_of_role|>...<|end_of_text|>\n
<|start_of_role|>assistant<|end_of_role|>...
Image renders as the Idefics3 single-global-image block; the runtime splits on the
... | john-rocky/hf-to-litertlm | docling_work/build_granite_docling_bundle.py | .py | bfee51178bd27273 | 7.63 | 17 |
"""Rank-4 respelling of transformers' GQA `repeat_kv`.
The stock spelling — `x[:, :, None, :, :].expand(b, h, n_rep, s, d).reshape(...)`
— lowers to a rank-5 BROADCAST_TO + rank-5 RESHAPE, which the mobile GPU
delegates (Metal / OpenCL / WebGPU) refuse, leaving every LFM2.5 encoder-family
graph only partially delegate... | john-rocky/hf-to-litertlm | lfm_work/_rank4_repeat_kv.py | .py | d722b629e0bdfeb1 | 7.63 | 17 |
#!/usr/bin/env python3
"""Retrofit an ExecutorMetadata section onto an existing .litertlm (weights untouched).
litert-lm 0.15.0 changed how the runtime binds per-layer state buffers: for
state-carrying models (hybrid conv/attention like LFM2.5) the executor now reads
a dedicated `ExecutorMetadataProto` section (writte... | john-rocky/hf-to-litertlm | lfm_work/add_executor_metadata.py | .py | 87dc92beea88acd4 | 7.63 | 17 |
#!/usr/bin/env python3
"""Mac-CPU latency of the LFM2.5-ColBERT-350M LiteRT exports (XNNPACK, all threads).
.venv-092/bin/python scripts/bench_lfm25_colbert.py lfm25_colbert_work/out_350m
Run on a QUIET machine — a background convert/verify job moves these numbers by
more than the difference between variants, and... | john-rocky/hf-to-litertlm | lfm_work/bench_lfm25_colbert.py | .py | f3e111f3dd1e2a34 | 7.63 | 17 |
#!/usr/bin/env python3
"""Mac-CPU latency of the LFM2.5-Embedding-350M LiteRT exports (XNNPACK, all threads).
.venv-092/bin/python scripts/bench_lfm25_embedding.py lfm25_embed_work/out_350m
Run on a QUIET machine — a background convert/verify job moves these numbers by
more than the difference between variants, a... | john-rocky/hf-to-litertlm | lfm_work/bench_lfm25_embedding.py | .py | fda11564ff0619c2 | 7.63 | 17 |
#!/usr/bin/env python3
"""Convert LiquidAI LFM2.5 models to .litertlm.
python convert_lfm25.py LiquidAI/LFM2.5-1.2B-Instruct out_lfm25_12b [--fp] [--keep-softmax-composite]
Default exports the int8 file (litert-torch's export-time dynamic-int8 recipe,
convs included — safe at export time, unlike post-hoc conv int8)... | john-rocky/hf-to-litertlm | lfm_work/convert_lfm25.py | .py | 6aa085bc89d7159c | 7.63 | 17 |
#!/usr/bin/env python3
"""Convert LiquidAI/LFM2.5-2.6B (thinking flagship) to .litertlm.
python convert_lfm25_26b.py [hf_id] [out_dir] [--fp] [--keep-softmax-composite]
Default = export-time dynamic int8 (convs included — safe at export time).
Full int4 pipeline (the published int4 file):
python convert_lfm25_26... | john-rocky/hf-to-litertlm | lfm_work/convert_lfm25_26b.py | .py | 10bb97bb31444f36 | 7.63 | 17 |
#!/usr/bin/env python3
"""Convert LiquidAI/LFM2.5-Encoder-{350M,230M} (bidirectional LFM2 encoders) to LiteRT.
python convert_lfm25_encoder.py LiquidAI/LFM2.5-Encoder-230M out_lfm25_encoder_230m
Unlike the LFM2.5 decoder conversions this is NOT an export_hf run: the model is
a BERT-style bidirectional encoder (ma... | john-rocky/hf-to-litertlm | lfm_work/convert_lfm25_encoder.py | .py | 444043a92498c248 | 7.63 | 17 |
#!/usr/bin/env python3
"""Convert LiquidAI/LFM2.5-VL-3B to .litertlm (litert-torch >= 0.9.3).
python convert_lfm25_vl3b.py [hf_id_or_path] [out_dir] [--fp] [--keep-softmax-composite]
Default = export-time dynamic int8 (text + vision, dynamic_wi8_afp32).
--fp = unquantized TEXT export for post-hoc int4-b32 via
min... | john-rocky/hf-to-litertlm | lfm_work/convert_lfm25_vl.py | .py | d20aa4fb2aa9fef7 | 7.63 | 17 |
#!/usr/bin/env python3
"""Post-process an fp LFM2.5-VL .litertlm: int4-b32 text + zero-scale fix +
ExecutorMetadata, preserving ALL sections (vision encoder/adapter, embedder).
Why not quantize_litertlm.py / fix_zero_block_scales.py directly: both rebuild
with litert-lm-builder passing a SINGLE prefill_decode tflite, ... | john-rocky/hf-to-litertlm | lfm_work/quantize_lfm25_vl.py | .py | 0d877e50743bd627 | 7.63 | 17 |
#!/usr/bin/env python3
"""Daimon Codex hook lifecycle manager.
Installs two Codex command hooks:
- SessionStart -> inject latest daimon briefing as developer context
- Stop -> serialize Codex transcript opportunistically
Codex discovers hooks from ~/.codex/hooks.json or inline config.toml. This
manager us... | Daily-Nerd/daimon | hook/codex-hooks.py | .py | d5219f25649b9063 | 7.59 | 14 |
#!/usr/bin/env python3
"""Codex SessionEnd hook: checkpoint the true end of a session.
`Stop` fires at turn scope and is throttled, so the final tail of a session is
whatever the throttle happened to allow rather than the real end state. This
hook is the event the Stop hook has been apologising for not having: it fire... | Daily-Nerd/daimon | hook/daimon-codex-session-end.py | .py | 7d550ddd3566ad7c | 7.59 | 14 |
#!/usr/bin/env python3
"""Codex SessionStart hook: inject the latest daimon briefing as developer context.
Codex hook contract (official docs, verified 2026-06-12):
- command hooks receive JSON on stdin with common fields like session_id, cwd,
transcript_path, hook_event_name, and model.
- SessionStart stdout can ad... | Daily-Nerd/daimon | hook/daimon-codex-session-start.py | .py | 06e55c2c510c768d | 7.59 | 14 |
#!/usr/bin/env python3
"""Gemini CLI SessionEnd hook: serialize the ending session into a checkpoint.
Mirrors the Claude Code SessionEnd hook: reads the payload from stdin
({session_id, transcript_path, cwd, reason, ...}) and spawns
`daimon serialize <transcript_path>` as a DETACHED background process, so
the exiting ... | Daily-Nerd/daimon | hook/daimon-gemini-session-end.py | .py | daf537613edc2bf7 | 7.59 | 14 |
#!/usr/bin/env python3
"""Gemini CLI SessionStart hook: inject the latest daimon briefing as context.
Gemini hook contract (docs/hooks/reference.md, verified 2026-07-01):
- stdin carries JSON with session_id, transcript_path, cwd, hook_event_name,
timestamp, and SessionStart adds `source` ("startup" | "resume" | "cl... | Daily-Nerd/daimon | hook/daimon-gemini-session-start.py | .py | 12240a23ae354ac7 | 7.59 | 14 |
"""Claude Code UserPromptSubmit hook: the per-prompt injections.
Two of them, in this order:
1. Live request delivery (#756, opt-in via DAIMON_LIVE_DELIVERY, default
off): an undecided ask addressed to this project reaches a session that
was already running when it arrived, instead of waiting for that
sessio... | Daily-Nerd/daimon | hook/daimon-prompt-recall.py | .py | 145f67845e1c4fa9 | 7.59 | 14 |
#!/usr/bin/env python3
"""Claude Code SessionStart hook: inject the daimon briefing as session context.
Shells out to the installed `daimon brief` CLI (the single source of
truth for briefing rendering — same output as the hermes pre_llm_call path)
rather than re-rendering the checkpoint here, so the two hosts never d... | Daily-Nerd/daimon | hook/daimon-session-brief.py | .py | e983dff11cf69254 | 7.59 | 14 |
#!/usr/bin/env python3
"""Claude Code SessionEnd hook: serialize the ending session into a checkpoint.
Closes the capture gap: SessionStart injects the latest checkpoint, but until
now nothing WROTE one when a Claude Code session ended — briefings were only as
fresh as the last manual `daimon serialize` run.
Reads th... | Daily-Nerd/daimon | hook/daimon-session-end.py | .py | bb409505be5250d3 | 7.59 | 14 |
"""Deterministic capture-time secret redaction (#104) — stdlib only, zero LLM.
Checkpoints persist outside the session and the team mirror replicates them
to a shared remote, so a quoted secret must never reach disk. Patterns are
precision-first: each requires a concrete shape (assignment operator, URL
scheme, key pre... | Daily-Nerd/daimon | hook/redact.py | .py | f50f64d26c94d7e6 | 7.59 | 14 |
"""Anchor cognitive items to code symbols and detect drift.
A symbol is identified by (file, symbol) where symbol is `name` or `Class.method`.
The fingerprint is a structural hash (`ast.dump` of the def node), so it is stable
to formatting/comments/line-shift and changes only on real structural edits. No MCP,
no LLM, ... | Daily-Nerd/daimon | plugin/daimon_briefing/anchor.py | .py | c26fd47a12889886 | 7.59 | 14 |
"""Shared ledger-record helpers for the refutation and ruling verb families.
Pure moves out of the cli monolith (#708): the JSON stamper, the two record
printers, the channel resolver, and the polarity gate. Both `cli.refute` and
`cli.ruling` render through these; `refute search` prints BOTH polarities, so
they cannot... | Daily-Nerd/daimon | plugin/daimon_briefing/cli/_ledger.py | .py | 7ee4941d5cb28895 | 7.59 | 14 |
"""`daimon audit` verbs — quote and privacy audits (#708 move).
Shared helpers that remain in the package `__init__` are reached through the
module object (`_cli.<name>`).
"""
import json
import daimon_briefing.cli as _cli
from .. import (
config,
privacy,
provenance,
render,
serializer,
sto... | Daily-Nerd/daimon | plugin/daimon_briefing/cli/audit.py | .py | 699bbd93c480430f | 7.59 | 14 |
"""`daimon hooks` verbs — packaged hook install and status (#708 move).
Host tables and drift helpers stay in the package `__init__` (brief/status
consume them too) and are reached through the module object (`_cli.<name>`).
"""
import functools
import json
import sys
from pathlib import Path
import daimon_briefing.c... | Daily-Nerd/daimon | plugin/daimon_briefing/cli/hooks.py | .py | 8e182cb01a7860b6 | 7.59 | 14 |
"""`daimon team` verbs — sidecar init, sync, and status (#708 move).
Shared helpers that remain in the package `__init__` are reached through the
module object (`_cli.<name>`).
"""
import functools
import json
import sys
from pathlib import Path
import daimon_briefing.cli as _cli
from .. import config, recall, rend... | Daily-Nerd/daimon | plugin/daimon_briefing/cli/team.py | .py | 7d22b9f8792691f4 | 7.59 | 14 |
"""Packaged Codex hook installer — the released `daimon hooks install codex`
path (#262).
Codex is unlike the other packaged hosts: instead of a single entry script that
the user registers by hand, it runs two distinct scripts under two events
(SessionStart briefing injection, Stop opportunistic capture) and discovers... | Daily-Nerd/daimon | plugin/daimon_briefing/codex_hooks.py | .py | 54986f35a8267d46 | 7.59 | 14 |
"""Onboarding helper: detect the resolved LLM backend and fill config gaps by
writing ~/.daimon/env. Detection is NOT reimplemented — it reuses the real
resolver in llm.py so the doctor view can never disagree with what llm.chat()
would actually run (the single-source-of-truth requirement from #48).
Stdlib only, offli... | Daily-Nerd/daimon | plugin/daimon_briefing/configure.py | .py | a875b025391daee7 | 7.59 | 14 |
"""Zero-LLM scar-candidate harvester (#76). Session-end, opt-in, never breaks a session.
Scans the transcript for anchorable negative knowledge and drafts scar *candidates*
into <project_root>/.scars/candidates/. Path-anchored only (Fork 2): a hit with no
real file/dir path in its own span is dropped — precision over ... | Daily-Nerd/daimon | plugin/daimon_briefing/harvest.py | .py | ba33433e1bc09038 | 7.59 | 14 |
"""Host hook callbacks for in-process capture. Both hooks are defensive: a
broken hook must NEVER break the user's session, so everything is wrapped —
failures log, leave a ledger entry in serialize.log, and give up.
# VERIFIED host plugin guide (hook callback signatures):
# on_session_end(session_id, completed, int... | Daily-Nerd/daimon | plugin/daimon_briefing/hooks.py | .py | 1b296aad1e50dae6 | 7.59 | 14 |
"""Read-side trust inspection for one project-scoped cognitive item (#502).
The inspector keeps evidence axes independent. It never turns a changed
source into a failed quote verdict, never treats a missing local transcript as
an unsupported host, and never promotes legacy origin metadata into a bound
receipt. Files... | Daily-Nerd/daimon | plugin/daimon_briefing/inspector.py | .py | fb599797478db21c | 8.09 | 14 |
"""SkillNet A2A Server — JSON-RPC 2.0 over HTTP."""
import json
import logging
import uuid
import uvicorn
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.routing import Route
from src.agent_card import AGENT_CARD
from src... | ANFAIA/SkillNet | apps/skillnet-a2a/src/main.py | .py | c41a9c6d202c9092 | 7.45 | 7 |
"""Async HTTP client for the SkillNet external API."""
import uuid
import httpx
from src.config import settings
class SkillNetClient:
"""Thin wrapper over SkillNet /ext/v1/ endpoints."""
def __init__(self) -> None:
self._base = settings.API_URL.rstrip("/")
self._headers = {"Authorization":... | ANFAIA/SkillNet | apps/skillnet-a2a/src/skillnet_client.py | .py | 1c3bf04d1ebaa30b | 7.45 | 7 |
"""Tests for the A2A orchestrator tool dispatch."""
import json
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
@pytest.fixture
def mock_skillnet_client():
"""Mock SkillNetClient responses."""
with patch("src.tools.SkillNetClient") as mock_cls:
client = mock_cls.return_value
... | ANFAIA/SkillNet | apps/skillnet-a2a/tests/test_orchestrator.py | .py | 925245596c96c79d | 7.95 | 7 |
"""Alembic async environment."""
import asyncio
import os
from logging.config import fileConfig
from alembic import context
from sqlalchemy.engine import Connection
from sqlalchemy.ext.asyncio import create_async_engine
from src.config import settings
from src.models import Base
config = context.config
if config.c... | ANFAIA/SkillNet | apps/skillnet-api/alembic/env.py | .py | cb532954f211e430 | 7.45 | 7 |
"""add lesson_progress table for tracking per-lesson completion
Revision ID: 0002
Revises: 0001
Create Date: 2026-07-21
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "0002"
down_revision: str | None = "0001"
branch_labels: str | Sequence[str] | None = None
d... | ANFAIA/SkillNet | apps/skillnet-api/alembic/versions/0002_add_lesson_progress.py | .py | 1637a7dee18b47a8 | 7.45 | 7 |
"""add skill_categories, skills, user_skills, and api_keys tables
Revision ID: 0003
Revises: 0002
Create Date: 2026-07-21
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision: str = "0003"
down_revision: str | None = "0002"
branc... | ANFAIA/SkillNet | apps/skillnet-api/alembic/versions/0003_add_skills_and_api_keys.py | .py | 0c69a910d3d87d22 | 7.45 | 7 |
"""add course_skills join table
Revision ID: 0004
Revises: 0003
Create Date: 2026-07-21
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "0004"
down_revision: str | None = "0003"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] |... | ANFAIA/SkillNet | apps/skillnet-api/alembic/versions/0004_add_course_skills.py | .py | 0804bbc2bf453bc1 | 7.45 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.