Thanks for helping build a shared, honest representation of computer activity for agents.
44% of a real browser history is niche sites. Every site parser you add makes activity frames sharper for everyone. A parser is a pure function of the URL - no network, no state, reviewable in one sitting.
- Open
src/activity_frames/entities.py. - Add a function that takes
(domain, parts, q)and returns aPageRef(orNoneto fall through).partsis the path split on/;qis the parsed query dict. - Register it in
_SITE_PARSERSby host. - Add a test in
tests/test_entities.py.
def _hackernews(domain, parts, q):
if parts and parts[0] == "item":
return PageRef(kind="post", domain=domain, entity=q.get("id", [None])[0])
if parts and parts[0] == "user":
return PageRef(kind="profile", domain=domain, entity=q.get("id", [None])[0])
return None
# in _SITE_PARSERS:
"news.ycombinator.com": _hackernews,- Deterministic. Output must be a pure function of the URL. No clocks, no randomness, no fetching.
- Total. Return
Nonefor paths you do not handle so the fallback layers can type them; never raise. - Honest kinds. A
kinddescribes what a page is (profile,repo,event), never what the user was doing there (prospecting,researching). Intent is the agent's job, not the parser's. See SPEC.md section 7. - No content. Parse the URL only. Do not pull identifiers from page bodies.
- Capture sources. The compiler is engine-agnostic. A new source needs an adapter that presents
frames,ui_events, andelementstables (seedb.pyand SPEC.md section 9). - Bug fixes and robustness. Edge cases in timezones, multi-monitor coordinates, and malformed capture data are always welcome.
git clone https://github.com/nossa-y/activity-frames
cd activity-frames
pip install -e ".[dev]"
pytest -qEverything is standard-library Python (PyYAML is the only optional extra). Keep it that way where you can: zero required dependencies is a feature.
- Determinism is the core promise. A change that makes output depend on wall-clock time, network, or a model will be declined.
- Keep the measured tier measured. New fields must be derivable by code; anything inferred belongs in the tier-2 extension with a confidence tag.
- Add a test with every behavior change.
By contributing you agree your work is licensed under the project's MIT license.