repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: Content Creation Workflow |
| #3 | description: "Store voice guidelines once and apply them across every draft." |
| #4 | --- |
| #5 | |
| #6 | |
| #7 | This guide demonstrates how to leverage **Mem0** to streamline content writing by applying your unique writing style and preferences using persistent memory. |
| #8 | |
| #9 | ## Why Use Mem0? |
| #10 | |
| #11 | Integrating Mem0 into your writing workflow helps you: |
| #12 | |
| #13 | 1. **Store persistent writing preferences** ensuring consistent tone, formatting, and structure. |
| #14 | 2. **Automate content refinement** by retrieving preferences when rewriting or reviewing content. |
| #15 | 3. **Scale your writing style** so it applies consistently across multiple documents or sessions. |
| #16 | |
| #17 | ## Setup |
| #18 | |
| #19 | ```python |
| #20 | import os |
| #21 | from openai import OpenAI |
| #22 | from mem0 import MemoryClient |
| #23 | |
| #24 | os.environ["MEM0_API_KEY"] = "your-mem0-api-key" |
| #25 | os.environ["OPENAI_API_KEY"] = "your-openai-api-key" |
| #26 | |
| #27 | |
| #28 | # Set up Mem0 and OpenAI client |
| #29 | client = MemoryClient() |
| #30 | openai = OpenAI() |
| #31 | |
| #32 | USER_ID = "content_writer" |
| #33 | RUN_ID = "smart_editing_session" |
| #34 | ``` |
| #35 | |
| #36 | ## Storing Your Writing Preferences in Mem0 |
| #37 | |
| #38 | ```python |
| #39 | def store_writing_preferences(): |
| #40 | """Store your writing preferences in Mem0.""" |
| #41 | |
| #42 | preferences = """My writing preferences: |
| #43 | 1. Use headings and sub-headings for structure. |
| #44 | 2. Keep paragraphs concise (8–10 sentences max). |
| #45 | 3. Incorporate specific numbers and statistics. |
| #46 | 4. Provide concrete examples. |
| #47 | 5. Use bullet points for clarity. |
| #48 | 6. Avoid jargon and buzzwords.""" |
| #49 | |
| #50 | messages = [ |
| #51 | {"role": "user", "content": "Here are my writing style preferences."}, |
| #52 | {"role": "assistant", "content": preferences} |
| #53 | ] |
| #54 | |
| #55 | response = client.add( |
| #56 | messages, |
| #57 | user_id=USER_ID, |
| #58 | run_id=RUN_ID, |
| #59 | metadata={"type": "preferences", "category": "writing_style"} |
| #60 | ) |
| #61 | |
| #62 | return response |
| #63 | ``` |
| #64 | |
| #65 | ## Editing Content Using Stored Preferences |
| #66 | |
| #67 | ```python |
| #68 | def apply_writing_style(original_content): |
| #69 | """Use preferences stored in Mem0 to guide content rewriting.""" |
| #70 | |
| #71 | results = client.search( |
| #72 | query="What are my writing style preferences?", |
| #73 | filters={ |
| #74 | "AND": [ |
| #75 | {"user_id": USER_ID}, |
| #76 | {"run_id": RUN_ID} |
| #77 | ] |
| #78 | } |
| #79 | ) |
| #80 | |
| #81 | if not results: |
| #82 | print("No preferences found.") |
| #83 | return None |
| #84 | |
| #85 | preferences = "\n".join(r["memory"] for r in results.get('results', [])) |
| #86 | |
| #87 | system_prompt = f""" |
| #88 | You are a writing assistant. |
| #89 | |
| #90 | Apply the following writing style preferences to improve the user's content: |
| #91 | |
| #92 | Preferences: |
| #93 | {preferences} |
| #94 | """ |
| #95 | |
| #96 | messages = [ |
| #97 | {"role": "system", "content": system_prompt}, |
| #98 | {"role": "user", "content": f"""Original Content: |
| #99 | {original_content}"""} |
| #100 | ] |
| #101 | |
| #102 | response = openai.chat.completions.create( |
| #103 | model="gpt-4.1-nano-2025-04-14", |
| #104 | messages=messages |
| #105 | ) |
| #106 | clean_response = response.choices[0].message.content.strip() |
| #107 | |
| #108 | return clean_response |
| #109 | ``` |
| #110 | |
| #111 | ## Complete Workflow: Content Editing |
| #112 | |
| #113 | ```python |
| #114 | def content_writing_workflow(content): |
| #115 | """Automated workflow for editing a document based on writing preferences.""" |
| #116 | |
| #117 | # Store writing preferences (if not already stored) |
| #118 | store_writing_preferences() # Ideally done once, or with a conditional check |
| #119 | |
| #120 | # Edit the document with Mem0 preferences |
| #121 | edited_content = apply_writing_style(content) |
| #122 | |
| #123 | if not edited_content: |
| #124 | return "Failed to edit document." |
| #125 | |
| #126 | # Display results |
| #127 | print("\n=== ORIGINAL DOCUMENT ===\n") |
| #128 | print(content) |
| #129 | |
| #130 | print("\n=== EDITED DOCUMENT ===\n") |
| #131 | print(edited_content) |
| #132 | |
| #133 | return edited_content |
| #134 | ``` |
| #135 | |
| #136 | ## Example Usage |
| #137 | |
| #138 | ```python |
| #139 | # Define your document |
| #140 | original_content = """Project Proposal |
| #141 | |
| #142 | The following proposal outlines our strategy for the Q3 marketing campaign. |
| #143 | We believe this approach will significantly increase our market share. |
| #144 | |
| #145 | Increase brand awareness |
| #146 | Boost sales by 15% |
| #147 | Expand our social media following |
| #148 | |
| #149 | We plan to launch the campaign in July and continue through September. |
| #150 | """ |
| #151 | |
| #152 | # Run the workflow |
| #153 | result = content_writing_workflow(original_content) |
| #154 | ``` |
| #155 | |
| #156 | ## Expected Output |
| #157 | |
| #158 | Your document will be transformed into a structured, well-formatted version based on your preferences. |
| #159 | |
| #160 | ### Original Document |
| #161 | ``` |
| #162 | Project Proposal |
| #163 | |
| #164 | The following proposal outlines our strategy for the Q3 marketing campaign. |
| #165 | We believe this approach will significantly increase our market share. |
| #166 | |
| #167 | Increase brand awareness |
| #168 | Boost sales by 15% |
| #169 | Expand our social media following |
| #170 | |
| #171 | We plan to launch the campaign in July and continue through September. |
| #172 | ``` |
| #173 | |
| #174 | ### Edited Document |
| #175 | |
| #176 | ``` |
| #177 | # Project Proposal |
| #178 | |
| #179 | ## Q3 Marketing Campaign Strategy |
| #180 | |
| #181 | This proposal outlines our strategy for the Q3 marketing campaign. We aim to significantly increase our market share with this approach. |
| #182 | |
| #183 | ### Objectives |
| #184 | |
| #185 | - **Increase Brand Awareness**: Implement targeted advertising and community engagement to enhance visibility. |
| #186 | - **Boost Sales by 15%**: Increase sales by 15% compared to Q2 figures. |
| #187 | - **Expand Social Media Following**: Grow our social media audience by 20%. |
| #188 | |
| #189 | ### Timeline |
| #190 | |
| #191 | - **Launch Date**: July |
| #192 | - **Duration**: July – September |
| #193 | |
| #194 | ### Key Actions |
| #195 | |
| #196 | - **Targeted Advertising**: Utilize platforms like Google Ads and Facebook to reach specific demographics. |
| #197 | - **Community Engagement**: Host webinars and live Q&A sessions. |
| #198 | - **Content Creation**: Produce engaging videos and infographics. |
| #199 | |
| #200 | ### Supporting Data |
| #201 | |
| #202 | - **Previous Campaign Success**: Our Q2 campaign increased sales by 12%. We will refine similar strategies for Q3. |
| #203 | - **Social Media Growth**: Last year, our Instagram followers grew by 25% during a similar campaign. |
| #204 | |
| #205 | ### Conclusion |
| #206 | |
| #207 | We believe this strategy will effectively increase our market share. To achieve these goals, we need your support and collaboration. Let’s work together to make this campaign a success. Please review the proposal and provide your feedback by the end of the week. |
| #208 | ``` |
| #209 | |
| #210 | Mem0 enables a seamless, intelligent content-writing workflow, perfect for content creators, marketers, and technical writers looking to scale their personal tone and structure across work. |
| #211 | |
| #212 | --- |
| #213 | |
| #214 | <CardGroup cols={2}> |
| #215 | <Card title="Control Memory Ingestion" icon="filter" href="/cookbooks/essentials/controlling-memory-ingestion"> |
| #216 | Filter and curate content examples to maintain consistent writing style. |
| #217 | </Card> |
| #218 | <Card title="Email Automation with Mem0" icon="envelope" href="/cookbooks/operations/email-automation"> |
| #219 | Automate email drafting with memory-powered context and tone matching. |
| #220 | </Card> |
| #221 | </CardGroup> |
| #222 |