Skip to content

rai0409/internal_automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Internal Automation for Gmail, Calendar, and Reviewable Operations

Production-minded workflow automation for internal teams handling email triage, scheduling coordination, meeting summaries, and daily operational review.

This repository focuses on reviewable automation rather than black-box autonomy:

  • structured outputs
  • explicit workflow states
  • human review checkpoints
  • practical CLI-based operation
  • integration with Gmail and Google Calendar

Why this exists

Many internal teams spend too much time on repetitive operational work such as:

  • triaging inbound email
  • drafting replies for scheduling or customer coordination
  • checking calendars for candidate slots
  • summarizing meetings into actionable outputs
  • carrying over unresolved items into the next day
  • manually tracking what still needs human review

This project reduces that overhead while keeping the workflow transparent, inspectable, and safe for real business use.

What it does

1. Email triage

Processes unread email, normalizes content, applies deterministic rules plus LLM triage, and stores structured results.

Current behavior includes:

  • unread email retrieval
  • structured triage output
  • draft generation support
  • calendar candidate slot generation when needed
  • explicit human review flags
  • deterministic suppression of obvious noise-like emails

2. Meeting summarization

Processes a meeting input payload and stores:

  • summary
  • decisions
  • action items
  • open questions

3. Daily digest

Aggregates saved triage results and meeting summaries by date to produce:

  • top highlights
  • important actions
  • carry-over items
  • open questions collected from meeting summaries

4. Review workflow

Supports human-in-the-loop follow-up on saved records across:

  • mail triage
  • meeting summaries
  • daily digests

Current review CLI supports:

  • listing pending review records
  • updating review / delivery status for saved records

Example workflow

Unread email
→ deterministic rule signals
→ LLM triage
→ optional calendar slot generation
→ draft creation or suppression
→ structured persistence
→ human review
→ status update

Current CLI flows

Email

uv run python -m internal_automation.main --flow email --dry-run
Meeting
uv run python -m internal_automation.main --flow meeting --input sample.json
Digest
uv run python -m internal_automation.main --flow digest --date 2026-04-11
Review

List pending review records:

uv run python -m internal_automation.main --flow review --action list-pending

List pending review records for meeting summaries:

uv run python -m internal_automation.main --flow review --target meeting --action list-pending

List pending review records for daily digests:

uv run python -m internal_automation.main --flow review --target digest --action list-pending

Update status for a saved triage record:

uv run python -m internal_automation.main --flow review --action update-status --record-id 1 --human-review-status auto_ok --delivery-status draft_sent
Email workflow details

The email workflow is designed to be practical rather than fully autonomous.

Current behavior:

retrieves unread messages using Gmail
normalizes subject/body text
applies deterministic mail rules before/after model output
runs structured LLM triage
forces human review for higher-risk cases
computes calendar candidate slots when scheduling review is needed
stores raw input, normalized input, AI output, and workflow status

Examples of current safety behavior:

dry-run does not create drafts
obvious noise-like messages can suppress draft creation
requested datetime stays at the front when scheduling candidates are built
fallback candidate slots are normalized and prioritized for readability
Calendar candidate slot behavior

Current slot behavior is intentionally lightweight and practical:

requested slot stays first when extracted
fallback candidates are normalized to :00 / :30
nearby candidates are preferred
same-day candidates are preferred first
next business day is preferred next
weekend exclusion is lightweight and intentionally minimal

This is not a full scheduling engine. It is a practical reply-support mechanism for internal operations.

Review workflow details

Saved reviewable records include workflow state fields such as:

human_review_status
delivery_status

Canonical human_review_status values (current contract):
- needs_review
- auto_ok
- reviewed_ok
- rejected

Canonical delivery_status values (current contract):
- not_applicable
- pending_draft
- draft_created
- draft_sent
- stored
- delivered

Pending review rule (current contract):
- list-pending returns records where `human_review_status == "needs_review"` only.

Review target selection (current contract):
- `--target` supports `mail`, `meeting`, and `digest`.
- when `--target` is omitted, it defaults to `mail`.

This keeps the implementation narrow and operationally useful while leaving richer approval/export workflows for future increments.
Storage

The project currently uses SQLite for local persistence.

Primary tables:

mail_triage_results
meeting_summaries
daily_digests

Saved records include:

raw input
normalized input
AI output
created / updated timestamps
human review status
delivery status
Quick start
uv sync
uv run pytest

Run email triage in dry-run mode:

uv run python -m internal_automation.main --flow email --dry-run
Repository layout
.
├── docs/
├── examples/
├── src/
│   └── internal_automation/
├── tests/
├── .env.example
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
└── uv.lock
Environment

Main environment variables are defined in .env.example, including:

DATABASE_URL
GOOGLE_CLIENT_SECRET_PATH
GOOGLE_TOKEN_PATH
GMAIL_USER_ID
GMAIL_QUERY
GCAL_CALENDAR_ID
ANTHROPIC_API_KEY
CREWAI_MODEL
DEFAULT_TIMEZONE
EMAIL_MAX_CANDIDATE_SLOTS

OAuth credentials and tokens are stored locally and are intentionally excluded from version control.

Positioning

This repository is best understood as:

a lightweight internal automation MVP
a reviewable operations workflow tool
a production-minded base for human-in-the-loop business automation
a practical foundation for commercial internal ops tooling

It is intentionally not yet:

a full autonomous agent platform
a full scheduling platform
a UI-first product
a large-scale workflow orchestration system
Commercial direction

This project is suitable as a foundation for commercial internal tooling in areas such as:

inbox operations
scheduling assistance
internal coordination workflows
meeting follow-up automation
human-reviewed AI operations systems

The current implementation prioritizes:

explicit state
safe reviewability
simple deployment
narrow, reliable workflow steps
License

This repository is source-available for personal study, research, and evaluation.
Commercial use requires prior written permission and a separate paid license.
See LICENSE for details.

About

Python workflow automation for Japanese business email triage and calendar coordination

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages