Skip to content

feat(analysis): read the dates assets give as days, for agents to find by day - #504

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-hyaa6h
Oct 17, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-hyaa6h

Conversation

@adeelahmad

@adeelahmad adeelahmad commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: a line saying "next Tuesday" or "last week" was only text; an agent asked what was planned for a day had to search words and work the calendar out itself.

After: with Settings → Analysis → Read dates as days on (off by default), analysis reads the dates each line gives as days on the calendar, worked out from the asset's own date: "next Tuesday" in a recording made on a Wednesday is the Tuesday after, "last week" Monday to Sunday before, "March 2024" all of March. Agents ask what was said about a day or range with GET /api/v1/dates, the MCP tool list_dates and the assistant's find_dates, each date with its line and a link to that moment, within what the person can read. A weekday alone, a date that reads two ways ("10/11/2026"), "may" in small letters and a bare number are left out rather than guessed.

How: app/domain/dates.py holds English rules (no model or package: dateparser couldn't read "next Tuesday") and writes date_said rows (words, first and last day, period, whether it was relative). The rows go with the recording when it's deleted, reset or moved, and are cleared when its lines are split or merged until analysis reads them again. OpenAPI and the client regenerated with make openapi. The README's built list and docs/requirements.md now carry this and the series' merged pieces (cleanup #476, punctuation #485, spaCy #492), each with the tests that check it.

Motivation and Context

Adeel asked for "dates extraction" in the cleanup series (#476 cleanup, #485 punctuation, #492 spaCy). Grammar follows. find's date filter (#398) is when an asset was made; this is the days its words talk about.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: dates extracted and usable; merged on green CI.
  • Agents: GET /api/v1/dates, MCP list_dates, assistant find_dates, the setting through PUT /api/v1/settings/analysis and change_settings.
  • Zero setup: rules in Lens's own code.
  • Fewest clicks: one switch.
  • Configurable: Settings → Analysis, default off.
  • Light: pure Python rules.
  • Private and secure: reads stored text locally; the endpoint and tools return only what the person can read (scoped like search).
  • Cost: no model calls.
  • User decides: off by default; ambiguous dates are left out, not guessed.
  • Upgrades: date_said is a new table that SCHEMA adds on start; assets already there are read on Reprocess (Analyze), as the docs say.
  • Honest: docs list what's read and what's left out (English only); README built list and requirements rows added (make requirements passes).
  • Tests in tests/api/test_dates.py (rules, ambiguity, off by default, API, MCP, assistant); docs/processing.md, docs/api.md, docs/mcp.md, docs/assistant.md, docs/requirements.md, README, CHANGELOG, DEVLOG updated; OpenAPI regenerated with make openapi.
  • Open: ISO 8601 days; no new dependencies.
  • Reported in the project thread; refine later: other languages, times of day, dates in documents' own metadata, a calendar view.
  • Reuse: dateparser (BSD) was tried first and couldn't read "next Tuesday", "this Friday" or "tonight", so the rules are Lens's own; the API reuses search's scoping (acl.scope, library.in_scope) and the MCP and assistant tool patterns.

Local CI (ci/local-ci.sh): backend (embedded and server SurrealDB), Next.js, pre-commit and title passed; after the README and requirements rows, pre-commit and title again.

🤖 Generated with Claude Code

https://claude.ai/code/session_014z3r72SB2quWGKbgGt46mZ

@adeelahmad adeelahmad self-assigned this Oct 17, 2026
@adeelahmad
adeelahmad force-pushed the claude/project-thread-hyaa6h branch 3 times, most recently from eab0d32 to 174eb17 Compare October 17, 2026 06:13
…d by day

With Settings > Analysis > Read dates on (off by default), analysis reads
each line for the dates it gives and keeps them in date_said: the words, the
first and last day they mean, the period (day, weekend, week, month, year)
and whether they were worked out from the asset's own date. "next Tuesday"
in a recording made on a Wednesday is the Tuesday after, "last week" the
Monday to Sunday before, "March 2024" all of March.

Agents find what was said about a day or a range with GET /api/v1/dates
(start and end as YYYY-MM-DD, YYYY-MM or YYYY), the MCP tool list_dates and
the assistant's find_dates, each date with its line and a link to that
moment, within what the person can read.

English rules in Lens's own code, no model or package. A weekday alone, a
date that reads two ways (10/11/2026), "may" in small letters and a bare
number like "2000 people" are left out rather than guessed. Rows go with the
recording when it's deleted, reset or moved, and are cleared when its lines
are split or merged until analysis reads them again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014z3r72SB2quWGKbgGt46mZ
@adeelahmad
adeelahmad force-pushed the claude/project-thread-hyaa6h branch from 174eb17 to 7dc69ca Compare October 17, 2026 06:39
@adeelahmad
adeelahmad merged commit a07d4fb into main Oct 17, 2026
11 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-hyaa6h branch October 17, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants