Developer Handover Pack
Everything needed to build the automation from scratch: current state, full agent specs, data flow, and the build stack.
Developer Handover Pack
Audit Preparation Workflow
[YourCompany.com] · Legal Department · Prepared by FullSpec · [Today's Date]
This document is the primary technical reference for the FullSpec team building the Audit Preparation Workflow automation. It covers the current-state process map, agent specifications with IO definitions, the end-to-end data flow, and the recommended build stack. Everything needed to build, connect, and test the two-agent orchestration is contained here. The compliance manager's responsibilities and the owner-facing SOP are covered in separate documents.
01Process snapshot
02Agent specifications
Monitors the Notion audit record from the moment it is created, generates the structured evidence checklist, dispatches personalised assignment emails via Gmail, creates the Drive submission folder hierarchy, and runs a daily status-monitoring loop that fires overdue alerts through both Slack and Gmail when submission deadlines pass. This agent removes all manual assignment drafting and all recurring tracker-update sessions from the compliance manager's workload. It does not make pass/fail decisions on document content; that responsibility sits with the Document Review and Organisation Agent.
// Input
notion.audit_record {
audit_id: string, // unique record ID
audit_type: enum, // e.g. 'SOC2' | 'ISO27001' | 'Financial'
engagement_date: date, // confirmed audit start date
internal_deadline: date, // evidence submission cutoff
assigned_owner: string, // compliance manager name
stakeholder_list: array // [{name, email, slack_id, doc_items[]}]
}
// Output
notion.checklist_record[] {
item_id: string,
document_name: string,
assigned_to: string,
due_date: date,
status: enum // 'pending' | 'received' | 'overdue' | 'verified'
}
gmail.assignment_email {
to: stakeholder_email,
subject: 'Audit Evidence Request: [document_name]',
body: personalised_template // includes doc name, format, internal_deadline
}
google_drive.folder {
folder_name: 'Audit_[audit_id]_[engagement_date]',
subfolders: [audit_type categories],
permissions: per_stakeholder_email
}
slack.overdue_alert {
channel: stakeholder_slack_id,
message: 'Reminder: [document_name] is overdue. Deadline was [due_date].'
}
gmail.overdue_email {
to: stakeholder_email,
subject: 'Action Required: Overdue Audit Submission',
body: overdue_reminder_template
}- Notion API tier: The workspace must be on a plan that exposes database API access (Business or Enterprise). Confirm before build. The checklist database schema must be finalised and locked before the agent is connected; mapping against an ad-hoc schema will cause field-resolution errors.
- Gmail sender: Use a shared compliance inbox (e.g. compliance@[YourCompany.com]) authenticated via OAuth 2.0 with the gmail.send scope. Do not use a personal account; alias sending must be enabled in Google Workspace settings.
- Slack workspace permissions: The bot token requires chat:write and users:read.email scopes to resolve stakeholder Slack IDs from email addresses in the stakeholder_list array.
- Drive folder creation: The integration must have drive.file scope at minimum. Confirm the automation platform supports Drive folder-level create and share operations. If only polling is available (no webhook at this stage), set the monitoring loop interval to every 6 hours during active audit windows.
- Overdue logic: An item is overdue when current_date > due_date AND status != 'received' AND status != 'verified'. Send a maximum of three automated reminders per item (day 0 of overdue, day 2, day 5) before escalating a Slack alert to the compliance manager directly.
- Dedupe: The trigger must check for an existing checklist linked to the same audit_id before creating a new one. If a record already exists, update rather than duplicate.
- Stakeholder list population: If the audit_type field does not map to a known template, pause and send a Slack alert to the compliance manager to manually populate line items before assignment emails are sent.
Watches the audit submission folder in Google Drive for new file uploads and runs each file through a validation routine: checking filename conventions, file type, and cross-referencing against the open Notion checklist items. Files that pass validation are moved to the verified sub-folder and the corresponding Notion status is updated to 'verified'. Files that require a director or department-head signature are routed automatically via DocuSign, and a completion webhook updates the checklist on return. Files that cannot be matched, are in an unexpected format, or are flagged ambiguous are queued for the compliance manager's review rather than processed automatically. Once all checklist items reach a terminal status (verified or escalated), the agent posts a completion alert to the designated Slack channel.
// Input
google_drive.file_upload_event {
file_id: string,
file_name: string,
mime_type: string,
uploaded_by_email: string,
parent_folder_id: string,
upload_timestamp: datetime
}
notion.checklist_record {
item_id: string,
document_name: string,
assigned_to: string,
expected_format: string, // e.g. 'PDF' | 'XLSX'
requires_signature: boolean,
signatory_email: string // director or dept head, if requires_signature
}
// Output (validated file)
google_drive.file_move {
file_id: string,
destination_folder: 'Audit_[audit_id]/Verified/[category]',
renamed_to: '[item_id]_[document_name]_v[timestamp]'
}
notion.checklist_update {
item_id: string,
status: 'verified',
verified_at: datetime,
drive_file_id: string
}
// Output (signature required)
docusign.envelope {
envelope_id: string,
document: drive_file_id,
signer_email: signatory_email,
signer_name: string,
subject: 'Signature Required: [document_name]',
callback_webhook_url: 'https://[automation-host]/webhook/docusign-complete'
}
// On approval (DocuSign webhook return)
docusign.envelope_completed {
envelope_id: string,
signed_document_url: string,
completed_at: datetime
}
notion.checklist_update { status: 'verified', signed: true }
// Output (flagged file)
notion.checklist_update { status: 'flagged', flag_reason: string }
slack.escalation_alert {
channel: compliance_manager_slack_id,
message: 'File [file_name] could not be matched or validated. Manual review required.'
}
// Output (all items terminal)
slack.completion_alert {
channel: '#compliance-alerts',
message: 'Evidence pack for [audit_id] is complete. All items verified. Ready for auditor access.'
}- Drive trigger method: Prefer a Google Drive push notification (webhook) registered against the submission folder. If the automation platform does not support Drive webhooks natively, fall back to polling every 6 hours and document this limitation in the SOP.
- File matching logic: Match uploaded files to checklist items using a combination of the uploader's email (uploaded_by_email maps to assigned_to) and a fuzzy name match against document_name. If confidence is below 80%, treat as flagged rather than auto-matched.
- Naming convention on move: On successful validation, rename the file to the format [item_id]_[snake_case_document_name]_[YYYYMMDD] before moving to the Verified sub-folder. This must be agreed with the compliance manager before build.
- DocuSign routing table: A mapping table of document_name to requires_signature and signatory_email must be documented and loaded as configuration before the agent is built. Routing logic differs by audit category. Agree this table with the compliance manager before build begins.
- DocuSign webhook: Register the completion webhook URL in the DocuSign account under Connect settings. The webhook payload must include the envelope_id and signed document download URL. Validate HMAC signature on receipt.
- Escalation cap: If more than 30% of checklist items are flagged in a single pass, pause automated processing and alert the compliance manager via Slack before continuing. This prevents cascading mis-matches from a structural folder error.
- Completion check: After every Notion status update, query the full checklist for the audit_id. If all items are in a terminal state (verified or human-escalated and marked resolved), fire the completion Slack alert. Do not fire if any item remains pending or overdue.
03End-to-end data flow
// ============================================================
// AUDIT PREPARATION WORKFLOW | End-to-End Data Flow
// ============================================================
// TRIGGER
// User creates a new Notion database record with audit_type,
// engagement_date, internal_deadline, and stakeholder_list populated.
notion.database.audit_records [INSERT event]
-> fields captured: audit_id, audit_type, engagement_date,
internal_deadline, assigned_owner,
stakeholder_list[{name, email, slack_id, doc_items[]}]
// ============================================================
// AGENT HANDOFF 1: Notion trigger -> Evidence Collection Agent
// ============================================================
// STEP 1: Generate evidence checklist in Notion
evidence_collection_agent.generate_checklist(
input: { audit_id, audit_type, stakeholder_list, internal_deadline }
)
-> notion.database.audit_checklist [INSERT rows]
-> fields written: item_id, document_name, assigned_to,
due_date, status='pending'
// STEP 2: Send personalised assignment emails via Gmail
evidence_collection_agent.send_assignment_emails(
input: { stakeholder_list, checklist_items[], internal_deadline }
)
-> gmail.send()
-> fields used: to=stakeholder_email, subject, body_template,
doc_items[] per stakeholder
// STEP 3: Create Drive submission folder and sub-folders
evidence_collection_agent.create_drive_structure(
input: { audit_id, engagement_date, audit_type, stakeholder_list }
)
-> google_drive.folders.create()
-> folder_name: 'Audit_[audit_id]_[engagement_date]'
-> subfolders: one per audit category from audit_type template
-> permissions: stakeholder_email granted 'writer' per assigned subfolder
// STEP 4: Daily monitoring loop (scheduled, every 6 hours)
evidence_collection_agent.monitor_submissions(
input: { audit_id, checklist_items[], drive_folder_id }
)
-> google_drive.files.list(parent=drive_folder_id)
-> cross-reference: file uploaded_by_email vs checklist assigned_to
-> notion.checklist_update(item_id, status='received') if matched
-> overdue_check: current_date > due_date AND status='pending'
// STEP 5: Overdue escalation (fires when overdue_check = true)
evidence_collection_agent.send_overdue_alerts(
input: { overdue_items[], stakeholder_list }
)
-> slack.chat.postMessage(channel=stakeholder_slack_id)
fields: item_id, document_name, due_date, overdue_message
-> gmail.send(to=stakeholder_email, overdue_template)
-> reminder_count++ per item_id (max 3 before compliance_manager escalation)
// ============================================================
// AGENT HANDOFF 2: Drive upload event -> Document Review Agent
// ============================================================
// STEP 6: File validation on upload
document_review_agent.validate_file(
input: { file_id, file_name, mime_type, uploaded_by_email,
parent_folder_id, upload_timestamp }
)
-> match: cross-reference file_name + uploaded_by_email vs
notion.checklist_record { item_id, document_name,
assigned_to, expected_format }
-> confidence_score: fuzzy match on document_name (threshold >= 0.80)
// BRANCH A: Validated, no signature required
IF confidence >= 0.80 AND requires_signature = false
-> google_drive.files.move(
file_id,
destination='Audit_[audit_id]/Verified/[category]',
rename='[item_id]_[document_name]_[YYYYMMDD]'
)
-> notion.checklist_update(
item_id, status='verified',
verified_at=timestamp, drive_file_id=file_id
)
// BRANCH B: Validated, signature required
IF confidence >= 0.80 AND requires_signature = true
-> docusign.envelopes.create(
document=file_id,
signer_email=signatory_email,
signer_name=signatory_name,
subject='Signature Required: [document_name]',
webhook_url='https://[automation-host]/webhook/docusign-complete'
)
-> notion.checklist_update(item_id, status='awaiting_signature',
docusign_envelope_id=envelope_id)
// BRANCH C: Low confidence or format mismatch (flagged)
IF confidence < 0.80 OR mime_type != expected_format
-> notion.checklist_update(item_id, status='flagged',
flag_reason='name_mismatch|format_error|no_match')
-> slack.chat.postMessage(
channel=compliance_manager_slack_id,
message='File [file_name] flagged. Manual review required.'
)
// ============================================================
// WEBHOOK RETURN: DocuSign envelope completion
// ============================================================
docusign.connect_webhook [POST /webhook/docusign-complete]
-> payload: { envelope_id, status='completed',
signed_document_url, completed_at }
-> validate HMAC signature against DocuSign connect secret
-> google_drive.files.upload(signed_document_url,
destination='Audit_[audit_id]/Verified/[category]')
-> notion.checklist_update(item_id, status='verified', signed=true,
verified_at=completed_at)
// ============================================================
// COMPLETION CHECK (runs after every notion.checklist_update)
// ============================================================
document_review_agent.check_completion(
input: { audit_id }
)
-> query: notion.checklist WHERE audit_id=[audit_id]
-> all items IN ('verified', 'escalated_resolved') ?
YES -> slack.chat.postMessage(
channel='#compliance-alerts',
message='Evidence pack [audit_id] complete. All items verified.'
)
NO -> no action, continue monitoring loop04Recommended build stack
More documents for this process
Every document generated for Audit Preparation Workflow.